]> xenbits.xensource.com Git - libvirt.git/commitdiff
util: Remove need for local 'nelems'
authorJohn Ferlan <jferlan@redhat.com>
Mon, 10 Oct 2016 20:08:39 +0000 (16:08 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Mon, 10 Oct 2016 20:08:39 +0000 (16:08 -0400)
Since it's only used in loop - just go direct.

src/util/virqemu.c

index 0b516fc71bff0ddd0478c89be8527edcaf1b88fb..7849d8b3eb146bf95d422c3856087b4f6a964573 100644 (file)
@@ -85,12 +85,11 @@ virQEMUBuildCommandLineJSONArrayNumbered(const char *key,
                                          virBufferPtr buf)
 {
     const virJSONValue *member;
-    ssize_t nelems = virJSONValueArraySize(array);
     char *prefix = NULL;
     size_t i;
     int ret = 0;
 
-    for (i = 0; i < nelems; i++) {
+    for (i = 0; i < virJSONValueArraySize(array); i++) {
         member = virJSONValueArrayGet((virJSONValuePtr) array, i);
 
         if (virAsprintf(&prefix, "%s.%zu", key, i) < 0)