From nobody Thu May 2 18:38:09 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 ARC-Seal: i=1; a=rsa-sha256; t=1571438305; cv=none; d=zoho.com; s=zohoarc; b=DU9bH2k4d8KNkW/IWEF5WEa2X1H8C6m+oDYw0QMJ0Sh+mwM4RzVMMriLyViVHuQxg6KKROINpt5I1SOzVjg/X7N4169CTdpTXAPZk3b+06GLVngpg6ZFsci8FZ1uf8p257d5yxkD2m82cHyxncV9xKXSYowQfcC668Zd7FFujuw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571438305; 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=0xP8gU5umvcdVqBj+WSq+ZNKR19qJVCtdzrUbUKHDWs=; b=igJqPdmvY5oIdjVArcyaWT94ISzXIbmtjKnFTntHr19aQpFTa007TLllA7HfhxEkYJS0Ldw6GJC0ZAG2zu1D7k6pEvN6wzTtAd6B/NPgf/oyBUHphKSER9jGMNh7KZdgtQ7EH0QZBqxCjrgzv7a7h3CeLyCEwycilN2XPnuIKAU= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1571438305622336.5984193192005; Fri, 18 Oct 2019 15:38:25 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 247987BDB2; Fri, 18 Oct 2019 22:38:24 +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 EEBA860E1C; Fri, 18 Oct 2019 22:38:23 +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 AF3B84EEBF; Fri, 18 Oct 2019 22:38:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9IMb8JN025250 for ; Fri, 18 Oct 2019 18:37:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id E45EE5D71C; Fri, 18 Oct 2019 22:37:08 +0000 (UTC) Received: from lpt.redhat.com (ovpn-200-21.brq.redhat.com [10.40.200.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id 11F9A5D713 for ; Fri, 18 Oct 2019 22:37:07 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Sat, 19 Oct 2019 00:37:45 +0200 Message-Id: <6c0202941061f7887b592dca72ab338b200d079c.1571438247.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 01/10] tools: cmdDomblkinfoGet: reindent parameters 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 18 Oct 2019 22:38:24 +0000 (UTC) Signed-off-by: J=C3=A1n Tomko Reviewed-by: Daniel Henrique Barboza --- tools/virsh-domain-monitor.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index b2bb85cd96..cd675df07d 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -421,11 +421,11 @@ static const vshCmdOptDef opts_domblkinfo[] =3D { =20 static bool cmdDomblkinfoGet(vshControl *ctl, - const virDomainBlockInfo *info, - char **cap, - char **alloc, - char **phy, - bool human) + const virDomainBlockInfo *info, + char **cap, + char **alloc, + char **phy, + bool human) { if (info->capacity =3D=3D 0 && info->allocation =3D=3D 0 && info->phys= ical =3D=3D 0) { *cap =3D vshStrdup(ctl, "-"); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 18:38:09 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 ARC-Seal: i=1; a=rsa-sha256; t=1571438266; cv=none; d=zoho.com; s=zohoarc; b=AH4l6MIDI5/25eGtS2RkfWCDqrAygpiFlZOuJVVvXQTbUYxuDE2E4qwL6xlsOt+aG+A47eHKuW7zrt3Prb6BmO/jJpNAs+XtDKYtSY+zfQS2Uc5UB7b2O/vpqoo8tJbfi03aZgesgN7aRq/Caxp4Ota6Y37DosJCisN7POwLNGY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571438266; 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=3sqlNyufHPdANXH5N+d+AiAckk7QXA2gGlUd3tkkx0o=; b=hbT+jJJX5mlj/OGsFJV/i2P3csNwRwvslJUKSU65wgelvUqNM1ON3XIDC5QMS/NVU2iaxW6RCghcfGk0JH+X8F9fwR5A9v5r6tq6RpUTy1uRENmW0mo6sS7T4Nc1WuSUChbJ61jMSTtGwRQnoWbo8pOMeW+Jwa8WhF5ze3Xd6Ts= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1571438266798700.0607016174107; Fri, 18 Oct 2019 15:37:46 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1AA4A8A1C80; Fri, 18 Oct 2019 22:37:45 +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 E7FE819C7F; Fri, 18 Oct 2019 22:37:44 +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 A7774180B761; Fri, 18 Oct 2019 22:37:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9IMbAGM025261 for ; Fri, 18 Oct 2019 18:37:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id 798235D71C; Fri, 18 Oct 2019 22:37:10 +0000 (UTC) Received: from lpt.redhat.com (ovpn-200-21.brq.redhat.com [10.40.200.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8B52B5D713 for ; Fri, 18 Oct 2019 22:37:09 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Sat, 19 Oct 2019 00:37:46 +0200 Message-Id: <9fdb6beb76e26e7a59397c49fd7c6a25dfa3db35.1571438247.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 02/10] virsh: use g_strdup in cmdDomblkinfoGet 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.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.69]); Fri, 18 Oct 2019 22:37:45 +0000 (UTC) Prefer GLib's g_strdup to vshStrdup. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Daniel Henrique Barboza --- tools/virsh-domain-monitor.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index cd675df07d..739c8df381 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -420,17 +420,16 @@ static const vshCmdOptDef opts_domblkinfo[] =3D { }; =20 static bool -cmdDomblkinfoGet(vshControl *ctl, - const virDomainBlockInfo *info, +cmdDomblkinfoGet(const virDomainBlockInfo *info, char **cap, char **alloc, char **phy, bool human) { if (info->capacity =3D=3D 0 && info->allocation =3D=3D 0 && info->phys= ical =3D=3D 0) { - *cap =3D vshStrdup(ctl, "-"); - *alloc =3D vshStrdup(ctl, "-"); - *phy =3D vshStrdup(ctl, "-"); + *cap =3D g_strdup("-"); + *alloc =3D g_strdup("-"); + *phy =3D g_strdup("-"); } else if (!human) { if (virAsprintf(cap, "%llu", info->capacity) < 0 || virAsprintf(alloc, "%llu", info->allocation) < 0 || @@ -530,7 +529,7 @@ cmdDomblkinfo(vshControl *ctl, const vshCmd *cmd) memset(&info, 0, sizeof(info)); } =20 - if (!cmdDomblkinfoGet(ctl, &info, &cap, &alloc, &phy, human)) + if (!cmdDomblkinfoGet(&info, &cap, &alloc, &phy, human)) goto cleanup; if (vshTableRowAppend(table, target, cap, alloc, phy, NULL) < = 0) goto cleanup; @@ -545,7 +544,7 @@ cmdDomblkinfo(vshControl *ctl, const vshCmd *cmd) if (virDomainGetBlockInfo(dom, device, &info, 0) < 0) goto cleanup; =20 - if (!cmdDomblkinfoGet(ctl, &info, &cap, &alloc, &phy, human)) + if (!cmdDomblkinfoGet(&info, &cap, &alloc, &phy, human)) goto cleanup; vshPrint(ctl, "%-15s %s\n", _("Capacity:"), cap); vshPrint(ctl, "%-15s %s\n", _("Allocation:"), alloc); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 18:38:09 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 ARC-Seal: i=1; a=rsa-sha256; t=1571438308; cv=none; d=zoho.com; s=zohoarc; b=kaAOMCkEUaJH/ez7+AWPCRyeTIpqgXV6AMVXToQPFwB66FXkZHiWyVgqxlkEIuZ+gFaiSh8DLRDl8VG+bL2wpJVilr2NWBJjWrX/RmWsf+cKSm6wwF3Xg6CM2bVgaM8f1EjH6d2kgvR47Q9veEY6CLyN6NxiuBu9vL07Jn76U10= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571438308; 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=oBS85ovhi+QT9ZMem5sz9iCNwtIOx929Mk4DaklhPvI=; b=CIf/q5oTM7VTpx/hmprrXfmRWsDUD8oIomP+cufycbu1/Dn/Vxk6APp8VWLWLT95AW1u3UhWvqAfHtNam014+0klZC5FCsbItSSRCwKqe/3RBvVEAVc9bF5vwP6s4yA9Z0plSFcQmGoTnWCXbOoTGC/QjZNXDR1svYI31ZdAsSw= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1571438308992871.9375220016401; Fri, 18 Oct 2019 15:38:28 -0700 (PDT) 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 6F5E810CC1E0; Fri, 18 Oct 2019 22:38:27 +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 4A1395D9CC; Fri, 18 Oct 2019 22:38:27 +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 0B1A746F4A; Fri, 18 Oct 2019 22:38:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9IMbBBT025268 for ; Fri, 18 Oct 2019 18:37:11 -0400 Received: by smtp.corp.redhat.com (Postfix) id DEA9F5D70E; Fri, 18 Oct 2019 22:37:11 +0000 (UTC) Received: from lpt.redhat.com (ovpn-200-21.brq.redhat.com [10.40.200.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0419C5D713 for ; Fri, 18 Oct 2019 22:37:10 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Sat, 19 Oct 2019 00:37:47 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 03/10] virsh: use g_strdup in virshDomainGetEditMetadata 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.6.2 (mx1.redhat.com [10.5.110.65]); Fri, 18 Oct 2019 22:38:27 +0000 (UTC) Prefer GLib's g_strdup to vshStrdup. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Daniel Henrique Barboza --- tools/virsh-domain.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 3ba8451470..715ad51ef5 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -8523,7 +8523,7 @@ static const vshCmdOptDef opts_metadata[] =3D { =20 /* helper to add new metadata using the --edit option */ static char * -virshDomainGetEditMetadata(vshControl *ctl, +virshDomainGetEditMetadata(vshControl *ctl G_GNUC_UNUSED, virDomainPtr dom, const char *uri, unsigned int flags) @@ -8533,7 +8533,7 @@ virshDomainGetEditMetadata(vshControl *ctl, if (!(ret =3D virDomainGetMetadata(dom, VIR_DOMAIN_METADATA_ELEMENT, uri, flags))) { vshResetLibvirtError(); - ret =3D vshStrdup(ctl, "\n"); + ret =3D g_strdup("\n"); } =20 return ret; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 18:38:09 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 ARC-Seal: i=1; a=rsa-sha256; t=1571438270; cv=none; d=zoho.com; s=zohoarc; b=BnA11iDECS0ERQrQmt3b6TXsVV//KrKQ4v9er1Bj+DH0iIdV/Foi3rsjl1ysZFpvCqgY+Gx5Nppwia7sYdpqeWZ/k1EkiAKcTk9+dWQ4Zmee7xJptLFaZuYWa3ncAeNhQdjD/27x3CUjCcRCUYD6cZkBpVqGYK2OEU5YLICGxfg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571438270; 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=lDSXwtbyiC5TAJALTQ8MG1VavNaTEBQaTRBDsLZypxM=; b=HXu8xS4d+P7MceulCG+1Q4MgzUYqvDCGhtFibr6mSbyTp/blqy3RaZmPt6WGyCF3Jg/1ceZf/Zk5cRLqGyjPz5NO+IRZXhq7YjD2Pq25JouGrDLlJRoubHGQgv36tt18dgihsFKUcdTyX0p6ZBoOM2Zs3fvRANAgJT+gMxZBA6s= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1571438270399633.934831180356; Fri, 18 Oct 2019 15:37:50 -0700 (PDT) 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 7C07751EFD; Fri, 18 Oct 2019 22:37:48 +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 52F865D70E; Fri, 18 Oct 2019 22:37:48 +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 16F774EE6F; Fri, 18 Oct 2019 22:37:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9IMbDDE025282 for ; Fri, 18 Oct 2019 18:37:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6C8475D713; Fri, 18 Oct 2019 22:37:13 +0000 (UTC) Received: from lpt.redhat.com (ovpn-200-21.brq.redhat.com [10.40.200.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8483E5D70E for ; Fri, 18 Oct 2019 22:37:12 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Sat, 19 Oct 2019 00:37:48 +0200 Message-Id: <01cfe9d9e8675107dcff86babeae82b6e30b46a2.1571438247.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 04/10] virsh: getSignalNumber: rename variables 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.30]); Fri, 18 Oct 2019 22:37:49 +0000 (UTC) Use 'str' for the allocated copy of the string and 'p' for the pointer into that string. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Daniel Henrique Barboza --- tools/virsh-domain.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 715ad51ef5..d74a671167 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -8806,26 +8806,26 @@ static int getSignalNumber(vshControl *ctl, const c= har *signame) { size_t i; int signum; - char *lower =3D vshStrdup(ctl, signame); - char *tmp =3D lower; + char *str =3D vshStrdup(ctl, signame); + char *p =3D str; =20 for (i =3D 0; signame[i]; i++) - lower[i] =3D c_tolower(signame[i]); + p[i] =3D c_tolower(signame[i]); =20 - if (virStrToLong_i(lower, NULL, 10, &signum) >=3D 0) + if (virStrToLong_i(p, NULL, 10, &signum) >=3D 0) goto cleanup; =20 - if (STRPREFIX(lower, "sig_")) - lower +=3D 4; - else if (STRPREFIX(lower, "sig")) - lower +=3D 3; + if (STRPREFIX(p, "sig_")) + p +=3D 4; + else if (STRPREFIX(p, "sig")) + p +=3D 3; =20 - if ((signum =3D virDomainProcessSignalTypeFromString(lower)) >=3D 0) + if ((signum =3D virDomainProcessSignalTypeFromString(p)) >=3D 0) goto cleanup; =20 signum =3D -1; cleanup: - VIR_FREE(tmp); + VIR_FREE(str); return signum; } =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 18:38:09 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 ARC-Seal: i=1; a=rsa-sha256; t=1571438273; cv=none; d=zoho.com; s=zohoarc; b=fafY5qAZWFd5IbVcE7wx213Upf0PMHgNbRCRxyioLh5GCQo+hFOzHmiCmRktl92vEHKqwkoQccvUPOe6A1KfHIpbRffCgDibS3F/tCIXyEaz5kOVLsDXpufgSbRSyVdzWt8VWCE6Rnu5Gb7KxJDSxasCI8/1Cw/21l3ZjHa9eBA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571438273; 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=+sWxrrCxba3qlNGl9M/horhbPJcKB/+4UVVd0PKJqMg=; b=W0Ckas6+88+Vb/CpvBQJzRYlnOVzfk8SzQhrn5qyPr1sUTD870cLEzU3vtW6teRYZMl4jTnC45b7DVMgwe7DbvUpR5nSFG/zxFu5k3hJFoj3KONClYOv1wupZkiYczKvKZpVB6VY4rhCs0azRIIIWxv9ywr/halj/je+46f1n14= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 157143827367020.01818491023664; Fri, 18 Oct 2019 15:37:53 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1A19B81F1B1; Fri, 18 Oct 2019 22:37:52 +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 E61A719C7F; Fri, 18 Oct 2019 22:37:51 +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 A90A6180B536; Fri, 18 Oct 2019 22:37:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9IMbEtM025294 for ; Fri, 18 Oct 2019 18:37:15 -0400 Received: by smtp.corp.redhat.com (Postfix) id EEF165D71C; Fri, 18 Oct 2019 22:37:14 +0000 (UTC) Received: from lpt.redhat.com (ovpn-200-21.brq.redhat.com [10.40.200.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1CED35D70E for ; Fri, 18 Oct 2019 22:37:13 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Sat, 19 Oct 2019 00:37:49 +0200 Message-Id: <28334f05518c6ea7c1263d365ef3b35f4e1d27bd.1571438247.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 05/10] virsh: getSignalNumber: use g_autofree 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.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.69]); Fri, 18 Oct 2019 22:37:52 +0000 (UTC) Mark the 'str' variable as g_autofree and avoid the need for a separate cleanup label. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Daniel Henrique Barboza --- tools/virsh-domain.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index d74a671167..44eb8a5d32 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -8806,27 +8806,21 @@ static int getSignalNumber(vshControl *ctl, const c= har *signame) { size_t i; int signum; - char *str =3D vshStrdup(ctl, signame); + g_autofree char *str =3D vshStrdup(ctl, signame); char *p =3D str; =20 for (i =3D 0; signame[i]; i++) p[i] =3D c_tolower(signame[i]); =20 if (virStrToLong_i(p, NULL, 10, &signum) >=3D 0) - goto cleanup; + return signum; =20 if (STRPREFIX(p, "sig_")) p +=3D 4; else if (STRPREFIX(p, "sig")) p +=3D 3; =20 - if ((signum =3D virDomainProcessSignalTypeFromString(p)) >=3D 0) - goto cleanup; - - signum =3D -1; - cleanup: - VIR_FREE(str); - return signum; + return virDomainProcessSignalTypeFromString(p); } =20 static bool --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 18:38:09 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 ARC-Seal: i=1; a=rsa-sha256; t=1571438312; cv=none; d=zoho.com; s=zohoarc; b=B45pawazqhYaf0N84CEgKdKyUKqE4ZlHzUXBA5v3/L7Yc02Ertr+2U/sfoeyO1caCohNKAW/EpCSqvTZDC1Re6BVm+N3VqiD1YGWxnufZsOweMGF4KiJtDEZj+YoFtY07eWR2sE/8CU6upAixa/0iVDytb5pUjg3KwrG5oXsBFs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571438312; 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=66aBbEe016ynA5XWp4yyBQ3lZhd5FL+AOLyK7c2A2VA=; b=FG/pJ88TSSShizQdQEsgF59vtF6Z5EL/aKj0MfbLH5jkK/wmj7oXTBw92sOvrluXsg/LCxKcN6h9EzVW+CRcC4Ob1XoWSt6fYEifJbSOAloPyicKYeMSrC0+OSV+kX6q9AE2zTKIaAjvq3HPbxHQX61dyir2h5nXemC7MaXaHIU= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1571438312253930.4069857647655; Fri, 18 Oct 2019 15:38:32 -0700 (PDT) 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 A16AE51F00; Fri, 18 Oct 2019 22:38:30 +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 77A58100EBD6; Fri, 18 Oct 2019 22:38:30 +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 292F53FC61; Fri, 18 Oct 2019 22:38:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9IMbGPm025304 for ; Fri, 18 Oct 2019 18:37:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id 32DA95D71C; Fri, 18 Oct 2019 22:37:16 +0000 (UTC) Received: from lpt.redhat.com (ovpn-200-21.brq.redhat.com [10.40.200.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7C4025D70E for ; Fri, 18 Oct 2019 22:37:15 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Sat, 19 Oct 2019 00:37:50 +0200 Message-Id: <6cb1f912751b773500e3534979b8391376fedced.1571438247.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 06/10] virsh: getSignalNumber: use g_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: , 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.30]); Fri, 18 Oct 2019 22:38:31 +0000 (UTC) Eliminate the use of vshStrdup. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Daniel Henrique Barboza --- tools/virsh-domain.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 44eb8a5d32..b1618960b1 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -8802,11 +8802,11 @@ VIR_ENUM_IMPL(virDomainProcessSignal, "rt23", "rt24", "rt25", "rt26", "rt27", /* 55-59 */ "rt28", "rt29", "rt30", "rt31", "rt32"); /* 60-64 */ =20 -static int getSignalNumber(vshControl *ctl, const char *signame) +static int getSignalNumber(const char *signame) { size_t i; int signum; - g_autofree char *str =3D vshStrdup(ctl, signame); + g_autofree char *str =3D g_strdup(signame); char *p =3D str; =20 for (i =3D 0; signame[i]; i++) @@ -8840,7 +8840,7 @@ cmdSendProcessSignal(vshControl *ctl, const vshCmd *c= md) if (vshCommandOptStringReq(ctl, cmd, "signame", &signame) < 0) return false; =20 - if ((signum =3D getSignalNumber(ctl, signame)) < 0) { + if ((signum =3D getSignalNumber(signame)) < 0) { vshError(ctl, _("malformed signal name: %s"), signame); return false; } --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 18:38:09 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 ARC-Seal: i=1; a=rsa-sha256; t=1571438277; cv=none; d=zoho.com; s=zohoarc; b=jHWPtq99OwtEf7USqFyGS+pVC4JmppcqMfBQ9Uv7LDvguYpDP28CjYropP3hGpYmDlaI9K9CgbIk+LZ+2U9Wg4tMc11ktVmwSsRyDYp+b6uaF0/TgmmUj3Kty4T5GOFASfznb7EjcOMcaYMfUrKeQ1nHOnyya4Kwo7xEtNlNLog= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571438277; 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=Rmi3mlFNi7Tfq0IA9946aWFl1PtuJG+s/95SExkJ9Nc=; b=nQlwkhVTcmez+zAalDoSMMHY4bR8uJ7p2lXOV6TG9INaTUXWSLnjnR4SJWDC/8MkhCRQLd68baFw/Ha0u9yN+/sT1azw6hbv+DhfAruXQLRfhZRfUg2au/SBTeq85tN2DymLqldjIQJPqj0bc+PlwsJjfdCZ2ntpln0yQfBpnZA= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1571438277279690.1316394182041; Fri, 18 Oct 2019 15:37:57 -0700 (PDT) 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 8686CC05566F; Fri, 18 Oct 2019 22:37:55 +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 60AEA5C28C; Fri, 18 Oct 2019 22:37:55 +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 1EE4C1803B49; Fri, 18 Oct 2019 22:37:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9IMbHkl025315 for ; Fri, 18 Oct 2019 18:37:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id B3F475D71C; Fri, 18 Oct 2019 22:37:17 +0000 (UTC) Received: from lpt.redhat.com (ovpn-200-21.brq.redhat.com [10.40.200.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id D7D335D70E for ; Fri, 18 Oct 2019 22:37:16 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Sat, 19 Oct 2019 00:37:51 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 07/10] tools: vshCommandArgvGetArg: one parameter per line 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.32]); Fri, 18 Oct 2019 22:37:56 +0000 (UTC) Split the parameters to make changes more readable. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Daniel Henrique Barboza --- tools/vsh.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/vsh.c b/tools/vsh.c index ee675a63cc..fccd4cd36d 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -1644,7 +1644,9 @@ vshCommandParse(vshControl *ctl, vshCommandParser *pa= rser, vshCmd **partial) */ =20 static vshCommandToken ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) -vshCommandArgvGetArg(vshControl *ctl, vshCommandParser *parser, char **res, +vshCommandArgvGetArg(vshControl *ctl, + vshCommandParser *parser, + char **res, bool report G_GNUC_UNUSED) { if (parser->arg_pos =3D=3D parser->arg_end) { --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 18:38:09 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 ARC-Seal: i=1; a=rsa-sha256; t=1571438281; cv=none; d=zoho.com; s=zohoarc; b=N0AKWFBluRZszQiaY5VdScEEPmixHiaXYsltc0CNPoZCxstsdF21GiFUj5BYpz80TldME91SqoyA/qhtOhpO3ergrli+UPsuifH7vTKY61aLsypR3rD4fnC3pToFNutCpNgIsC8LIG3PTZm8dEMTN8b+n+y7dGmp1Jw/B5R7KsA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571438281; 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=ij+78bgo5NQwU4k64xhSJV06eecUx3uiWe+DTEOb+Vo=; b=FTfEN9ntaFyNWAdXi73RYJA1DU/kaDeOAje8KV50IAFKjZ/bLrG1W08rFlaZtwXaUOIa+g2tUWf5g71fnMinCNYdXvTL30VOb2zHd4fIYj3kUSWh6TCWZk+c5Ka1ohzpR7Ow5XkFiNBmwGyvym/fPGSPXuJkLcOoRR3Dh+l6KfQ= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1571438281862796.0146834656065; Fri, 18 Oct 2019 15:38:01 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F1B442BFDC; Fri, 18 Oct 2019 22:37:59 +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 C733460A97; Fri, 18 Oct 2019 22:37:59 +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 8CE034EE71; Fri, 18 Oct 2019 22:37:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9IMbJPX025331 for ; Fri, 18 Oct 2019 18:37:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 439435D71C; Fri, 18 Oct 2019 22:37:19 +0000 (UTC) Received: from lpt.redhat.com (ovpn-200-21.brq.redhat.com [10.40.200.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5BAF55D70E for ; Fri, 18 Oct 2019 22:37:18 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Sat, 19 Oct 2019 00:37:52 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 08/10] tools: vshCommandArgvGetArg: prefer g_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: , 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 18 Oct 2019 22:38:00 +0000 (UTC) Remove the use of vshStrdup. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Daniel Henrique Barboza --- tools/vsh.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/vsh.c b/tools/vsh.c index fccd4cd36d..9ee3f99ff3 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -1644,7 +1644,7 @@ vshCommandParse(vshControl *ctl, vshCommandParser *pa= rser, vshCmd **partial) */ =20 static vshCommandToken ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) -vshCommandArgvGetArg(vshControl *ctl, +vshCommandArgvGetArg(vshControl *ctl G_GNUC_UNUSED, vshCommandParser *parser, char **res, bool report G_GNUC_UNUSED) @@ -1654,7 +1654,7 @@ vshCommandArgvGetArg(vshControl *ctl, return VSH_TK_END; } =20 - *res =3D vshStrdup(ctl, *parser->arg_pos); + *res =3D g_strdup(*parser->arg_pos); parser->arg_pos++; return VSH_TK_ARG; } --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 18:38:09 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 ARC-Seal: i=1; a=rsa-sha256; t=1571438285; cv=none; d=zoho.com; s=zohoarc; b=WDLrZTgKaBz7zojKTPVlRYtlBu996WNRQoLDn41fzDNFTrVUBzdhLn6Ra5B0SADjsBX7zlSxolqRUPnYplu0k06pVjpcgFdvocpPP5ghmqC2/wBwP+iq/f9Do/SSq/ORZGAz3cvxHZeZj2daazuSiY2UfPK8Vdbqhh//5swNiA0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571438285; 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=mDO1NgtSiHOrVV9FePNqSpn8f+xIYHY7oEOmqO/8rlw=; b=WJk+GsE91nxKa7weRftmZUhPlvRwIeRyXb/bdeSpUXGmLmvq1bzENyvzvSmDFSBu+P8bsLtJO/kGHJVET/jh0S/lrLmJexTqFCMv7yU15l/2hlf2HoUDP34Q2Y0eK2LzE2DbWN0OZuEWzKALogLVjPnciqNbvagHtiJU/FlR/L4= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1571438285442396.06945713931316; Fri, 18 Oct 2019 15:38:05 -0700 (PDT) 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 D306F300BC7E; Fri, 18 Oct 2019 22:38:03 +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 A6F305EE1D; Fri, 18 Oct 2019 22:38:03 +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 629A64EE7E; Fri, 18 Oct 2019 22:38:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9IMbLx6025337 for ; Fri, 18 Oct 2019 18:37:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id F31D55D71C; Fri, 18 Oct 2019 22:37:20 +0000 (UTC) Received: from lpt.redhat.com (ovpn-200-21.brq.redhat.com [10.40.200.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id D55E65D70E for ; Fri, 18 Oct 2019 22:37:19 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Sat, 19 Oct 2019 00:37:53 +0200 Message-Id: <366fad0bfa4d3e7c54706315024d962eba730cbd.1571438247.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 09/10] tools: prefer g_strdup to vshStrdup 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.48]); Fri, 18 Oct 2019 22:38:04 +0000 (UTC) Remove all the uses of vshStrdup in favor of GLib's g_strdup. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Daniel Henrique Barboza --- tools/virsh-checkpoint.c | 4 ++-- tools/virsh-domain-monitor.c | 6 +++--- tools/virsh-domain.c | 4 ++-- tools/virsh-nodedev.c | 5 ++--- tools/virsh-pool.c | 30 ++++++++++++++---------------- tools/virsh-snapshot.c | 6 +++--- tools/virsh-volume.c | 11 +++++------ tools/virsh.c | 9 ++++----- tools/virt-admin.c | 6 +++--- tools/vsh.c | 30 +++++++++++++++--------------- 10 files changed, 53 insertions(+), 58 deletions(-) diff --git a/tools/virsh-checkpoint.c b/tools/virsh-checkpoint.c index 08f8fded86..7fd3914ef2 100644 --- a/tools/virsh-checkpoint.c +++ b/tools/virsh-checkpoint.c @@ -127,7 +127,7 @@ cmdCheckpointCreate(vshControl *ctl, if (vshCommandOptStringReq(ctl, cmd, "xmlfile", &from) < 0) goto cleanup; if (!from) { - buffer =3D vshStrdup(ctl, ""); + buffer =3D g_strdup(""); } else { if (virFileReadAll(from, VSH_MAX_XML_FILE, &buffer) < 0) { vshSaveLibvirtError(); @@ -426,7 +426,7 @@ virshGetCheckpointParent(vshControl *ctl, parent =3D virDomainCheckpointGetParent(checkpoint, 0); if (parent) { /* API works, and virDomainCheckpointGetName will succeed */ - *parent_name =3D vshStrdup(ctl, virDomainCheckpointGetName(parent)= ); + *parent_name =3D g_strdup(virDomainCheckpointGetName(parent)); ret =3D 0; } else if (last_error->code =3D=3D VIR_ERR_NO_DOMAIN_CHECKPOINT) { /* API works, and we found a root with no parent */ diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index 739c8df381..bfff08b0f6 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -73,7 +73,7 @@ virshGetDomainDescription(vshControl *ctl, virDomainPtr d= om, bool title, int errCode =3D virGetLastErrorCode(); =20 if (errCode =3D=3D VIR_ERR_NO_DOMAIN_METADATA) { - desc =3D vshStrdup(ctl, ""); + desc =3D g_strdup(""); vshResetLibvirtError(); return desc; } @@ -92,7 +92,7 @@ virshGetDomainDescription(vshControl *ctl, virDomainPtr d= om, bool title, desc =3D virXPathString("string(./description[1])", ctxt); =20 if (!desc) - desc =3D vshStrdup(ctl, ""); + desc =3D g_strdup(""); =20 cleanup: xmlXPathFreeContext(ctxt); @@ -2419,7 +2419,7 @@ cmdDomIfAddr(vshControl *ctl, const vshCmd *cmd) ip_addr_str =3D virBufferContentAndReset(&buf); =20 if (!ip_addr_str) - ip_addr_str =3D vshStrdup(ctl, ""); + ip_addr_str =3D g_strdup(""); =20 /* Don't repeat interface name */ if (full || !j) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index b1618960b1..2f3ac2d430 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -5085,7 +5085,7 @@ cmdSchedInfoUpdate(vshControl *ctl, const vshCmd *cmd, int rv; =20 while ((opt =3D vshCommandOptArgv(ctl, cmd, opt))) { - set_field =3D vshStrdup(ctl, opt->data); + set_field =3D g_strdup(opt->data); if (!(set_val =3D strchr(set_field, '=3D'))) { vshError(ctl, "%s", _("Invalid syntax for --set, " "expecting name=3Dvalue")); @@ -11481,7 +11481,7 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd) VIR_FREE(listen_addr); =20 if (uri) { - listen_addr =3D vshStrdup(ctl, uri->server); + listen_addr =3D g_strdup(uri->server); virURIFree(uri); } } diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index 455ddedc2d..cb2fc26d1a 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -477,13 +477,12 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd= G_GNUC_UNUSED) struct virshNodeList arrays =3D { names, parents }; =20 for (i =3D 0; i < list->ndevices; i++) - names[i] =3D vshStrdup(ctl, virNodeDeviceGetName(list->devices= [i])); + names[i] =3D g_strdup(virNodeDeviceGetName(list->devices[i])); =20 for (i =3D 0; i < list->ndevices; i++) { virNodeDevicePtr dev =3D list->devices[i]; if (STRNEQ(names[i], "computer")) { - const char *parent =3D virNodeDeviceGetParent(dev); - parents[i] =3D parent ? vshStrdup(ctl, parent) : NULL; + parents[i] =3D g_strdup(virNodeDeviceGetParent(dev)); } else { parents[i] =3D NULL; } diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index bb25840943..bd876aefda 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -1247,10 +1247,9 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd G_GNU= C_UNUSED) =20 /* Retrieve the autostart status of the pool */ if (virStoragePoolGetAutostart(list->pools[i], &autostart) < 0) - poolInfoTexts[i].autostart =3D vshStrdup(ctl, _("no autostart"= )); + poolInfoTexts[i].autostart =3D g_strdup(_("no autostart")); else - poolInfoTexts[i].autostart =3D vshStrdup(ctl, autostart ? - _("yes") : _("no")); + poolInfoTexts[i].autostart =3D g_strdup(autostart ? _("yes") := _("no")); =20 /* Retrieve the persistence status of the pool */ if (details) { @@ -1258,28 +1257,27 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd G_GN= UC_UNUSED) vshDebug(ctl, VSH_ERR_DEBUG, "Persistent flag value: %d\n", persistent); if (persistent < 0) - poolInfoTexts[i].persistent =3D vshStrdup(ctl, _("unknown"= )); + poolInfoTexts[i].persistent =3D g_strdup(_("unknown")); else - poolInfoTexts[i].persistent =3D vshStrdup(ctl, persistent ? - _("yes") : _("no"= )); + poolInfoTexts[i].persistent =3D g_strdup(persistent ? _("y= es") : _("no")); } =20 /* Collect further extended information about the pool */ if (virStoragePoolGetInfo(list->pools[i], &info) !=3D 0) { /* Something went wrong retrieving pool info, cope with it */ vshError(ctl, "%s", _("Could not retrieve pool information")); - poolInfoTexts[i].state =3D vshStrdup(ctl, _("unknown")); + poolInfoTexts[i].state =3D g_strdup(_("unknown")); if (details) { - poolInfoTexts[i].capacity =3D vshStrdup(ctl, _("unknown")); - poolInfoTexts[i].allocation =3D vshStrdup(ctl, _("unknown"= )); - poolInfoTexts[i].available =3D vshStrdup(ctl, _("unknown")= ); + poolInfoTexts[i].capacity =3D g_strdup(_("unknown")); + poolInfoTexts[i].allocation =3D g_strdup(_("unknown")); + poolInfoTexts[i].available =3D g_strdup(_("unknown")); } } else { /* Decide which state string to display */ if (details) { const char *state =3D virshStoragePoolStateToString(info.s= tate); =20 - poolInfoTexts[i].state =3D vshStrdup(ctl, state); + poolInfoTexts[i].state =3D g_strdup(state); =20 /* Create the pool size related strings */ if (info.state =3D=3D VIR_STORAGE_POOL_RUNNING || @@ -1303,17 +1301,17 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd G_GN= UC_UNUSED) goto cleanup; } else { /* Capacity related information isn't available */ - poolInfoTexts[i].capacity =3D vshStrdup(ctl, _("-")); - poolInfoTexts[i].allocation =3D vshStrdup(ctl, _("-")); - poolInfoTexts[i].available =3D vshStrdup(ctl, _("-")); + poolInfoTexts[i].capacity =3D g_strdup(_("-")); + poolInfoTexts[i].allocation =3D g_strdup(_("-")); + poolInfoTexts[i].available =3D g_strdup(_("-")); } } else { /* --details option was not specified, only active/inactive * state strings are used */ if (virStoragePoolIsActive(list->pools[i])) - poolInfoTexts[i].state =3D vshStrdup(ctl, _("active")); + poolInfoTexts[i].state =3D g_strdup(_("active")); else - poolInfoTexts[i].state =3D vshStrdup(ctl, _("inactive"= )); + poolInfoTexts[i].state =3D g_strdup(_("inactive")); } } } diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index eae19ecd27..751186ebf8 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -197,7 +197,7 @@ cmdSnapshotCreate(vshControl *ctl, const vshCmd *cmd) if (vshCommandOptStringReq(ctl, cmd, "xmlfile", &from) < 0) goto cleanup; if (!from) { - buffer =3D vshStrdup(ctl, ""); + buffer =3D g_strdup(""); } else { if (virFileReadAll(from, VSH_MAX_XML_FILE, &buffer) < 0) { vshSaveLibvirtError(); @@ -755,7 +755,7 @@ virshGetSnapshotParent(vshControl *ctl, virDomainSnapsh= otPtr snapshot, parent =3D virDomainSnapshotGetParent(snapshot, 0); if (parent) { /* API works, and virDomainSnapshotGetName will succeed */ - *parent_name =3D vshStrdup(ctl, virDomainSnapshotGetName(paren= t)); + *parent_name =3D g_strdup(virDomainSnapshotGetName(parent)); ret =3D 0; goto cleanup; } @@ -1236,7 +1236,7 @@ virshSnapshotListCollect(vshControl *ctl, virDomainPt= r dom, count - 1, flags); if (count >=3D 0) { count++; - names[0] =3D vshStrdup(ctl, fromname); + names[0] =3D g_strdup(fromname); } } else { count =3D virDomainSnapshotListChildrenNames(from, names, diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c index 702d0109ad..d09d4435ad 100644 --- a/tools/virsh-volume.c +++ b/tools/virsh-volume.c @@ -1413,22 +1413,21 @@ cmdVolList(vshControl *ctl, const vshCmd *cmd G_GNU= C_UNUSED) /* Retrieve the volume path */ if ((volInfoTexts[i].path =3D virStorageVolGetPath(vol)) =3D=3D NU= LL) { /* Something went wrong retrieving a volume path, cope with it= */ - volInfoTexts[i].path =3D vshStrdup(ctl, _("unknown")); + volInfoTexts[i].path =3D g_strdup(_("unknown")); } =20 /* If requested, retrieve volume type and sizing information */ if (details) { if (virStorageVolGetInfo(vol, &volumeInfo) !=3D 0) { /* Something went wrong retrieving volume info, cope with = it */ - volInfoTexts[i].allocation =3D vshStrdup(ctl, _("unknown")= ); - volInfoTexts[i].capacity =3D vshStrdup(ctl, _("unknown")); - volInfoTexts[i].type =3D vshStrdup(ctl, _("unknown")); + volInfoTexts[i].allocation =3D g_strdup(_("unknown")); + volInfoTexts[i].capacity =3D g_strdup(_("unknown")); + volInfoTexts[i].type =3D g_strdup(_("unknown")); } else { /* Convert the returned volume info into output strings */ =20 /* Volume type */ - volInfoTexts[i].type =3D vshStrdup(ctl, - virshVolumeTypeToString(v= olumeInfo.type)); + volInfoTexts[i].type =3D g_strdup(virshVolumeTypeToString(= volumeInfo.type)); =20 val =3D vshPrettyCapacity(volumeInfo.capacity, &unit); if (virAsprintf(&volInfoTexts[i].capacity, diff --git a/tools/virsh.c b/tools/virsh.c index a3553ddd36..8c0e9d960d 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -236,7 +236,7 @@ virshReconnect(vshControl *ctl, const char *name, bool = readonly, bool force) } else { if (name) { VIR_FREE(ctl->connname); - ctl->connname =3D vshStrdup(ctl, name); + ctl->connname =3D g_strdup(name); } =20 priv->readonly =3D readonly; @@ -677,7 +677,7 @@ virshParseArgv(vshControl *ctl, int argc, char **argv) switch (arg) { case 'c': VIR_FREE(ctl->connname); - ctl->connname =3D vshStrdup(ctl, optarg); + ctl->connname =3D g_strdup(optarg); break; case 'd': if (virStrToLong_i(optarg, NULL, 10, &debug) < 0) { @@ -742,7 +742,7 @@ virshParseArgv(vshControl *ctl, int argc, char **argv) break; case 'l': vshCloseLogFile(ctl); - ctl->logfile =3D vshStrdup(ctl, optarg); + ctl->logfile =3D g_strdup(optarg); vshOpenLogFile(ctl); break; case 'q': @@ -906,8 +906,7 @@ main(int argc, char **argv) } =20 if (!ctl->connname) - ctl->connname =3D vshStrdup(ctl, - getenv("VIRSH_DEFAULT_CONNECT_URI")); + ctl->connname =3D g_strdup(getenv("VIRSH_DEFAULT_CONNECT_URI")); =20 if (!ctl->imode) { ret =3D vshCommandRun(ctl, ctl->cmd); diff --git a/tools/virt-admin.c b/tools/virt-admin.c index 3aada5f963..f3ae011cf4 100644 --- a/tools/virt-admin.c +++ b/tools/virt-admin.c @@ -343,7 +343,7 @@ cmdConnect(vshControl *ctl, const vshCmd *cmd) =20 if (name) { VIR_FREE(ctl->connname); - ctl->connname =3D vshStrdup(ctl, name); + ctl->connname =3D g_strdup(name); } =20 vshAdmReconnect(ctl); @@ -1295,7 +1295,7 @@ vshAdmParseArgv(vshControl *ctl, int argc, char **arg= v) switch (arg) { case 'c': VIR_FREE(ctl->connname); - ctl->connname =3D vshStrdup(ctl, optarg); + ctl->connname =3D g_strdup(optarg); break; case 'd': if (virStrToLong_i(optarg, NULL, 10, &debug) < 0) { @@ -1315,7 +1315,7 @@ vshAdmParseArgv(vshControl *ctl, int argc, char **arg= v) break; case 'l': vshCloseLogFile(ctl); - ctl->logfile =3D vshStrdup(ctl, optarg); + ctl->logfile =3D g_strdup(optarg); vshOpenLogFile(ctl); break; case 'q': diff --git a/tools/vsh.c b/tools/vsh.c index 9ee3f99ff3..baba5ec314 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -176,7 +176,7 @@ int vshStringToArray(const char *str, char ***array) { - char *str_copied =3D vshStrdup(NULL, str); + char *str_copied =3D g_strdup(str); char *str_tok =3D NULL; char *tmp; unsigned int nstr_tokens =3D 0; @@ -214,10 +214,10 @@ vshStringToArray(const char *str, continue; } *tmp++ =3D '\0'; - arr[nstr_tokens++] =3D vshStrdup(NULL, str_tok); + arr[nstr_tokens++] =3D g_strdup(str_tok); str_tok =3D tmp; } - arr[nstr_tokens++] =3D vshStrdup(NULL, str_tok); + arr[nstr_tokens++] =3D g_strdup(str_tok); =20 *array =3D arr; VIR_FREE(str_copied); @@ -1451,7 +1451,7 @@ vshCommandParse(vshControl *ctl, vshCommandParser *pa= rser, vshCmd **partial) /* aliases need to be resolved to the actual commands */ if (cmd->flags & VSH_CMD_FLAG_ALIAS) { VIR_FREE(tkdata); - tkdata =3D vshStrdup(ctl, cmd->alias); + tkdata =3D g_strdup(cmd->alias); cmd =3D vshCmddefSearch(tkdata); } if (vshCmddefOptParse(cmd, &opts_need_arg, @@ -1472,7 +1472,7 @@ vshCommandParse(vshControl *ctl, vshCommandParser *pa= rser, vshCmd **partial) =20 if (optstr) { *optstr =3D '\0'; /* convert the '=3D' to '\0' */ - optstr =3D vshStrdup(ctl, optstr + 1); + optstr =3D g_strdup(optstr + 1); } /* Special case 'help' to ignore all spurious options */ if (!(opt =3D vshCmddefGetOption(ctl, cmd, tkdata + 2, @@ -1582,7 +1582,7 @@ vshCommandParse(vshControl *ctl, vshCommandParser *pa= rser, vshCmd **partial) vshCommandOptFree(first); first =3D vshMalloc(ctl, sizeof(vshCmdOpt)); first->def =3D help->opts; - first->data =3D vshStrdup(ctl, cmd->name); + first->data =3D g_strdup(cmd->name); first->next =3D NULL; =20 cmd =3D help; @@ -1686,7 +1686,7 @@ vshCommandStringGetArg(vshControl *ctl, vshCommandPar= ser *parser, char **res, bool double_quote =3D false; int sz =3D 0; char *p =3D parser->pos; - char *q =3D vshStrdup(ctl, p); + char *q =3D g_strdup(p); =20 *res =3D q; =20 @@ -1834,11 +1834,11 @@ vshGetTypedParamValue(vshControl *ctl, virTypedPara= meterPtr item) break; =20 case VIR_TYPED_PARAM_BOOLEAN: - str =3D vshStrdup(ctl, item->value.b ? _("yes") : _("no")); + str =3D g_strdup(item->value.b ? _("yes") : _("no")); break; =20 case VIR_TYPED_PARAM_STRING: - str =3D vshStrdup(ctl, item->value.s); + str =3D g_strdup(item->value.s); break; =20 default: @@ -2668,7 +2668,7 @@ vshReadlineCommandGenerator(const char *text) virStringListFree(ret); return NULL; } - ret[ret_size] =3D vshStrdup(NULL, name); + ret[ret_size] =3D g_strdup(name); ret_size++; /* Terminate the string list properly. */ ret[ret_size] =3D NULL; @@ -2820,7 +2820,7 @@ vshReadlineParse(const char *text, int state) char *ret =3D NULL; =20 if (!state) { - char *buf =3D vshStrdup(NULL, rl_line_buffer); + char *buf =3D g_strdup(rl_line_buffer); =20 vshCommandFree(partial); partial =3D NULL; @@ -2882,7 +2882,7 @@ vshReadlineParse(const char *text, int state) } =20 if (list) { - ret =3D vshStrdup(NULL, list[list_index]); + ret =3D g_strdup(list[list_index]); list_index++; } =20 @@ -3055,7 +3055,7 @@ vshReadline(vshControl *ctl, const char *prompt) if (len > 0 && r[len-1] =3D=3D '\n') r[len-1] =3D '\0'; =20 - return vshStrdup(ctl, r); + return g_strdup(r); } =20 #endif /* !WITH_READLINE */ @@ -3095,7 +3095,7 @@ vshInitDebug(vshControl *ctl) /* log file not set from cmdline */ debugEnv =3D getenv(env); if (debugEnv && *debugEnv) { - ctl->logfile =3D vshStrdup(ctl, debugEnv); + ctl->logfile =3D g_strdup(debugEnv); vshOpenLogFile(ctl); } VIR_FREE(env); @@ -3345,7 +3345,7 @@ cmdEcho(vshControl *ctl, const vshCmd *cmd) } str =3D virBufferContentAndReset(&xmlbuf); } else { - str =3D vshStrdup(ctl, arg); + str =3D g_strdup(arg); } =20 if (shell) --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 18:38:09 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 ARC-Seal: i=1; a=rsa-sha256; t=1571438338; cv=none; d=zoho.com; s=zohoarc; b=AtAuFA8o03TGqoNVqR4bLeSbRH8v0+ff1uKS7hcSwpWh3n+BxSd18bNShKxuO3F98Mnv/VviF8p/CjBH3ErQoUOGtK4Q0isV4SS0ZBmtfSRVsqpm2Bsv3M3+Xax6VDSP6jr7VTk+QYx7yRw7ljR0OyrMUNsgtAdmofecODQDPTw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571438338; 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=9MflZbj9xyHgotXiWYT4RTwjfFqcQ3yn3cxP0aD2eQY=; b=BLzySUMir7RPpEpEr7b6TO3Fpyi8LqWGq1dYdGzmPISqE5cxd9m8X9Rar6VfUDQPcZxadJ7reAmBlu5oBniNwamkCcFFN1go78+IoFJ8aDyYj8UFooYx16o9V6w6NhFTbkvBLI7O203u1Tbod2APFEYgvDcEInbBkpTkciBkLzk= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1571438338785538.0221944926149; Fri, 18 Oct 2019 15:38:58 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 4836A3018FC5; Fri, 18 Oct 2019 22:38:57 +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 1F4B460F88; Fri, 18 Oct 2019 22:38:57 +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 D51013FB4D; Fri, 18 Oct 2019 22:38:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9IMbQSt025376 for ; Fri, 18 Oct 2019 18:37:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id B69FD5D70E; Fri, 18 Oct 2019 22:37:26 +0000 (UTC) Received: from lpt.redhat.com (ovpn-200-21.brq.redhat.com [10.40.200.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id D40A85D71C for ; Fri, 18 Oct 2019 22:37:21 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Sat, 19 Oct 2019 00:37:54 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 10/10] tools: delete vshStrdup 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Fri, 18 Oct 2019 22:38:57 +0000 (UTC) Now that we use g_strdup everywhere, delete vshStrdup. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Daniel Henrique Barboza --- tools/vsh.c | 12 ------------ tools/vsh.h | 4 ---- 2 files changed, 16 deletions(-) diff --git a/tools/vsh.c b/tools/vsh.c index baba5ec314..a10a9625e4 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -142,18 +142,6 @@ _vshCalloc(vshControl *ctl, size_t nmemb, size_t size,= const char *filename, exit(EXIT_FAILURE); } =20 -char * -_vshStrdup(vshControl *ctl, const char *s, const char *filename, int line) -{ - char *x; - - if (VIR_STRDUP(x, s) >=3D 0) - return x; - vshError(ctl, _("%s: %d: failed to allocate %lu bytes"), - filename, line, (unsigned long)strlen(s)); - exit(EXIT_FAILURE); -} - int vshNameSorter(const void *a, const void *b) { diff --git a/tools/vsh.h b/tools/vsh.h index 99977af7e3..ad783e24b7 100644 --- a/tools/vsh.h +++ b/tools/vsh.h @@ -473,10 +473,6 @@ void *_vshCalloc(vshControl *ctl, size_t nmemb, size_t= sz, #define vshCalloc(_ctl, _nmemb, _sz) \ _vshCalloc(_ctl, _nmemb, _sz, __FILE__, __LINE__) =20 -char *_vshStrdup(vshControl *ctl, const char *s, const char *filename, - int line); -#define vshStrdup(_ctl, _s) _vshStrdup(_ctl, _s, __FILE__, __LINE__) - /* Macros to help dealing with mutually exclusive options. */ =20 /* VSH_EXCLUSIVE_OPTIONS_EXPR: --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list