[PATCH 04/13] src/openvz: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT

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

 



Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/openvz/openvz_conf.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
index 0ea8243..11f048b 100644
--- a/src/openvz/openvz_conf.c
+++ b/src/openvz/openvz_conf.c
@@ -232,10 +232,8 @@ openvzReadNetworkConf(virDomainDefPtr def,
             if (VIR_STRDUP(net->data.ethernet.ipaddr, token) < 0)
                 goto error;
 
-            if (VIR_REALLOC_N(def->nets, def->nnets + 1) < 0)
+            if (VIR_APPEND_ELEMENT_COPY(def->nets, def->nnets, net) < 0)
                 goto error;
-            def->nets[def->nnets++] = net;
-            net = NULL;
 
             token = strtok_r(NULL, " ", &saveptr);
         }
@@ -326,10 +324,8 @@ openvzReadNetworkConf(virDomainDefPtr def,
                 p = ++next;
             } while (p < token + strlen(token));
 
-            if (VIR_REALLOC_N(def->nets, def->nnets + 1) < 0)
+            if (VIR_APPEND_ELEMENT_COPY(def->nets, def->nnets, net) < 0)
                 goto error;
-            def->nets[def->nnets++] = net;
-            net = NULL;
 
             token = strtok_r(NULL, ";", &saveptr);
         }
@@ -450,10 +446,8 @@ openvzReadFSConf(virDomainDefPtr def,
         }
     }
 
-    if (VIR_REALLOC_N(def->fss, def->nfss + 1) < 0)
+    if (VIR_APPEND_ELEMENT(def->fss, def->nfss, fs) < 0)
         goto error;
-    def->fss[def->nfss++] = fs;
-    fs = NULL;
 
     VIR_FREE(temp);
 
-- 
1.9.0

--
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]