From nobody Sun Feb 8 12:19:20 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 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=1571576175; cv=none; d=zoho.com; s=zohoarc; b=eMzh8iPP+T1u5xaKU2FBK+bd2PauwKteAShe6nQCf0wzwcTSU7lrcM8IafEX6kEixpH0Xi5UFo+v88nacaVy34VqH053qsgEhgSTUj9UEr95Emr4N1YBqOlUzX2YbfLzgMUtvRONkdQXQgJvoHzcL6lfZf7Fbq83S+zCn0XtR38= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571576175; 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=KcGOF60QO70SfTVe601JciiRqIqIDlg+4gGOAF9/F6k=; b=Kqgk+kqtKbJ7FbjnNgRD9lqp2+XlVEKHr9RZUSUWnol7/L9/dGek9r+HT5Fg3daDaN6iVdKW2jMa7ekTEDeFX0YV7ZYs3tolgX/x27Lp8gppWnXFDCniiZd7mEIcopy3a6M8d9QO27t70bzNP1rfXmAQmAtXJnVfyAiCHDlO2dA= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1571576175504956.0807112452845; Sun, 20 Oct 2019 05:56:15 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-181-jfg0AMsIO9qSIxKSOatJ8Q-1; Sun, 20 Oct 2019 08:56:12 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id C10E0800D49; Sun, 20 Oct 2019 12:56:07 +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 9CE196061E; Sun, 20 Oct 2019 12:56:07 +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 638344EDA6; Sun, 20 Oct 2019 12:56:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9KCtfai023377 for ; Sun, 20 Oct 2019 08:55:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 291BF196AE; Sun, 20 Oct 2019 12:55:41 +0000 (UTC) Received: from lpt.redhat.com (ovpn-200-23.brq.redhat.com [10.40.200.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8523E194B9 for ; Sun, 20 Oct 2019 12:55:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571576174; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=KcGOF60QO70SfTVe601JciiRqIqIDlg+4gGOAF9/F6k=; b=bp7zrwI32dF3uZCCi2EbmnTA9X4/KlILeXoYkkV3MfKY+OjXCl3tgg7t1PwuApqyfQHGYC IxRNtySjkJ1m8p+KHJPSbLl0BRZ4SaSTbS25Iuau57LIfagZuQw4iMjWtz3tIsJ+GGcgop EYJ1AGEcXmBZ3rBJy8T+OFsnH5KgXCo= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Sun, 20 Oct 2019 14:55:27 +0200 Message-Id: <2b75625a839567460dc7f4d4ad49f54c4fa8aaa1.1571575889.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 09/34] bhyve: use g_strdup instead of VIR_STRDUP X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: jfg0AMsIO9qSIxKSOatJ8Q-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Replace all occurrences of if (VIR_STRDUP(a, b) < 0) /* effectively dead code */ with: a =3D g_strdup(b); Signed-off-by: J=C3=A1n Tomko --- src/bhyve/bhyve_command.c | 15 +++++--------- src/bhyve/bhyve_conf.c | 3 +-- src/bhyve/bhyve_driver.c | 3 +-- src/bhyve/bhyve_parse_command.c | 35 +++++++++------------------------ 4 files changed, 16 insertions(+), 40 deletions(-) diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c index 912cf99683..8ea76cee2e 100644 --- a/src/bhyve/bhyve_command.c +++ b/src/bhyve/bhyve_command.c @@ -58,12 +58,10 @@ bhyveBuildNetArgStr(virConnectPtr conn, virDomainNetType actualType =3D virDomainNetGetActualType(net); =20 if (net->model =3D=3D VIR_DOMAIN_NET_MODEL_VIRTIO) { - if (VIR_STRDUP(nic_model, "virtio-net") < 0) - return -1; + nic_model =3D g_strdup("virtio-net"); } else if (net->model =3D=3D VIR_DOMAIN_NET_MODEL_E1000) { if ((bhyveDriverGetCaps(conn) & BHYVE_CAP_NET_E1000) !=3D 0) { - if (VIR_STRDUP(nic_model, "e1000") < 0) - return -1; + nic_model =3D g_strdup("e1000"); } else { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("NIC model 'e1000' is not supported " @@ -77,8 +75,7 @@ bhyveBuildNetArgStr(virConnectPtr conn, } =20 if (actualType =3D=3D VIR_DOMAIN_NET_TYPE_BRIDGE) { - if (VIR_STRDUP(brname, virDomainNetGetActualBridgeName(net)) < 0) - goto cleanup; + brname =3D g_strdup(virDomainNetGetActualBridgeName(net)); } else { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Network type %d is not supported"), @@ -90,8 +87,7 @@ bhyveBuildNetArgStr(virConnectPtr conn, STRPREFIX(net->ifname, VIR_NET_GENERATED_TAP_PREFIX) || strchr(net->ifname, '%')) { VIR_FREE(net->ifname); - if (VIR_STRDUP(net->ifname, VIR_NET_GENERATED_TAP_PREFIX "%d") < 0) - goto cleanup; + net->ifname =3D g_strdup(VIR_NET_GENERATED_TAP_PREFIX "%d"); } =20 if (!dryRun) { @@ -117,8 +113,7 @@ bhyveBuildNetArgStr(virConnectPtr conn, if (virNetDevSetOnline(net->ifname, true) !=3D 0) goto cleanup; } else { - if (VIR_STRDUP(realifname, "tap0") < 0) - goto cleanup; + realifname =3D g_strdup("tap0"); } =20 =20 diff --git a/src/bhyve/bhyve_conf.c b/src/bhyve/bhyve_conf.c index 617b25eb8f..ab5d7f467b 100644 --- a/src/bhyve/bhyve_conf.c +++ b/src/bhyve/bhyve_conf.c @@ -56,8 +56,7 @@ virBhyveDriverConfigNew(void) if (!(cfg =3D virObjectNew(virBhyveDriverConfigClass))) return NULL; =20 - if (VIR_STRDUP(cfg->firmwareDir, DATADIR "/uefi-firmware") < 0) - goto error; + cfg->firmwareDir =3D g_strdup(DATADIR "/uefi-firmware"); =20 return cfg; =20 diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index db3d71f2b2..e3d984f69a 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -470,8 +470,7 @@ bhyveDomainGetOSType(virDomainPtr dom) if (virDomainGetOSTypeEnsureACL(dom->conn, vm->def) < 0) goto cleanup; =20 - if (VIR_STRDUP(ret, virDomainOSTypeToString(vm->def->os.type)) < 0) - goto cleanup; + ret =3D g_strdup(virDomainOSTypeToString(vm->def->os.type)); =20 cleanup: virDomainObjEndAPI(&vm); diff --git a/src/bhyve/bhyve_parse_command.c b/src/bhyve/bhyve_parse_comman= d.c index 7c72651b00..fa3b881f21 100644 --- a/src/bhyve/bhyve_parse_command.c +++ b/src/bhyve/bhyve_parse_command.c @@ -299,16 +299,8 @@ bhyveParseBhyveLPCArg(virDomainDefPtr def, goto error; } =20 - if (VIR_STRDUP(chr->source->data.nmdm.master, param) < 0) { - virDomainChrDefFree(chr); - goto error; - } - - if (VIR_STRDUP(chr->source->data.nmdm.slave, chr->source->data.fil= e.path) - < 0) { - virDomainChrDefFree(chr); - goto error; - } + chr->source->data.nmdm.master =3D g_strdup(param); + chr->source->data.nmdm.slave =3D g_strdup(chr->source->data.file.p= ath); =20 /* If the last character of the master is 'A', the slave will be '= B' * and vice versa */ @@ -456,13 +448,11 @@ bhyveParsePCIDisk(virDomainDefPtr def, if (bus =3D=3D VIR_DOMAIN_DISK_BUS_VIRTIO) { idx =3D *nvirtiodisk; *nvirtiodisk +=3D 1; - if (VIR_STRDUP(disk->dst, "vda") < 0) - goto error; + disk->dst =3D g_strdup("vda"); } else if (bus =3D=3D VIR_DOMAIN_DISK_BUS_SATA) { idx =3D *nahcidisk; *nahcidisk +=3D 1; - if (VIR_STRDUP(disk->dst, "sda") < 0) - goto error; + disk->dst =3D g_strdup("sda"); } =20 if (idx > 'z' - 'a') { @@ -507,8 +497,7 @@ bhyveParsePCINet(virDomainDefPtr def, * guess the actual bridge name from the command line, * try to come up with some reasonable defaults */ net->type =3D VIR_DOMAIN_NET_TYPE_BRIDGE; - if (VIR_STRDUP(net->data.bridge.brname, "virbr0") < 0) - goto error; + net->data.bridge.brname =3D g_strdup("virbr0"); =20 net->model =3D model; net->info.type =3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI; @@ -738,8 +727,7 @@ bhyveParseBhyveCommandLine(virDomainDefPtr def, } =20 if (def->name =3D=3D NULL) { - if (VIR_STRDUP(def->name, argv[argc]) < 0) - goto error; + def->name =3D g_strdup(argv[argc]); } else if (STRNEQ(def->name, argv[argc])) { /* the vm name of the loader and the bhyverun command differ, thro= w an * error here */ @@ -819,15 +807,12 @@ bhyveParseBhyveLoadCommandLine(virDomainDefPtr def, if (arguments !=3D 3) { /* Set os.bootloader since virDomainDefFormatInternal will only fo= rmat * the bootloader arguments if os->bootloader is set. */ - if (VIR_STRDUP(def->os.bootloader, argv[0]) < 0) - goto error; - + def->os.bootloader =3D g_strdup(argv[0]); def->os.bootloaderArgs =3D virStringListJoin((const char**) &argv[= 1], " "); } =20 if (def->name =3D=3D NULL) { - if (VIR_STRDUP(def->name, argv[argc]) < 0) - goto error; + def->name =3D g_strdup(argv[argc]); } else if (STRNEQ(def->name, argv[argc])) { /* the vm name of the loader and the bhyverun command differ, thro= w an * error here */ @@ -849,9 +834,7 @@ bhyveParseCustomLoaderCommandLine(virDomainDefPtr def, if (!argv) goto error; =20 - if (VIR_STRDUP(def->os.bootloader, argv[0]) < 0) - goto error; - + def->os.bootloader =3D g_strdup(argv[0]); def->os.bootloaderArgs =3D virStringListJoin((const char**) &argv[1], = " "); =20 return 0; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list