From: Michal Privoznik Date: Fri, 7 Mar 2014 08:33:31 +0000 (+0100) Subject: src/openvz: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT X-Git-Tag: v1.2.3-rc1~325 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d9e4d5cb7c2ef48f89335d80dcb72d2b127869c5;p=thirdparty%2Flibvirt.git src/openvz: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT Signed-off-by: Michal Privoznik --- diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c index 0ea8243a24..11f048bd1f 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);