From nobody Fri May 3 00:12:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1549989646245794.4733450986051; Tue, 12 Feb 2019 08:40:46 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1173510FBC; Tue, 12 Feb 2019 16:40:43 +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 B0C5310027DF; Tue, 12 Feb 2019 16:40:42 +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 6A25A3F603; Tue, 12 Feb 2019 16:40:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x1CGeSU0004073 for ; Tue, 12 Feb 2019 11:40:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id 98E3E5C46B; Tue, 12 Feb 2019 16:40:28 +0000 (UTC) Received: from lpt.brq.redhat.com (unknown [10.43.2.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1A9A4600C6 for ; Tue, 12 Feb 2019 16:40:27 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 12 Feb 2019 17:40:35 +0100 Message-Id: <4ff933a57921fd9e5a0f981c89da125323036d19.1549989584.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/6] internal: introduce a family of NULLSTR macros 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 12 Feb 2019 16:40:45 +0000 (UTC) NULLSTR_EMPTY, the quiet child, NULLSTR_STAR, the famous one and NULLSTR_MINUS, the grumpy one. Signed-off-by: J=C3=A1n Tomko --- src/internal.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/internal.h b/src/internal.h index 3f3e567ac9..7c11f57e33 100644 --- a/src/internal.h +++ b/src/internal.h @@ -245,6 +245,21 @@ */ # define EMPTYSTR(s) ((s) ? (s) : "-") =20 +/* + * Turn a NULL string into an empty string + */ +# define NULLSTR_EMPTY(s) ((s) ? (s) : "") + +/* + * Turn a NULL string into a star + */ +# define NULLSTR_STAR(s) ((s) ? (s) : "*") + +/* + * Turn a NULL string into a minus sign + */ +# define NULLSTR_MINUS(s) ((s) ? (s) : "-") + /** * SWAP: * --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 00:12:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1549989636925706.8582921874292; Tue, 12 Feb 2019 08:40:36 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id 6A121C02833D; Tue, 12 Feb 2019 16:40:34 +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 AF54F5B682; Tue, 12 Feb 2019 16:40:33 +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 5AB741819AFB; Tue, 12 Feb 2019 16:40:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x1CGeT0V004085 for ; Tue, 12 Feb 2019 11:40:29 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6B353600C9; Tue, 12 Feb 2019 16:40:29 +0000 (UTC) Received: from lpt.brq.redhat.com (unknown [10.43.2.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id E58976019F for ; Tue, 12 Feb 2019 16:40:28 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 12 Feb 2019 17:40:36 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/6] tools: use NULLSTR_MINUS 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 12 Feb 2019 16:40:35 +0000 (UTC) Use the newly introduced macro in the few places that open-code it. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Andrea Bolognani --- tools/virsh-domain-monitor.c | 4 ++-- tools/virsh-snapshot.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index 1897a626d5..49de81af8c 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -643,11 +643,11 @@ cmdDomblklist(vshControl *ctl, const vshCmd *cmd) "|./source/@volume)", ctxt); if (details) { if (vshTableRowAppend(table, type, device, target, - source ? source : "-", NULL) < 0) + NULLSTR_MINUS(source), NULL) < 0) goto cleanup; } else { if (vshTableRowAppend(table, target, - source ? source : "-", NULL) < 0) + NULLSTR_MINUS(source), NULL) < 0) goto cleanup; } =20 diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index 6d8e2b299b..90000ef1aa 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -945,7 +945,7 @@ cmdSnapshotInfo(vshControl *ctl, const vshCmd *cmd) /* Since we already have the XML, there's no need to call * virDomainSnapshotGetParent */ parent =3D virXPathString("string(/domainsnapshot/parent/name)", ctxt); - vshPrint(ctl, "%-15s %s\n", _("Parent:"), parent ? parent : "-"); + vshPrint(ctl, "%-15s %s\n", _("Parent:"), NULLSTR_MINUS(parent)); =20 /* Children, Descendants. After this point, the fallback to * compute children is too expensive, so we gracefully quit if the --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 00:12:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1549989637082140.13904070760668; Tue, 12 Feb 2019 08:40:37 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D7C49C0669CF; Tue, 12 Feb 2019 16:40:33 +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 9F6295D970; Tue, 12 Feb 2019 16:40:33 +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 26AA81819AF9; Tue, 12 Feb 2019 16:40:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x1CGeU4N004095 for ; Tue, 12 Feb 2019 11:40:30 -0500 Received: by smtp.corp.redhat.com (Postfix) id 42C329CD6; Tue, 12 Feb 2019 16:40:30 +0000 (UTC) Received: from lpt.brq.redhat.com (unknown [10.43.2.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id BE0C5600C6 for ; Tue, 12 Feb 2019 16:40:29 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 12 Feb 2019 17:40:37 +0100 Message-Id: <750739c5641caf4a6ed83919ee406955bd6c2327.1549989584.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/6] Remove EMPTYSTR macro 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 12 Feb 2019 16:40:35 +0000 (UTC) This macro neither takes nor produces an empty string. Remove it in favor of NULLSTR_MINUS. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Andrea Bolognani --- src/internal.h | 5 ----- tools/virsh-network.c | 10 +++++----- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/internal.h b/src/internal.h index 7c11f57e33..cf03a82105 100644 --- a/src/internal.h +++ b/src/internal.h @@ -240,11 +240,6 @@ */ # define NULLSTR(s) ((s) ? (s) : "") =20 -/* - * Similar to NULLSTR, but print '-' to make it more user friendly. - */ -# define EMPTYSTR(s) ((s) ? (s) : "-") - /* * Turn a NULL string into an empty string */ diff --git a/tools/virsh-network.c b/tools/virsh-network.c index 94adbabff7..9b86ef8071 100644 --- a/tools/virsh-network.c +++ b/tools/virsh-network.c @@ -1398,11 +1398,11 @@ cmdNetworkDHCPLeases(vshControl *ctl, const vshCmd = *cmd) =20 if (vshTableRowAppend(table, expirytime, - EMPTYSTR(lease->mac), - EMPTYSTR(typestr), - EMPTYSTR(cidr_format), - EMPTYSTR(lease->hostname), - EMPTYSTR(lease->clientid), + NULLSTR_MINUS(lease->mac), + NULLSTR_MINUS(typestr), + NULLSTR_MINUS(cidr_format), + NULLSTR_MINUS(lease->hostname), + NULLSTR_MINUS(lease->clientid), NULL) < 0) goto cleanup; } --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 00:12:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1549989698799266.1961786049336; Tue, 12 Feb 2019 08:41:38 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 60C6D8763B; Tue, 12 Feb 2019 16:41:35 +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 EBD3F5C226; Tue, 12 Feb 2019 16:41:34 +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 9B2873F602; Tue, 12 Feb 2019 16:41:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x1CGeVrM004102 for ; Tue, 12 Feb 2019 11:40:31 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1769B600C9; Tue, 12 Feb 2019 16:40:31 +0000 (UTC) Received: from lpt.brq.redhat.com (unknown [10.43.2.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 91548600C6 for ; Tue, 12 Feb 2019 16:40:30 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 12 Feb 2019 17:40:38 +0100 Message-Id: <72d02744e2c90d4e142d1177f2233605c2a026ed.1549989584.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/6] Remove EMPTY_STR macro 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 12 Feb 2019 16:41:37 +0000 (UTC) Another misleadingly named macro. Deprecate in favor of NULLSTR_STAR. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Andrea Bolognani --- src/util/virlease.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/util/virlease.c b/src/util/virlease.c index 7c6c37ec9d..93ca72e3af 100644 --- a/src/util/virlease.c +++ b/src/util/virlease.c @@ -42,13 +42,6 @@ #define VIR_NETWORK_DHCP_LEASE_FILE_SIZE_MAX (32 * 1024 * 1024) =20 =20 -/* - * Use this when passing possibly-NULL strings to printf-a-likes. - * Required for unknown parameters during init call. - */ -#define EMPTY_STR(s) ((s) ? (s) : "*") - - int virLeaseReadCustomLeaseFile(virJSONValuePtr leases_array_new, const char *custom_lease_file, @@ -176,8 +169,8 @@ virLeasePrintLeases(virJSONValuePtr leases_array_new, expirytime, virJSONValueObjectGetString(lease_tmp, "mac-address"), virJSONValueObjectGetString(lease_tmp, "ip-address"), - EMPTY_STR(virJSONValueObjectGetString(lease_tmp, "hostn= ame")), - EMPTY_STR(virJSONValueObjectGetString(lease_tmp, "clien= t-id"))); + NULLSTR_STAR(virJSONValueObjectGetString(lease_tmp, "ho= stname")), + NULLSTR_STAR(virJSONValueObjectGetString(lease_tmp, "cl= ient-id"))); } } =20 @@ -200,8 +193,8 @@ virLeasePrintLeases(virJSONValuePtr leases_array_new, expirytime, virJSONValueObjectGetString(lease_tmp, "iaid"), virJSONValueObjectGetString(lease_tmp, "ip-address"= ), - EMPTY_STR(virJSONValueObjectGetString(lease_tmp, "h= ostname")), - EMPTY_STR(virJSONValueObjectGetString(lease_tmp, "c= lient-id"))); + NULLSTR_STAR(virJSONValueObjectGetString(lease_tmp,= "hostname")), + NULLSTR_STAR(virJSONValueObjectGetString(lease_tmp,= "client-id"))); } } } --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 00:12:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 154998970730521.202848065194416; Tue, 12 Feb 2019 08:41:47 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2060F420B4; Tue, 12 Feb 2019 16:41:41 +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 A657A5C21F; Tue, 12 Feb 2019 16:41:40 +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 5291D3F605; Tue, 12 Feb 2019 16:41:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x1CGeVLr004110 for ; Tue, 12 Feb 2019 11:40:31 -0500 Received: by smtp.corp.redhat.com (Postfix) id E25326019F; Tue, 12 Feb 2019 16:40:31 +0000 (UTC) Received: from lpt.brq.redhat.com (unknown [10.43.2.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6835E600C9 for ; Tue, 12 Feb 2019 16:40:31 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 12 Feb 2019 17:40:39 +0100 Message-Id: <0cbf5a0ffef0c5ce2002a7318ef52860ad723e28.1549989584.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 5/6] Use NULLSTR_EMPTY 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 12 Feb 2019 16:41:43 +0000 (UTC) Instead of repetitive: s ? s : "" use NULLSTR_EMPTY. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Andrea Bolognani --- src/datatypes.c | 2 +- src/libvirt-admin.c | 2 +- src/libvirt.c | 2 +- src/lxc/lxc_controller.c | 2 +- src/qemu/qemu_command.c | 8 +++----- src/qemu/qemu_interface.c | 2 +- src/qemu/qemu_migration_params.c | 2 +- src/qemu/qemu_monitor_json.c | 2 +- src/qemu/qemu_process.c | 4 ++-- src/util/vircgroupv1.c | 2 +- src/util/vircgroupv2.c | 2 +- src/util/virnetdevvportprofile.c | 4 ++-- src/util/virnuma.c | 4 ++-- src/util/virstoragefile.c | 2 +- src/util/virsystemd.c | 4 ++-- src/util/viruri.c | 2 +- src/xenconfig/xen_sxpr.c | 18 ++++++------------ tools/virsh-domain-monitor.c | 2 +- tools/virsh-domain.c | 2 +- tools/virt-admin.c | 4 ++-- 20 files changed, 32 insertions(+), 40 deletions(-) diff --git a/src/datatypes.c b/src/datatypes.c index be9b5286aa..9b92d892d5 100644 --- a/src/datatypes.c +++ b/src/datatypes.c @@ -686,7 +686,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, usageID ? usageID : "") < 0) + if (VIR_STRDUP(ret->usageID, NULLSTR_EMPTY(usageID)) < 0) goto error; =20 ret->conn =3D virObjectRef(conn); diff --git a/src/libvirt-admin.c b/src/libvirt-admin.c index fb0190042a..74dedf64d8 100644 --- a/src/libvirt-admin.c +++ b/src/libvirt-admin.c @@ -152,7 +152,7 @@ getSocketPath(virURIPtr uri) } else { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Invalid URI path '%s', try '/system'"), - uri->path ? uri->path : ""); + NULLSTR_EMPTY(uri->path)); goto error; } } diff --git a/src/libvirt.c b/src/libvirt.c index cc1c3c6ea1..854d70a2bf 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -898,7 +898,7 @@ virConnectOpenInternal(const char *name, goto failed; VIR_DEBUG("%s driver URI probe returned '%s'", virConnectDriverTab[i]->hypervisorDriver->na= me, - uristr ? uristr : ""); + NULLSTR_EMPTY(uristr)); } } } diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index 9c6ea97f1e..cd842f2980 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -2160,7 +2160,7 @@ virLXCControllerSetupDevPTS(virLXCControllerPtr ctrl) /* XXX should we support gid=3DX for X!=3D5 for distros which use * a different gid for tty? */ if (virAsprintf(&opts, "newinstance,ptmxmode=3D0666,mode=3D0620,gid=3D= %u%s", - ptsgid, (mount_options ? mount_options : "")) < 0) + ptsgid, NULLSTR_EMPTY(mount_options)) < 0) goto cleanup; =20 VIR_DEBUG("Mount devpts on %s type=3Dtmpfs flags=3D0x%x, opts=3D%s", diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 572d3bc20f..13f193a31d 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3964,8 +3964,7 @@ qemuBuildHostNetStr(virDomainNetDefPtr net, =20 case VIR_DOMAIN_NET_TYPE_SERVER: virBufferAsprintf(&buf, "socket,listen=3D%s:%d,", - net->data.socket.address ? net->data.socket.addr= ess - : "", + NULLSTR_EMPTY(net->data.socket.address), net->data.socket.port); break; =20 @@ -7231,7 +7230,7 @@ qemuBuildCpuCommandLine(virCommandPtr cmd, =20 if (cpu) { virCommandAddArg(cmd, "-cpu"); - virCommandAddArgFormat(cmd, "%s%s", cpu, cpu_flags ? cpu_flags : "= "); + virCommandAddArgFormat(cmd, "%s%s", cpu, NULLSTR_EMPTY(cpu_flags)); } =20 ret =3D 0; @@ -10729,8 +10728,7 @@ qemuBuildCommandLine(virQEMUDriverPtr driver, virCommandAddArg(cmd, qemucmd->args[i]); for (i =3D 0; i < qemucmd->num_env; i++) virCommandAddEnvPair(cmd, qemucmd->env_name[i], - qemucmd->env_value[i] - ? qemucmd->env_value[i] : ""); + NULLSTR_EMPTY(qemucmd->env_value[i])); } =20 if (qemuBuildSeccompSandboxCommandLine(cmd, cfg, qemuCaps) < 0) diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c index 2816db908a..c8effa68f4 100644 --- a/src/qemu/qemu_interface.c +++ b/src/qemu/qemu_interface.c @@ -371,7 +371,7 @@ qemuCreateInBridgePortWithHelper(virQEMUDriverConfigPtr= cfg, virReportError(VIR_ERR_INTERNAL_ERROR, _("%s: failed to communicate with bridge helper: %s%s"), cmdstr, virStrerror(errno, ebuf, sizeof(ebuf)), - errstr ? errstr : ""); + NULLSTR_EMPTY(errstr)); VIR_FREE(errstr); goto cleanup; } diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_par= ams.c index 28f2c75ea1..24e5368783 100644 --- a/src/qemu/qemu_migration_params.c +++ b/src/qemu/qemu_migration_params.c @@ -930,7 +930,7 @@ qemuMigrationParamsEnableTLS(virQEMUDriverPtr driver, *tlsAlias) < 0 || qemuMigrationParamsSetString(migParams, QEMU_MIGRATION_PARAM_TLS_HOSTNAME, - hostname ? hostname : "") < 0) + NULLSTR_EMPTY(hostname)) < 0) goto error; =20 ret =3D 0; diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 8bafa93c8d..cf474eb6c8 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -1422,7 +1422,7 @@ qemuMonitorJSONHumanCommandWithFd(qemuMonitorPtr mon, const char *data; =20 data =3D virJSONValueGetString(obj); - if (VIR_STRDUP(*reply_str, data ? data : "") < 0) + if (VIR_STRDUP(*reply_str, NULLSTR_EMPTY(data)) < 0) goto cleanup; } =20 diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 7536c1cbb0..a62d89320b 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4421,9 +4421,9 @@ qemuLogOperation(virDomainObjPtr vm, (qemuVersion / 1000000) % 1000, (qemuVersion / 1000) % 1000, qemuVersion % 1000, - package ? package : "", + NULLSTR_EMPTY(package), uts.release, - hostname ? hostname : "") < 0) + NULLSTR_EMPTY(hostname)) < 0) goto cleanup; =20 if (cmd) { diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c index 14b3b6a45d..c172eb8b96 100644 --- a/src/util/vircgroupv1.c +++ b/src/util/vircgroupv1.c @@ -532,7 +532,7 @@ virCgroupV1PathOfController(virCgroupPtr group, if (virAsprintf(path, "%s%s/%s", group->legacy[controller].mountPoint, group->legacy[controller].placement, - key ? key : "") < 0) + NULLSTR_EMPTY(key)) < 0) return -1; =20 return 0; diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c index 655abfe42e..e0fa8e1cc0 100644 --- a/src/util/vircgroupv2.c +++ b/src/util/vircgroupv2.c @@ -338,7 +338,7 @@ virCgroupV2PathOfController(virCgroupPtr group, if (virAsprintf(path, "%s%s/%s", group->unified.mountPoint, group->unified.placement, - key ? key : "") < 0) + NULLSTR_EMPTY(key)) < 0) return -1; =20 return 0; diff --git a/src/util/virnetdevvportprofile.c b/src/util/virnetdevvportprof= ile.c index 574887e9e0..fb05190c02 100644 --- a/src/util/virnetdevvportprofile.c +++ b/src/util/virnetdevvportprofile.c @@ -1239,7 +1239,7 @@ virNetDevVPortProfileAssociate(const char *macvtap_if= name, =20 VIR_DEBUG("profile:'%p' vmOp: %s device: %s@%s mac: %s uuid: %s", virtPort, virNetDevVPortProfileOpTypeToString(vmOp), - (macvtap_ifname ? macvtap_ifname : ""), linkdev, + NULLSTR_EMPTY(macvtap_ifname), linkdev, (macvtap_macaddr ? virMacAddrFormat(macvtap_macaddr, macStr) : "(unspecified)"), @@ -1305,7 +1305,7 @@ virNetDevVPortProfileDisassociate(const char *macvtap= _ifname, =20 VIR_DEBUG("profile:'%p' vmOp: %s device: %s@%s mac: %s", virtPort, virNetDevVPortProfileOpTypeToString(vmOp), - (macvtap_ifname ? macvtap_ifname : ""), linkdev, + NULLSTR_EMPTY(macvtap_ifname), linkdev, (macvtap_macaddr ? virMacAddrFormat(macvtap_macaddr, macStr) : "(unspecified)")); diff --git a/src/util/virnuma.c b/src/util/virnuma.c index 67e6c86417..dd3fb7519e 100644 --- a/src/util/virnuma.c +++ b/src/util/virnuma.c @@ -487,13 +487,13 @@ virNumaGetHugePageInfoPath(char **path, /* We are aiming at overall system info */ ret =3D virAsprintf(path, HUGEPAGES_SYSTEM_PREFIX HUGEPAGES_PREFIX "%ukB/%= s", - page_size, suffix ? suffix : ""); + page_size, NULLSTR_EMPTY(suffix)); } else { /* We are aiming on specific NUMA node */ ret =3D virAsprintf(path, HUGEPAGES_NUMA_PREFIX "node%d/hugepages/" HUGEPAGES_PREFIX "%ukB/%s", - node, page_size, suffix ? suffix : ""); + node, page_size, NULLSTR_EMPTY(suffix)); } =20 if (ret >=3D 0 && !virFileExists(*path)) { diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index 8319ba9c8c..90dbbfdd15 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -4181,7 +4181,7 @@ virStorageFileRemoveLastPathComponent(const char *pat= h) { char *ret; =20 - if (VIR_STRDUP(ret, path ? path : "") < 0) + if (VIR_STRDUP(ret, NULLSTR_EMPTY(path)) < 0) return NULL; =20 virFileRemoveLastComponent(ret); diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c index f492ac1859..b868f88a59 100644 --- a/src/util/virsystemd.c +++ b/src/util/virsystemd.c @@ -339,7 +339,7 @@ int virSystemdCreateMachine(const char *name, creatorname, iscontainer ? "container" : "vm", (unsigned int)pidleader, - rootdir ? rootdir : "", + NULLSTR_EMPTY(rootdir), nnicindexes, nicindexes, 3, "Slice", "s", slicename, @@ -381,7 +381,7 @@ int virSystemdCreateMachine(const char *name, creatorname, iscontainer ? "container" : "vm", (unsigned int)pidleader, - rootdir ? rootdir : "", + NULLSTR_EMPTY(rootdir), 3, "Slice", "s", slicename, "After", "as", 1, "libvirtd.service", diff --git a/src/util/viruri.c b/src/util/viruri.c index c8811f64c6..8e45a447b9 100644 --- a/src/util/viruri.c +++ b/src/util/viruri.c @@ -117,7 +117,7 @@ virURIParseParams(virURIPtr uri) } =20 /* Append to the parameter set. */ - if (virURIParamAppend(uri, name, value ? value : "") < 0) { + if (virURIParamAppend(uri, name, NULLSTR_EMPTY(value)) < 0) { VIR_FREE(name); VIR_FREE(value); return -1; diff --git a/src/xenconfig/xen_sxpr.c b/src/xenconfig/xen_sxpr.c index 11af3e747a..eb535cde19 100644 --- a/src/xenconfig/xen_sxpr.c +++ b/src/xenconfig/xen_sxpr.c @@ -1652,24 +1652,18 @@ xenFormatSxprChr(virDomainChrDefPtr def, (def->source->data.tcp.protocol =3D=3D VIR_DOMAIN_CHR_TCP_PROTOCOL_RAW ? "tcp" : "telnet"), - (def->source->data.tcp.host ? - def->source->data.tcp.host : ""), - (def->source->data.tcp.service ? - def->source->data.tcp.service : ""), + NULLSTR_EMPTY(def->source->data.tcp.host), + NULLSTR_EMPTY(def->source->data.tcp.service), (def->source->data.tcp.listen ? ",server,nowait" : "")); break; =20 case VIR_DOMAIN_CHR_TYPE_UDP: virBufferAsprintf(buf, "%s:%s:%s@%s:%s", type, - (def->source->data.udp.connectHost ? - def->source->data.udp.connectHost : ""), - (def->source->data.udp.connectService ? - def->source->data.udp.connectService : ""), - (def->source->data.udp.bindHost ? - def->source->data.udp.bindHost : ""), - (def->source->data.udp.bindService ? - def->source->data.udp.bindService : "")); + NULLSTR_EMPTY(def->source->data.udp.connectHost), + NULLSTR_EMPTY(def->source->data.udp.connectServi= ce), + NULLSTR_EMPTY(def->source->data.udp.bindHost), + NULLSTR_EMPTY(def->source->data.udp.bindService)= ); break; =20 case VIR_DOMAIN_CHR_TYPE_UNIX: diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index 49de81af8c..ad739a9df5 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -2389,7 +2389,7 @@ cmdDomIfAddr(vshControl *ctl, const vshCmd *cmd) if (full || !j) vshPrint(ctl, " %-10s %-17s %s\n", iface->name, - iface->hwaddr ? iface->hwaddr : "", ip_addr_str); + NULLSTR_EMPTY(iface->hwaddr), ip_addr_str); else vshPrint(ctl, " %-10s %-17s %s\n", "-", "-", ip_addr_str); diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 0ea65e8994..07639ab8e3 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -5524,7 +5524,7 @@ virshGenFileName(vshControl *ctl, virDomainPtr dom, c= onst char *mime) strftime(timestr, sizeof(timestr), "%Y-%m-%d-%H:%M:%S", &time_info); =20 if (virAsprintf(&ret, "%s-%s%s", virDomainGetName(dom), - timestr, ext ? ext : "") < 0) { + timestr, NULLSTR_EMPTY(ext)) < 0) { vshError(ctl, "%s", _("Out of memory")); return NULL; } diff --git a/tools/virt-admin.c b/tools/virt-admin.c index e613ad86f9..048c805f0a 100644 --- a/tools/virt-admin.c +++ b/tools/virt-admin.c @@ -1047,7 +1047,7 @@ cmdDaemonLogFilters(vshControl *ctl, const vshCmd *cm= d) } =20 vshPrintExtra(ctl, " %-15s", _("Logging filters: ")); - vshPrint(ctl, "%s\n", filters ? filters : ""); + vshPrint(ctl, "%s\n", NULLSTR_EMPTY(filters)); } =20 return true; @@ -1101,7 +1101,7 @@ cmdDaemonLogOutputs(vshControl *ctl, const vshCmd *cm= d) } =20 vshPrintExtra(ctl, " %-15s", _("Logging outputs: ")); - vshPrint(ctl, "%s\n", outputs ? outputs : ""); + vshPrint(ctl, "%s\n", NULLSTR_EMPTY(outputs)); } =20 return true; --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 00:12:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1549989748710111.76957361168718; Tue, 12 Feb 2019 08:42:28 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A47AEAC61E; Tue, 12 Feb 2019 16:42:25 +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 3DA1D5C6A6; Tue, 12 Feb 2019 16:42:25 +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 264C83F608; Tue, 12 Feb 2019 16:42:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x1CGeW6Z004123 for ; Tue, 12 Feb 2019 11:40:32 -0500 Received: by smtp.corp.redhat.com (Postfix) id B8CC1D1CD; Tue, 12 Feb 2019 16:40:32 +0000 (UTC) Received: from lpt.brq.redhat.com (unknown [10.43.2.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3FFEC600C9 for ; Tue, 12 Feb 2019 16:40:32 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 12 Feb 2019 17:40:40 +0100 Message-Id: <1de240eace30315f944de8525185b5f18a5cbb5f.1549989584.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 6/6] Use NULLSTR_EMPTY even more 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 12 Feb 2019 16:42:27 +0000 (UTC) This time even in places that would possibly better be served by a more complex macro. Can be squashed into the previous patch if requested. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Andrea Bolognani --- src/interface/interface_backend_netcf.c | 42 ++++++++++++------------- src/nwfilter/nwfilter_dhcpsnoop.c | 2 +- src/qemu/qemu_command.c | 4 +-- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/interface/interface_backend_netcf.c b/src/interface/interf= ace_backend_netcf.c index 27cc488f4b..cf8eb9488d 100644 --- a/src/interface/interface_backend_netcf.c +++ b/src/interface/interface_backend_netcf.c @@ -290,7 +290,7 @@ static struct netcf_if *interfaceDriverGetNetcfIF(struc= t netcf *ncf, virInterfac virReportError(netcf_to_vir_err(errcode), _("couldn't find interface named '%s': %s%s%s"), ifinfo->name, errmsg, details ? " - " : "", - details ? details : ""); + NULLSTR_EMPTY(details)); } else { virReportError(VIR_ERR_NO_INTERFACE, _("couldn't find interface named '%s'"), @@ -314,7 +314,7 @@ netcfInterfaceObjIsActive(struct netcf_if *iface, virReportError(netcf_to_vir_err(errcode), _("failed to get status of interface %s: %s%s%s"), ncf_if_name(iface), errmsg, details ? " - " : "", - details ? details : ""); + NULLSTR_EMPTY(details)); goto cleanup; } =20 @@ -346,7 +346,7 @@ static int netcfConnectNumOfInterfacesImpl(virConnectPt= r conn, virReportError(netcf_to_vir_err(errcode), _("failed to get number of host interfaces: %s%s%s"= ), errmsg, details ? " - " : "", - details ? details : ""); + NULLSTR_EMPTY(details)); goto cleanup; } =20 @@ -364,7 +364,7 @@ static int netcfConnectNumOfInterfacesImpl(virConnectPt= r conn, virReportError(netcf_to_vir_err(errcode), _("failed to list host interfaces: %s%s%s"), errmsg, details ? " - " : "", - details ? details : ""); + NULLSTR_EMPTY(details)); goto cleanup; } =20 @@ -380,7 +380,7 @@ static int netcfConnectNumOfInterfacesImpl(virConnectPt= r conn, virReportError(netcf_to_vir_err(errcode), _("couldn't find interface named '%s': %s%s= %s"), names[i], errmsg, - details ? " - " : "", details ? details : "= "); + details ? " - " : "", NULLSTR_EMPTY(details= )); goto cleanup; } else { /* Ignore the NETCF_NOERROR, as the interface is very like= ly @@ -436,7 +436,7 @@ static int netcfConnectListInterfacesImpl(virConnectPtr= conn, virReportError(netcf_to_vir_err(errcode), _("failed to get number of host interfaces: %s%s%s"= ), errmsg, details ? " - " : "", - details ? details : ""); + NULLSTR_EMPTY(details)); goto cleanup; } =20 @@ -454,7 +454,7 @@ static int netcfConnectListInterfacesImpl(virConnectPtr= conn, virReportError(netcf_to_vir_err(errcode), _("failed to list host interfaces: %s%s%s"), errmsg, details ? " - " : "", - details ? details : ""); + NULLSTR_EMPTY(details)); goto cleanup; } =20 @@ -475,7 +475,7 @@ static int netcfConnectListInterfacesImpl(virConnectPtr= conn, virReportError(netcf_to_vir_err(errcode), _("couldn't find interface named '%s': %s%s= %s"), allnames[i], errmsg, - details ? " - " : "", details ? details : "= "); + details ? " - " : "", NULLSTR_EMPTY(details= )); goto cleanup; } else { /* Ignore the NETCF_NOERROR, as the interface is very like= ly @@ -622,7 +622,7 @@ netcfConnectListAllInterfaces(virConnectPtr conn, virReportError(netcf_to_vir_err(errcode), _("failed to get number of host interfaces: %s%s%s"= ), errmsg, details ? " - " : "", - details ? details : ""); + NULLSTR_EMPTY(details)); goto cleanup; } =20 @@ -642,7 +642,7 @@ netcfConnectListAllInterfaces(virConnectPtr conn, virReportError(netcf_to_vir_err(errcode), _("failed to list host interfaces: %s%s%s"), errmsg, details ? " - " : "", - details ? details : ""); + NULLSTR_EMPTY(details)); goto cleanup; } =20 @@ -660,7 +660,7 @@ netcfConnectListAllInterfaces(virConnectPtr conn, virReportError(netcf_to_vir_err(errcode), _("couldn't find interface named '%s': %s%s= %s"), names[i], errmsg, - details ? " - " : "", details ? details : "= "); + details ? " - " : "", NULLSTR_EMPTY(details= )); goto cleanup; } else { /* Ignore the NETCF_NOERROR, as the interface is very like= ly @@ -740,7 +740,7 @@ static virInterfacePtr netcfInterfaceLookupByName(virCo= nnectPtr conn, virReportError(netcf_to_vir_err(errcode), _("couldn't find interface named '%s': %s%s%s"), name, errmsg, - details ? " - " : "", details ? details : ""); + details ? " - " : "", NULLSTR_EMPTY(details)); } else { virReportError(VIR_ERR_NO_INTERFACE, _("couldn't find interface named '%s'"), name); @@ -780,7 +780,7 @@ static virInterfacePtr netcfInterfaceLookupByMACString(= virConnectPtr conn, virReportError(netcf_to_vir_err(errcode), _("couldn't find interface with MAC address '%s': %= s%s%s"), macstr, errmsg, details ? " - " : "", - details ? details : ""); + NULLSTR_EMPTY(details)); goto cleanup; } if (niface =3D=3D 0) { @@ -844,7 +844,7 @@ static char *netcfInterfaceGetXMLDesc(virInterfacePtr i= finfo, virReportError(netcf_to_vir_err(errcode), _("could not get interface XML description: %s%s%s"= ), errmsg, details ? " - " : "", - details ? details : ""); + NULLSTR_EMPTY(details)); goto cleanup; } =20 @@ -906,7 +906,7 @@ static virInterfacePtr netcfInterfaceDefineXML(virConne= ctPtr conn, virReportError(netcf_to_vir_err(errcode), _("could not get interface XML description: %s%s%s"= ), errmsg, details ? " - " : "", - details ? details : ""); + NULLSTR_EMPTY(details)); goto cleanup; } =20 @@ -948,7 +948,7 @@ static int netcfInterfaceUndefine(virInterfacePtr ifinf= o) virReportError(netcf_to_vir_err(errcode), _("failed to undefine interface %s: %s%s%s"), ifinfo->name, errmsg, details ? " - " : "", - details ? details : ""); + NULLSTR_EMPTY(details)); goto cleanup; } =20 @@ -1000,7 +1000,7 @@ static int netcfInterfaceCreate(virInterfacePtr ifinf= o, virReportError(netcf_to_vir_err(errcode), _("failed to create (start) interface %s: %s%s%s"), ifinfo->name, errmsg, details ? " - " : "", - details ? details : ""); + NULLSTR_EMPTY(details)); goto cleanup; } =20 @@ -1052,7 +1052,7 @@ static int netcfInterfaceDestroy(virInterfacePtr ifin= fo, virReportError(netcf_to_vir_err(errcode), _("failed to destroy (stop) interface %s: %s%s%s"), ifinfo->name, errmsg, details ? " - " : "", - details ? details : ""); + NULLSTR_EMPTY(details)); goto cleanup; } =20 @@ -1115,7 +1115,7 @@ static int netcfInterfaceChangeBegin(virConnectPtr co= nn, unsigned int flags) virReportError(netcf_to_vir_err(errcode), _("failed to begin transaction: %s%s%s"), errmsg, details ? " - " : "", - details ? details : ""); + NULLSTR_EMPTY(details)); } =20 virObjectUnlock(driver); @@ -1140,7 +1140,7 @@ static int netcfInterfaceChangeCommit(virConnectPtr c= onn, unsigned int flags) virReportError(netcf_to_vir_err(errcode), _("failed to commit transaction: %s%s%s"), errmsg, details ? " - " : "", - details ? details : ""); + NULLSTR_EMPTY(details)); } =20 virObjectUnlock(driver); @@ -1165,7 +1165,7 @@ static int netcfInterfaceChangeRollback(virConnectPtr= conn, unsigned int flags) virReportError(netcf_to_vir_err(errcode), _("failed to rollback transaction: %s%s%s"), errmsg, details ? " - " : "", - details ? details : ""); + NULLSTR_EMPTY(details)); } =20 virObjectUnlock(driver); diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcp= snoop.c index 58f0057c3f..d8a1e7f8a8 100644 --- a/src/nwfilter/nwfilter_dhcpsnoop.c +++ b/src/nwfilter/nwfilter_dhcpsnoop.c @@ -579,7 +579,7 @@ virNWFilterSnoopReqNew(const char *ifkey) virReportError(VIR_ERR_INTERNAL_ERROR, _("virNWFilterSnoopReqNew called with invalid " "key \"%s\" (%zu)"), - ifkey ? ifkey : "", + NULLSTR_EMPTY(ifkey), ifkey ? strlen(ifkey) : 0); return NULL; } diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 13f193a31d..64d28b8751 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3726,9 +3726,9 @@ qemuBuildLegacyNicStr(virDomainNetDefPtr net) virMacAddrFormat(&net->mac, macaddr), net->info.alias, (net->model ? ",model=3D" : ""), - (net->model ? net->model : ""), + NULLSTR_EMPTY(net->model), (net->info.alias ? ",id=3D" : ""), - (net->info.alias ? net->info.alias : ""))); + NULLSTR_EMPTY(net->info.alias))); return str; } =20 --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list