From nobody Sun Feb 8 14:10:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1593209489; cv=none; d=zohomail.com; s=zohoarc; b=gn1oXMcs17KJDUtGWs8T6GkmKULbQI9e7TISh2Kka2qlqoQR2a9JRd+ZDIlj1O/HWom6FiBRfRfdCsacJb/6POqfTCn1QRPsaMUzOdOXsap+V7wp2rj5MlXxneroxBp5zVDqP6aG/C+HkFvTbODV4r1DA00WYxzZyVChxaAPDM0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1593209489; h=Content-Type:Content-Transfer-Encoding:Cc: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=NZ0vZShxg5Utl0JFwccrrxPAovnsYMFb8bomL9Akz2E=; b=b4ipqbe9gPiTCSRUrzYNx7CVjOTiQMUeJqVnY63FRF1GX4LKkNLZQCS5VSLYRWlhfyIjaomIq3VGLTXIY+YIUQxkCClIADnFIAff8PWpLeA6h+PU5anmMjwOfItnSQCFE8cNT6hjN+Mkj51Tm0DT04EpnJWCjrVraCkBdGPAfe4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1593209489028773.8816878856294; Fri, 26 Jun 2020 15:11:29 -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-396-kyje8yTxNieWmkE_wlAYaw-1; Fri, 26 Jun 2020 18:11:22 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5E30FBFC8; Fri, 26 Jun 2020 22:11:17 +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 3FE83612A5; Fri, 26 Jun 2020 22:11:17 +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 0D5EF180954D; Fri, 26 Jun 2020 22:11:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 05QMB27A015675 for ; Fri, 26 Jun 2020 18:11:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id A80D72017E80; Fri, 26 Jun 2020 22:11:02 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A339920182A5 for ; Fri, 26 Jun 2020 22:11:00 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 79B178007CD for ; Fri, 26 Jun 2020 22:11:00 +0000 (UTC) Received: from mail-qt1-f193.google.com (mail-qt1-f193.google.com [209.85.160.193]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-350-13yLDHrhMj2jH-uedpk0pA-1; Fri, 26 Jun 2020 18:10:58 -0400 Received: by mail-qt1-f193.google.com with SMTP id i3so8614950qtq.13 for ; Fri, 26 Jun 2020 15:10:58 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:4951:b792:3278:7364:91bd]) by smtp.gmail.com with ESMTPSA id v10sm7159090qtk.14.2020.06.26.15.10.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jun 2020 15:10:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593209485; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=NZ0vZShxg5Utl0JFwccrrxPAovnsYMFb8bomL9Akz2E=; b=CbRRjweBWwIzlrUTjvKSzUk2w8KqVzIaIZ30WQK+GfBWSdyR+wdtH169iBKZuL+C3shpi7 IdMiXu/rKTZRVn4NQzlBfmoifUEpIyglKbXcbluVzs1E7crZ5Dgdsem/5Ce0TLPRNv+LxC N2opr67ifRb4ZR2bvDi0QpIZVYh4G1s= X-MC-Unique: kyje8yTxNieWmkE_wlAYaw-1 X-MC-Unique: 13yLDHrhMj2jH-uedpk0pA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NZ0vZShxg5Utl0JFwccrrxPAovnsYMFb8bomL9Akz2E=; b=qXQIXpdsZZKXmg3s8c/TBk251Mug2lTpSYn/mmp02DKgDd2PGe/toDWELtv69+WbHv 5RrQtE+jcFri71Md62H8YaKN6CXcqBf4BQPIQrCHEMhC+ZGPYtj5cQ2c+GCX3DYnPAWx N0ZS7aehLcQp9vgVvhiBK/U6Bn5Jw4KdQ+9awtMcma+1lHHpyFhrOvF5uE9f4womFw+x UFIkqKZ+lwFpagAmyT/n1I7fD/iUbSs+psqT86moaP9InxMeuJ+FBE+VBu0dEvSkCMqd I/skRmkmnCHdoTBDqoPMreVMH3ABeayU+8ipc6xDI9f8SU/BI0RWW0ELg2lkFd8rCdMR DLqg== X-Gm-Message-State: AOAM533+MwcgTtcjQHU/1sqT0LOzpZ+GgcPo47UA11UovpK10Nd8YBWI KGVN7h+LiIO+dLjHaKdOu+YaTML7 X-Google-Smtp-Source: ABdhPJw9Nw+39Vsw/k9Z4u27Jng5x/llPoh6kUDAm36uJ1OgMbV4wC4rlCEz86Kfsa31D51nLS4OZw== X-Received: by 2002:aed:3fac:: with SMTP id s41mr5005535qth.86.1593209457470; Fri, 26 Jun 2020 15:10:57 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 3/7] virsh-domain.c: modernize virshVcpuinfoInactive() Date: Fri, 26 Jun 2020 19:10:40 -0300 Message-Id: <20200626221044.631749-4-danielhb413@gmail.com> In-Reply-To: <20200626221044.631749-1-danielhb413@gmail.com> References: <20200626221044.631749-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza 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.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Use g_auto* in the string and in the bitmap. Remove the cleanup label since it's now unneeded. Signed-off-by: Daniel Henrique Barboza --- tools/virsh-domain.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 085b88b097..23d41a4ddf 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -6886,16 +6886,15 @@ virshVcpuinfoInactive(vshControl *ctl, int maxcpu, bool pretty) { - unsigned char *cpumaps =3D NULL; + g_autofree unsigned char *cpumaps =3D NULL; size_t cpumaplen; int ncpus; - virBitmapPtr vcpus =3D NULL; + g_autoptr(virBitmap) vcpus =3D NULL; ssize_t nextvcpu =3D -1; - bool ret =3D false; bool first =3D true; =20 if (!(vcpus =3D virshDomainGetVcpuBitmap(ctl, dom, true))) - goto cleanup; + return false; =20 cpumaplen =3D VIR_CPU_MAPLEN(maxcpu); cpumaps =3D vshMalloc(ctl, virBitmapSize(vcpus) * cpumaplen); @@ -6903,7 +6902,7 @@ virshVcpuinfoInactive(vshControl *ctl, if ((ncpus =3D virDomainGetVcpuPinInfo(dom, virBitmapSize(vcpus), cpumaps, cpumaplen, VIR_DOMAIN_AFFECT_CONFIG)) < 0) - goto cleanup; + return false; =20 while ((nextvcpu =3D virBitmapNextSetBit(vcpus, nextvcpu)) >=3D 0) { if (!first) @@ -6918,15 +6917,10 @@ virshVcpuinfoInactive(vshControl *ctl, if (virshVcpuinfoPrintAffinity(ctl, VIR_GET_CPUMAP(cpumaps, cpumaplen, = nextvcpu), maxcpu, pretty) < 0) - goto cleanup; + return false; } =20 - ret =3D true; - - cleanup: - virBitmapFree(vcpus); - VIR_FREE(cpumaps); - return ret; + return true; } =20 =20 --=20 2.26.2