[PATCHv2 5/7] conf: make virNetworkIpDefClear consistent with other functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 0842b71..3e63764 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -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);
-- 
1.7.11.7

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]