From nobody Sun Feb 8 11:17:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.120 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=1571576198; cv=none; d=zoho.com; s=zohoarc; b=Vhs4rppBK5ys8dO/MDnERGolqOzEnY49QUw3XHbE9PNWi0vaKejEm+KWaj89fcBvbzLzrj1V4LZ1rlwcckq1Vm1Hoo6ZHzMuh/vIvNKkEFTBTHF5GWxWoFEwsuaCYR2ntFeVZBdZn0pwC5kR/hLZFOYQZeWlzgvEaAdJ8lXun1s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571576198; 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=ZHPd/2XOkLZ4WtgJhSYPPsHVYl/afy36Jj/wpSfZUHU=; b=Q3rWbNLPB93dIOZGIs/sWqWYpLk+OTNfaTdUMNJOqAd+cifPQUkiXJqNlWtwJvNkjtMTu50hx3usZcxhEaYJOrpco8XfR549kv7o8SnoIOGecdUFYEBUdUHfLAQ+zaMTnnVHYVJM8/yJJYE5pAFC/fu0lkADrXsVCP7Roz4lM50= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1571576198364523.140134919431; Sun, 20 Oct 2019 05:56:38 -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-221-nICoVje2P1KiPyX99kNdEw-1; Sun, 20 Oct 2019 08:56:35 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8E5CA107AFC7; Sun, 20 Oct 2019 12:56:26 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 64CA960C4E; Sun, 20 Oct 2019 12:56:26 +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 233E81806B14; Sun, 20 Oct 2019 12:56:26 +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 x9KCtii5023407 for ; Sun, 20 Oct 2019 08:55:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 693B4196AE; Sun, 20 Oct 2019 12:55:44 +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 C26553CC8 for ; Sun, 20 Oct 2019 12:55:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571576197; 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=ZHPd/2XOkLZ4WtgJhSYPPsHVYl/afy36Jj/wpSfZUHU=; b=IjKkEqepLjog5lIiGW1Shf/1bQK0McxKLSO6ZdXp15EizVB66mN8nuASUylkctvIO//ogo nUXfVPAYdvRbhNnWkOhu0bbNE8iBio+xitllYABrYmdd1eUda2nLm+yNSLSW6xGSKsQZ9r 2reeVnUqpPldfroC0kBvFqF8j1XBBy0= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Sun, 20 Oct 2019 14:55:30 +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 12/34] datatypes: 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.12 X-MC-Unique: nICoVje2P1KiPyX99kNdEw-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/datatypes.c | 45 ++++++++++++++++----------------------------- 1 file changed, 16 insertions(+), 29 deletions(-) diff --git a/src/datatypes.c b/src/datatypes.c index 33c3f6be88..552115c7a3 100644 --- a/src/datatypes.c +++ b/src/datatypes.c @@ -290,8 +290,7 @@ virGetDomain(virConnectPtr conn, if (!(ret =3D virObjectNew(virDomainClass))) goto error; =20 - if (VIR_STRDUP(ret->name, name) < 0) - goto error; + ret->name =3D g_strdup(name); =20 ret->conn =3D virObjectRef(conn); ret->id =3D id; @@ -354,8 +353,7 @@ virGetNetwork(virConnectPtr conn, const char *name, con= st unsigned char *uuid) if (!(ret =3D virObjectNew(virNetworkClass))) goto error; =20 - if (VIR_STRDUP(ret->name, name) < 0) - goto error; + ret->name =3D g_strdup(name); =20 ret->conn =3D virObjectRef(conn); memcpy(&(ret->uuid[0]), uuid, VIR_UUID_BUFLEN); @@ -477,9 +475,8 @@ virGetInterface(virConnectPtr conn, const char *name, c= onst char *mac) if (!(ret =3D virObjectNew(virInterfaceClass))) goto error; =20 - if (VIR_STRDUP(ret->name, name) < 0 || - VIR_STRDUP(ret->mac, mac) < 0) - goto error; + ret->name =3D g_strdup(name); + ret->mac =3D g_strdup(mac); =20 ret->conn =3D virObjectRef(conn); =20 @@ -542,8 +539,7 @@ virGetStoragePool(virConnectPtr conn, const char *name, if (!(ret =3D virObjectNew(virStoragePoolClass))) goto error; =20 - if (VIR_STRDUP(ret->name, name) < 0) - goto error; + ret->name =3D g_strdup(name); =20 ret->conn =3D virObjectRef(conn); memcpy(&(ret->uuid[0]), uuid, VIR_UUID_BUFLEN); @@ -618,10 +614,9 @@ virGetStorageVol(virConnectPtr conn, const char *pool,= const char *name, if (!(ret =3D virObjectNew(virStorageVolClass))) goto error; =20 - if (VIR_STRDUP(ret->pool, pool) < 0 || - VIR_STRDUP(ret->name, name) < 0 || - VIR_STRDUP(ret->key, key) < 0) - goto error; + ret->pool =3D g_strdup(pool); + ret->name =3D g_strdup(name); + ret->key =3D g_strdup(key); =20 ret->conn =3D virObjectRef(conn); =20 @@ -687,8 +682,7 @@ virGetNodeDevice(virConnectPtr conn, const char *name) if (!(ret =3D virObjectNew(virNodeDeviceClass))) goto error; =20 - if (VIR_STRDUP(ret->name, name) < 0) - goto error; + ret->name =3D g_strdup(name); =20 ret->conn =3D virObjectRef(conn); return ret; @@ -749,8 +743,7 @@ virGetSecret(virConnectPtr conn, const unsigned char *u= uid, =20 memcpy(&(ret->uuid[0]), uuid, VIR_UUID_BUFLEN); ret->usageType =3D usageType; - if (VIR_STRDUP(ret->usageID, NULLSTR_EMPTY(usageID)) < 0) - goto error; + ret->usageID =3D g_strdup(NULLSTR_EMPTY(usageID)); =20 ret->conn =3D virObjectRef(conn); =20 @@ -859,8 +852,7 @@ virGetNWFilter(virConnectPtr conn, const char *name, if (!(ret =3D virObjectNew(virNWFilterClass))) goto error; =20 - if (VIR_STRDUP(ret->name, name) < 0) - goto error; + ret->name =3D g_strdup(name); =20 memcpy(&(ret->uuid[0]), uuid, VIR_UUID_BUFLEN); =20 @@ -924,11 +916,9 @@ virGetNWFilterBinding(virConnectPtr conn, const char *= portdev, if (!(ret =3D virObjectNew(virNWFilterBindingClass))) goto error; =20 - if (VIR_STRDUP(ret->portdev, portdev) < 0) - goto error; + ret->portdev =3D g_strdup(portdev); =20 - if (VIR_STRDUP(ret->filtername, filtername) < 0) - goto error; + ret->filtername =3D g_strdup(filtername); =20 ret->conn =3D virObjectRef(conn); =20 @@ -987,8 +977,7 @@ virGetDomainCheckpoint(virDomainPtr domain, =20 if (!(ret =3D virObjectNew(virDomainCheckpointClass))) goto error; - if (VIR_STRDUP(ret->name, name) < 0) - goto error; + ret->name =3D g_strdup(name); =20 ret->domain =3D virObjectRef(domain); =20 @@ -1044,8 +1033,7 @@ virGetDomainSnapshot(virDomainPtr domain, const char = *name) =20 if (!(ret =3D virObjectNew(virDomainSnapshotClass))) goto error; - if (VIR_STRDUP(ret->name, name) < 0) - goto error; + ret->name =3D g_strdup(name); =20 ret->domain =3D virObjectRef(domain); =20 @@ -1192,8 +1180,7 @@ virAdmGetServer(virAdmConnectPtr conn, const char *na= me) =20 if (!(ret =3D virObjectNew(virAdmServerClass))) goto error; - if (VIR_STRDUP(ret->name, name) < 0) - goto error; + ret->name =3D g_strdup(name); =20 ret->conn =3D virObjectRef(conn); =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list