]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: make virNetworkIpDefClear consistent with other functions
authorLaine Stump <laine@laine.org>
Sun, 11 Nov 2012 15:27:55 +0000 (10:27 -0500)
committerLaine Stump <laine@laine.org>
Tue, 11 Dec 2012 10:49:44 +0000 (05:49 -0500)
The other clear functions in network_conf.c that clear out arrays of
sub-objects do so by using the n[itemname]s value as a counter going
down to 0. Make this one consistent. There's no functional value, just
makes the style more consistent with the rest of the file.

src/conf/network_conf.c

index 0091c8a7c25356f01aa0b70d531c2ac8b84b02ec..9213371b804090d44024476a4fa1b5e03dba8e1d 100644 (file)
@@ -118,15 +118,14 @@ virNetworkDHCPHostDefClear(virNetworkDHCPHostDefPtr def)
     VIR_FREE(def->name);
 }
 
-static void virNetworkIpDefClear(virNetworkIpDefPtr def)
+static void
+virNetworkIpDefClear(virNetworkIpDefPtr def)
 {
-    int ii;
-
     VIR_FREE(def->family);
     VIR_FREE(def->ranges);
 
-    for (ii = 0 ; ii < def->nhosts && def->hosts ; ii++)
-        virNetworkDHCPHostDefClear(&def->hosts[ii]);
+    while (def->nhosts--)
+        virNetworkDHCPHostDefClear(&def->hosts[def->nhosts]);
 
     VIR_FREE(def->hosts);
     VIR_FREE(def->tftproot);