From nobody Tue May 13 18:40:39 2025 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; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1530481531117263.3442383713294; Sun, 1 Jul 2018 14:45:31 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 040C75F72E; Sun, 1 Jul 2018 21:45: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 B517188110; Sun, 1 Jul 2018 21:45:29 +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 688E624B76; Sun, 1 Jul 2018 21:45:29 +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 w61LjRMW009587 for ; Sun, 1 Jul 2018 17:45:27 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3B17E174AB; Sun, 1 Jul 2018 21:45:27 +0000 (UTC) Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 30DD217481 for ; Sun, 1 Jul 2018 21:45:22 +0000 (UTC) Received: from mail-pg0-f67.google.com (mail-pg0-f67.google.com [74.125.83.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8F0484901F for ; Sun, 1 Jul 2018 21:45:11 +0000 (UTC) Received: by mail-pg0-f67.google.com with SMTP id q14-v6so6196217pgt.13 for ; Sun, 01 Jul 2018 14:45:11 -0700 (PDT) Received: from centos.localdomain ([157.37.164.55]) by smtp.gmail.com with ESMTPSA id v68-v6sm15006933pfv.143.2018.07.01.14.45.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 01 Jul 2018 14:45:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=d5+PZLYwJROzNEskpQwuv7/Ngbsq2FlIf/xjzQvdr5w=; b=aVw9z8/5QPSsGoFkAPJftjWcoPs05dv22MJgAYaJjHhoXMt9MIwFyaG8Rph9QY+t0f b+bxa9cCg1I7yYsDSKoJARyeyBLRrcknP/Dk14kNFiWz6YieNz3NZ15brgc3LPEXinrR NSIUB2F0WK4RRcuaBXzrhKHWsgyHgK3gSRFI/XIhRYH/bJEktQxgO5GiPi1aHlJmyIDZ XkdFn9rNsNuEYwH4CshVieuMj2ijNsdhivrnbsOQHld8Ub7Zevn1d3ddRHDRGKXy1Qzs hpZFE6zhgSZndd2S2McM0vIjGmeJAsJ7vZtzyur9Pyc3M818jNtdIkERA5c5KLSeEjG/ zLiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=d5+PZLYwJROzNEskpQwuv7/Ngbsq2FlIf/xjzQvdr5w=; b=I6yP7Moxa1iJVwW3dT7l+jx45a+2OOQgouiIFI6iJVYS9JwnLgKjWWnTXHxdRP3ywo rkHEYkMBVg7IfrInrbtEj2qMahcagD/n5nrEQmXU+zWypV1vPzdRFyqXdIAOOFHidOSf iu/vEFFpfuiPRjyJXw15Fahuf4tR6O4ifuYLI1NlvCoXWqyzTvTmvrszDY+i3XPVsJJW CxJvysr87clUdJ1wg0lepOUaD+8C9ZY59S/gDHJZVjxoAEufxMDvJ1Je0PWCvRwrdozX 6uMLdP5KGvp7z6gsRGtd8rTnKmN5DaPBcnj/ebAw81c546QWQgUyP8oOx7rBfhg3CdUT 4JAg== X-Gm-Message-State: APt69E3MpJd0C75BIGmZpw0lGRXBOxS8akSUSBU5I3s08iWXQ6oNkFeO z+36KOIAaBvxJVjrd+LwxmfXpSQy X-Google-Smtp-Source: AAOMgpdb+UI0KK5FJF95SeR5EPxj8A2zU0D7a9tKLkRH3DauqDyvTUOlULYef/hC+XZ+0XzQ2sCn7g== X-Received: by 2002:a62:4308:: with SMTP id q8-v6mr2942291pfa.86.1530481510833; Sun, 01 Jul 2018 14:45:10 -0700 (PDT) From: Sukrit Bhatnagar To: libvir-list@redhat.com Date: Sat, 30 Jun 2018 14:30:32 +0530 Message-Id: <1530349239-22049-29-git-send-email-skrtbhtngr@gmail.com> In-Reply-To: <1530349239-22049-1-git-send-email-skrtbhtngr@gmail.com> References: <1530349239-22049-1-git-send-email-skrtbhtngr@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Sun, 01 Jul 2018 21:45:11 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Sun, 01 Jul 2018 21:45:11 +0000 (UTC) for IP:'74.125.83.67' DOMAIN:'mail-pg0-f67.google.com' HELO:'mail-pg0-f67.google.com' FROM:'skrtbhtngr@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.766 * (DATE_IN_PAST_24_48, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS, T_DKIM_INVALID) 74.125.83.67 mail-pg0-f67.google.com 74.125.83.67 mail-pg0-f67.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v3 28/35] util: bitmap: use VIR_AUTOPTR for aggregate types 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: , MIME-Version: 1.0 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.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Sun, 01 Jul 2018 21:45:30 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" By making use of GNU C's cleanup attribute handled by the VIR_AUTOPTR macro for declaring aggregate pointer variables, majority of the calls to *Free functions can be dropped, which in turn leads to getting rid of most of our cleanup sections. Signed-off-by: Sukrit Bhatnagar Reviewed-by: Erik Skultety --- src/util/virbitmap.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c index ef18dad..5b6e55f 100644 --- a/src/util/virbitmap.c +++ b/src/util/virbitmap.c @@ -1202,15 +1202,12 @@ char * virBitmapDataFormat(const void *data, int len) { - virBitmapPtr map =3D NULL; - char *ret =3D NULL; + VIR_AUTOPTR(virBitmap) map =3D NULL; =20 if (!(map =3D virBitmapNewData(data, len))) return NULL; =20 - ret =3D virBitmapFormat(map); - virBitmapFree(map); - return ret; + return virBitmapFormat(map); } =20 =20 --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list