[libvirt] [PATCH] tools: fix a judgment of equalling zero about an array's length
Eric Blake
eblake at redhat.com
Fri Sep 13 02:48:33 UTC 2013
On 09/12/2013 08:00 PM, lawrancejing wrote:
> There is no need to go on executing code when the array's length is zero.
> ---
> tools/virsh-snapshot.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
> index e37a5b3..d7a4c7b 100644
> --- a/tools/virsh-snapshot.c
> +++ b/tools/virsh-snapshot.c
> @@ -239,7 +239,7 @@ vshParseSnapshotMemspec(vshControl *ctl, virBufferPtr buf, const char *str)
> return 0;
>
> narray = vshStringToArray(str, &array);
> - if (narray < 0)
> + if (narray <= 0)
> goto cleanup;
Makes no difference. narray == 0 is not a possible return value from
vshStringToArray, which always returns -1 or a positive number.
Therefore, I don't see the need to apply this.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130912/e233693e/attachment-0001.sig>
More information about the libvir-list
mailing list