From nobody Sun Feb 8 13:10:43 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1571576201; cv=none; d=zoho.com; s=zohoarc; b=e6FafUr8A2m03z7Dnj6uhWt31Nibt+i/TWzAaoRuBdx8JxrIxJbbUX4xl6AYL5Mk3ba4lm82AdHHsPwJ8GjLPGoI39QbJMZpEaFm14VGgJBFe7T/yCE/ajwsg0N1PPBeQGnc1RuFgSUli8MUrRukJfhSFtRnyQ/yKNQFkohNK8o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571576201; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=i2gkWQk/o+JSGJXUrfr6abf9a2eTfwnRctOf9MmWih8=; b=L8n8XJ53IqeiysKweWSNihskQFvY0Cx3dAUMY7jafU+8ygkRpQFNGOslerDkqMFu4eaKA6l97jDmjAOlPw25mtTjiOVgLuEWZdJ1LfXB0AteLE9GuBHY/JMvVPaEWZExqyrgc7FA/w7IkYMJWvwAC++Nq+07sjKT/fj7A1DUfmg= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1571576201813600.2178951890908; Sun, 20 Oct 2019 05:56:41 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-82-MRWOMhQxMha6hClvHyh5AA-1; Sun, 20 Oct 2019 08:56:38 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BBD875F2; Sun, 20 Oct 2019 12:56:32 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8E02F5B6A5; Sun, 20 Oct 2019 12:56:32 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 4F2203FB43; Sun, 20 Oct 2019 12:56:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9KCu9Uv023605 for ; Sun, 20 Oct 2019 08:56:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9F8793DA3; Sun, 20 Oct 2019 12:56:09 +0000 (UTC) Received: from lpt.redhat.com (ovpn-200-23.brq.redhat.com [10.40.200.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0F8CB9473 for ; Sun, 20 Oct 2019 12:56:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571576200; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=i2gkWQk/o+JSGJXUrfr6abf9a2eTfwnRctOf9MmWih8=; b=LRi7LaBOTRfKb1KsdPK0lulNPxWWrAP13nYVuLIJGA2ENCVV3SeuyJ2ep0xENJgmuRDHKi TjRM01rrJfhn74Z4CRum0MTpRpfdsPM8vEWaddwLciPTtRKMSO4h4iLjHLUdbSv+2ku0i9 NWmSmVW+jVG2uj94Cq48y7xOY6JimcY= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Sun, 20 Oct 2019 14:55:46 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 28/34] virstorage: use g_strdup instead of VIR_STRDUP X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: MRWOMhQxMha6hClvHyh5AA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Replace all occurrences of if (VIR_STRDUP(a, b) < 0) /* effectively dead code */ with: a =3D g_strdup(b); Signed-off-by: J=C3=A1n Tomko --- src/util/virstorageencryption.c | 11 +- src/util/virstoragefile.c | 188 ++++++++++++-------------------- 2 files changed, 72 insertions(+), 127 deletions(-) diff --git a/src/util/virstorageencryption.c b/src/util/virstorageencryptio= n.c index 14d7dc26e2..74836d4a00 100644 --- a/src/util/virstorageencryption.c +++ b/src/util/virstorageencryption.c @@ -101,12 +101,11 @@ virStorageEncryptionInfoDefCopy(const virStorageEncry= ptionInfoDef *src, virStorageEncryptionInfoDefPtr dst) { dst->cipher_size =3D src->cipher_size; - if (VIR_STRDUP(dst->cipher_name, src->cipher_name) < 0 || - VIR_STRDUP(dst->cipher_mode, src->cipher_mode) < 0 || - VIR_STRDUP(dst->cipher_hash, src->cipher_hash) < 0 || - VIR_STRDUP(dst->ivgen_name, src->ivgen_name) < 0 || - VIR_STRDUP(dst->ivgen_hash, src->ivgen_hash) < 0) - return -1; + dst->cipher_name =3D g_strdup(src->cipher_name); + dst->cipher_mode =3D g_strdup(src->cipher_mode); + dst->cipher_hash =3D g_strdup(src->cipher_hash); + dst->ivgen_name =3D g_strdup(src->ivgen_name); + dst->ivgen_hash =3D g_strdup(src->ivgen_hash); =20 return 0; } diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index c13ed9fee5..be2b5479bb 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -644,8 +644,7 @@ vmdk4GetBackingStore(char **res, goto cleanup; } *end =3D '\0'; - if (VIR_STRDUP(*res, start) < 0) - goto cleanup; + *res =3D g_strdup(start); =20 ret =3D BACKING_STORE_OK; =20 @@ -1068,9 +1067,8 @@ virStorageFileGetMetadataInternal(virStorageSourcePtr= meta, } =20 VIR_FREE(meta->compat); - if (meta->format =3D=3D VIR_STORAGE_FILE_QCOW2 && meta->features && - VIR_STRDUP(meta->compat, "1.1") < 0) - return -1; + if (meta->format =3D=3D VIR_STORAGE_FILE_QCOW2 && meta->features) + meta->compat =3D g_strdup("1.1"); =20 return 0; } @@ -1138,8 +1136,7 @@ virStorageFileMetadataNew(const char *path, def->format =3D format; def->type =3D VIR_STORAGE_TYPE_FILE; =20 - if (VIR_STRDUP(def->path, path) < 0) - return NULL; + def->path =3D g_strdup(path); =20 ret =3D g_steal_pointer(&def); return ret; @@ -1290,8 +1287,7 @@ virStorageFileChainGetBroken(virStorageSourcePtr chai= n, /* Break when we hit end of chain; report error if we detected * a missing backing file, infinite loop, or other error */ if (!tmp->backingStore && tmp->backingStoreRaw) { - if (VIR_STRDUP(*brokenFile, tmp->backingStoreRaw) < 0) - return -1; + *brokenFile =3D g_strdup(tmp->backingStoreRaw); =20 return 0; } @@ -1591,9 +1587,8 @@ virStorageFileParseBackingStoreStr(const char *str, return -1; } =20 - if (target && - VIR_STRDUP(*target, strings[0]) < 0) - return -1; + if (target) + *target =3D g_strdup(strings[0]); =20 *chainIndex =3D idx; return 0; @@ -1820,11 +1815,8 @@ virStorageNetHostDefCopy(size_t nhosts, dst->transport =3D src->transport; dst->port =3D src->port; =20 - if (VIR_STRDUP(dst->name, src->name) < 0) - goto error; - - if (VIR_STRDUP(dst->socket, src->socket) < 0) - goto error; + dst->name =3D g_strdup(src->name); + dst->socket =3D g_strdup(src->socket); } =20 return ret; @@ -1857,11 +1849,9 @@ virStorageAuthDefCopy(const virStorageAuthDef *src) if (VIR_ALLOC(authdef) < 0) return NULL; =20 - if (VIR_STRDUP(authdef->username, src->username) < 0) - return NULL; + authdef->username =3D g_strdup(src->username); /* Not present for storage pool, but used for disk source */ - if (VIR_STRDUP(authdef->secrettype, src->secrettype) < 0) - return NULL; + authdef->secrettype =3D g_strdup(src->secrettype); authdef->authType =3D src->authType; =20 if (virSecretLookupDefCopy(&authdef->seclookupdef, &src->seclookupdef)= < 0) @@ -2109,13 +2099,11 @@ virStoragePRDefCopy(virStoragePRDefPtr src) =20 copy->managed =3D src->managed; =20 - if (VIR_STRDUP(copy->path, src->path) < 0 || - VIR_STRDUP(copy->mgralias, src->mgralias) < 0) - goto cleanup; + copy->path =3D g_strdup(src->path); + copy->mgralias =3D g_strdup(src->mgralias); =20 ret =3D g_steal_pointer(©); =20 - cleanup: virStoragePRDefFree(copy); return ret; } @@ -2201,14 +2189,9 @@ virStoragePermsCopy(const virStoragePerms *src) ret->uid =3D src->uid; ret->gid =3D src->gid; =20 - if (VIR_STRDUP(ret->label, src->label) < 0) - goto error; + ret->label =3D g_strdup(src->label); =20 return ret; - - error: - virStoragePermsFree(ret); - return NULL; } =20 =20 @@ -2225,15 +2208,10 @@ virStorageSourcePoolDefCopy(const virStorageSourceP= oolDef *src) ret->actualtype =3D src->actualtype; ret->mode =3D src->mode; =20 - if (VIR_STRDUP(ret->pool, src->pool) < 0 || - VIR_STRDUP(ret->volume, src->volume) < 0) - goto error; + ret->pool =3D g_strdup(src->pool); + ret->volume =3D g_strdup(src->volume); =20 return ret; - - error: - virStorageSourcePoolDefFree(ret); - return NULL; } =20 =20 @@ -2279,19 +2257,18 @@ virStorageSourceCopy(const virStorageSource *src, /* storage driver metadata are not copied */ def->drv =3D NULL; =20 - if (VIR_STRDUP(def->path, src->path) < 0 || - VIR_STRDUP(def->volume, src->volume) < 0 || - VIR_STRDUP(def->relPath, src->relPath) < 0 || - VIR_STRDUP(def->backingStoreRaw, src->backingStoreRaw) < 0 || - VIR_STRDUP(def->externalDataStoreRaw, src->externalDataStoreRaw) <= 0 || - VIR_STRDUP(def->snapshot, src->snapshot) < 0 || - VIR_STRDUP(def->configFile, src->configFile) < 0 || - VIR_STRDUP(def->nodeformat, src->nodeformat) < 0 || - VIR_STRDUP(def->nodestorage, src->nodestorage) < 0 || - VIR_STRDUP(def->compat, src->compat) < 0 || - VIR_STRDUP(def->tlsAlias, src->tlsAlias) < 0 || - VIR_STRDUP(def->tlsCertdir, src->tlsCertdir) < 0) - return NULL; + def->path =3D g_strdup(src->path); + def->volume =3D g_strdup(src->volume); + def->relPath =3D g_strdup(src->relPath); + def->backingStoreRaw =3D g_strdup(src->backingStoreRaw); + def->externalDataStoreRaw =3D g_strdup(src->externalDataStoreRaw); + def->snapshot =3D g_strdup(src->snapshot); + def->configFile =3D g_strdup(src->configFile); + def->nodeformat =3D g_strdup(src->nodeformat); + def->nodestorage =3D g_strdup(src->nodestorage); + def->compat =3D g_strdup(src->compat); + def->tlsAlias =3D g_strdup(src->tlsAlias); + def->tlsCertdir =3D g_strdup(src->tlsCertdir); =20 if (src->nhosts) { if (!(def->hosts =3D virStorageNetHostDefCopy(src->nhosts, src->ho= sts))) @@ -2635,8 +2612,7 @@ virStorageSourceNewFromBackingRelative(virStorageSour= cePtr parent, return NULL; =20 /* store relative name */ - if (VIR_STRDUP(def->relPath, rel) < 0) - return NULL; + def->relPath =3D g_strdup(rel); =20 if (!(dirname =3D mdir_name(parent->path))) { virReportOOMError(); @@ -2664,8 +2640,7 @@ virStorageSourceNewFromBackingRelative(virStorageSour= cePtr parent, def->nhosts =3D parent->nhosts; } =20 - if (VIR_STRDUP(def->volume, parent->volume) < 0) - return NULL; + def->volume =3D g_strdup(parent->volume); } else { /* set the type to _FILE, the caller shall update it to the actual= type */ def->type =3D VIR_STORAGE_TYPE_FILE; @@ -2716,10 +2691,8 @@ virStorageSourceParseBackingURI(virStorageSourcePtr = src, } =20 /* handle socket stored as a query */ - if (uri->query) { - if (VIR_STRDUP(src->hosts->socket, STRSKIP(uri->query, "socket=3D"= )) < 0) - return -1; - } + if (uri->query) + src->hosts->socket =3D g_strdup(STRSKIP(uri->query, "socket=3D")); =20 /* uri->path is NULL if the URI does not contain slash after host: * transport://host:port */ @@ -2737,8 +2710,7 @@ virStorageSourceParseBackingURI(virStorageSourcePtr s= rc, path[0] =3D=3D '\0') path =3D NULL; =20 - if (VIR_STRDUP(src->path, path) < 0) - return -1; + src->path =3D g_strdup(path); =20 if (src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_GLUSTER) { char *tmp; @@ -2759,16 +2731,14 @@ virStorageSourceParseBackingURI(virStorageSourcePtr= src, =20 src->volume =3D src->path; =20 - if (VIR_STRDUP(src->path, tmp + 1) < 0) - return -1; + src->path =3D g_strdup(tmp + 1); =20 tmp[0] =3D '\0'; } =20 src->hosts->port =3D uri->port; =20 - if (VIR_STRDUP(src->hosts->name, uri->server) < 0) - return -1; + src->hosts->name =3D g_strdup(uri->server); =20 /* Libvirt doesn't handle inline authentication. Make the caller aware= . */ if (uri->user) @@ -2835,28 +2805,24 @@ virStorageSourceParseRBDColonString(const char *rbd= str, if (STRPREFIX(rbdstr, "rbd:")) rbdstr +=3D strlen("rbd:"); =20 - if (VIR_STRDUP(src->path, rbdstr) < 0) - return -1; + src->path =3D g_strdup(rbdstr); =20 p =3D strchr(src->path, ':'); if (p) { - if (VIR_STRDUP(options, p + 1) < 0) - return -1; + options =3D g_strdup(p + 1); *p =3D '\0'; } =20 /* snapshot name */ if ((p =3D strchr(src->path, '@'))) { - if (VIR_STRDUP(src->snapshot, p + 1) < 0) - return -1; + src->snapshot =3D g_strdup(p + 1); *p =3D '\0'; } =20 /* pool vs. image name */ if ((p =3D strchr(src->path, '/'))) { src->volume =3D g_steal_pointer(&src->path); - if (VIR_STRDUP(src->path, p + 1) < 0) - return -1; + src->path =3D g_strdup(p + 1); *p =3D '\0'; } =20 @@ -2891,12 +2857,9 @@ virStorageSourceParseRBDColonString(const char *rbds= tr, if (VIR_ALLOC(authdef) < 0) return -1; =20 - if (VIR_STRDUP(authdef->username, p + strlen("id=3D")) < 0) - return -1; + authdef->username =3D g_strdup(p + strlen("id=3D")); =20 - if (VIR_STRDUP(authdef->secrettype, - virSecretUsageTypeToString(VIR_SECRET_USAGE_TYP= E_CEPH)) < 0) - return -1; + authdef->secrettype =3D g_strdup(virSecretUsageTypeToString(VI= R_SECRET_USAGE_TYPE_CEPH)); src->auth =3D g_steal_pointer(&authdef); src->authInherited =3D true; =20 @@ -2926,9 +2889,8 @@ virStorageSourceParseRBDColonString(const char *rbdst= r, } } =20 - if (STRPREFIX(p, "conf=3D") && - VIR_STRDUP(src->configFile, p + strlen("conf=3D")) < 0) - return -1; + if (STRPREFIX(p, "conf=3D")) + src->configFile =3D g_strdup(p + strlen("conf=3D")); =20 p =3D next; } @@ -2971,12 +2933,10 @@ virStorageSourceParseNBDColonString(const char *nbd= str, return -1; } =20 - if (VIR_STRDUP(src->hosts->socket, backing[2]) < 0) - return -1; + src->hosts->socket =3D g_strdup(backing[2]); =20 } else { - if (VIR_STRDUP(src->hosts->name, backing[1]) < 0) - return -1; + src->hosts->name =3D g_strdup(backing[1]); =20 if (!backing[2]) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -2991,8 +2951,7 @@ virStorageSourceParseNBDColonString(const char *nbdst= r, =20 if ((exportname =3D strstr(nbdstr, "exportname=3D"))) { exportname +=3D strlen("exportname=3D"); - if (VIR_STRDUP(src->path, exportname) < 0) - return -1; + src->path =3D g_strdup(exportname); } =20 return 0; @@ -3080,8 +3039,7 @@ virStorageSourceParseBackingJSONPath(virStorageSource= Ptr src, return -1; } =20 - if (VIR_STRDUP(src->path, path) < 0) - return -1; + src->path =3D g_strdup(path); =20 src->type =3D type; return 0; @@ -3153,9 +3111,9 @@ virStorageSourceParseBackingJSONInetSocketAddress(vir= StorageNetHostDefPtr host, } =20 host->transport =3D VIR_STORAGE_NET_HOST_TRANS_TCP; + host->name =3D g_strdup(hostname); =20 - if (VIR_STRDUP(host->name, hostname) < 0 || - virStringParsePort(port, &host->port) < 0) + if (virStringParsePort(port, &host->port) < 0) return -1; =20 return 0; @@ -3202,8 +3160,7 @@ virStorageSourceParseBackingJSONSocketAddress(virStor= ageNetHostDefPtr host, return -1; } =20 - if (VIR_STRDUP(host->socket, socket) < 0) - return -1; + host->socket =3D g_strdup(socket); } else { virReportError(VIR_ERR_INTERNAL_ERROR, _("backing store protocol '%s' is not yet supported= "), @@ -3242,9 +3199,8 @@ virStorageSourceParseBackingJSONGluster(virStorageSou= rcePtr src, src->type =3D VIR_STORAGE_TYPE_NETWORK; src->protocol =3D VIR_STORAGE_NET_PROTOCOL_GLUSTER; =20 - if (VIR_STRDUP(src->volume, volume) < 0 || - VIR_STRDUP(src->path, path) < 0) - return -1; + src->volume =3D g_strdup(volume); + src->path =3D g_strdup(path); =20 nservers =3D virJSONValueArraySize(server); if (nservers =3D=3D 0) { @@ -3317,8 +3273,7 @@ virStorageSourceParseBackingJSONiSCSI(virStorageSourc= ePtr src, return -1; } =20 - if (VIR_STRDUP(src->hosts->name, portal) < 0) - return -1; + src->hosts->name =3D g_strdup(portal); =20 if ((port =3D strrchr(src->hosts->name, ':')) && !strchr(port, ']')) { @@ -3361,8 +3316,7 @@ virStorageSourceParseBackingJSONNbd(virStorageSourceP= tr src, src->type =3D VIR_STORAGE_TYPE_NETWORK; src->protocol =3D VIR_STORAGE_NET_PROTOCOL_NBD; =20 - if (VIR_STRDUP(src->path, export) < 0) - return -1; + src->path =3D g_strdup(export); =20 if (VIR_ALLOC_N(src->hosts, 1) < 0) return -1; @@ -3374,12 +3328,10 @@ virStorageSourceParseBackingJSONNbd(virStorageSourc= ePtr src, } else { if (path) { src->hosts[0].transport =3D VIR_STORAGE_NET_HOST_TRANS_UNIX; - if (VIR_STRDUP(src->hosts[0].socket, path) < 0) - return -1; + src->hosts[0].socket =3D g_strdup(path); } else { src->hosts[0].transport =3D VIR_STORAGE_NET_HOST_TRANS_TCP; - if (VIR_STRDUP(src->hosts[0].name, host) < 0) - return -1; + src->hosts[0].name =3D g_strdup(host); =20 if (virStringParsePort(port, &src->hosts[0].port) < 0) return -1; @@ -3419,8 +3371,7 @@ virStorageSourceParseBackingJSONSheepdog(virStorageSo= urcePtr src, return -1; } =20 - if (VIR_STRDUP(src->path, vdi) < 0) - return -1; + src->path =3D g_strdup(vdi); =20 if (VIR_ALLOC(src->hosts) < 0) return -1; @@ -3454,8 +3405,7 @@ virStorageSourceParseBackingJSONSSH(virStorageSourceP= tr src, src->type =3D VIR_STORAGE_TYPE_NETWORK; src->protocol =3D VIR_STORAGE_NET_PROTOCOL_SSH; =20 - if (VIR_STRDUP(src->path, path) < 0) - return -1; + src->path =3D g_strdup(path); =20 if (VIR_ALLOC_N(src->hosts, 1) < 0) return -1; @@ -3467,9 +3417,9 @@ virStorageSourceParseBackingJSONSSH(virStorageSourceP= tr src, return -1; } else { src->hosts[0].transport =3D VIR_STORAGE_NET_HOST_TRANS_TCP; + src->hosts[0].name =3D g_strdup(host); =20 - if (VIR_STRDUP(src->hosts[0].name, host) < 0 || - virStringParsePort(port, &src->hosts[0].port) < 0) + if (virStringParsePort(port, &src->hosts[0].port) < 0) return -1; } =20 @@ -3506,11 +3456,10 @@ virStorageSourceParseBackingJSONRBD(virStorageSourc= ePtr src, return -1; } =20 - if (VIR_STRDUP(src->volume, pool) < 0 || - VIR_STRDUP(src->path, image) < 0 || - VIR_STRDUP(src->snapshot, snapshot) < 0 || - VIR_STRDUP(src->configFile, conf) < 0) - goto cleanup; + src->volume =3D g_strdup(pool); + src->path =3D g_strdup(image); + src->snapshot =3D g_strdup(snapshot); + src->configFile =3D g_strdup(conf); =20 if (servers) { nservers =3D virJSONValueArraySize(servers); @@ -3562,8 +3511,7 @@ virStorageSourceParseBackingJSONVxHS(virStorageSource= Ptr src, src->type =3D VIR_STORAGE_TYPE_NETWORK; src->protocol =3D VIR_STORAGE_NET_PROTOCOL_VXHS; =20 - if (VIR_STRDUP(src->path, vdisk_id) < 0) - return -1; + src->path =3D g_strdup(vdisk_id); =20 if (VIR_ALLOC_N(src->hosts, 1) < 0) return -1; @@ -3691,8 +3639,7 @@ virStorageSourceNewFromBackingAbsolute(const char *pa= th, if (virStorageIsFile(path)) { def->type =3D VIR_STORAGE_TYPE_FILE; =20 - if (VIR_STRDUP(def->path, path) < 0) - return -1; + def->path =3D g_strdup(path); } else { def->type =3D VIR_STORAGE_TYPE_NETWORK; =20 @@ -4213,8 +4160,7 @@ virStorageFileRemoveLastPathComponent(const char *pat= h) { char *ret; =20 - if (VIR_STRDUP(ret, NULLSTR_EMPTY(path)) < 0) - return NULL; + ret =3D g_strdup(NULLSTR_EMPTY(path)); =20 virFileRemoveLastComponent(ret); =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list