From nobody Tue Jul 1 09:54:51 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 153150463978596.51355044717616; Fri, 13 Jul 2018 10:57:19 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6456A30E265F; Fri, 13 Jul 2018 17:57:18 +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 11B04300190D; Fri, 13 Jul 2018 17:57:15 +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 4203D2478B; Fri, 13 Jul 2018 17:57:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6DHuNR9008963 for ; Fri, 13 Jul 2018 13:56:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 808EC2010CC6; Fri, 13 Jul 2018 17:56:23 +0000 (UTC) Received: from mx1.redhat.com (ext-mx13.extmail.prod.ext.phx2.redhat.com [10.5.110.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 726122010CCE for ; Fri, 13 Jul 2018 17:56:20 +0000 (UTC) Received: from mail-pf0-f179.google.com (mail-pf0-f179.google.com [209.85.192.179]) (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 53A1B308214F for ; Fri, 13 Jul 2018 17:56:09 +0000 (UTC) Received: by mail-pf0-f179.google.com with SMTP id e10-v6so23052263pfn.1 for ; Fri, 13 Jul 2018 10:56:09 -0700 (PDT) Received: from centos.localdomain ([42.106.1.21]) by smtp.gmail.com with ESMTPSA id n5-v6sm26866817pgr.24.2018.07.13.10.56.06 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Jul 2018 10:56:08 -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=d4fgqMDHKHm08LqJYv/LKUjzCqd7g8xpsO56u7uQ59g=; b=opWl+NEe7RXCiY5P21wKGJ7R4YrqzhKoFaeYFScP9K/Av7baUdyvNxIpwpv4sQKfwb 5eLlQEHYVx300wn+PrWJaqemEP2CEWBSh8HB9B/oxeXJgpRAKtRNAXyUzWHWKW5Pw4/N PaP3bgglViFE0Aqt8rYhc66MrzrXqSywffHqdacQ4hxaZIjlTOnpoCHNsW5vo5SZG4kt BtS8HpPVhiIkfFm3mczuPqw2+bQpVWn/P1M4u0iX/WeOOrLSFI3t+rEyrpcHmtniZ71S zFFIBbREkJCtcgpakr+8aF2nKWSsmWsFfdDaPb5dlWz0Kmtvchyl0VB0LjT1vD8nlEXM qSJg== 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=d4fgqMDHKHm08LqJYv/LKUjzCqd7g8xpsO56u7uQ59g=; b=EDuPASsMYjz7wwVvcBRZKS/Gi9OjWa8Qs7btCPQOXr4CFP1qHXMKHZ/GPD2VnwniVz 26537yNUIaVVGmWdrUZArI2I0YIyNejZHMOyFT6a+14+H5AEn+MRgZk3+5jl3VklntJq alQNHiYqlmkXWBgCAwKE79l0Bn5dj8yI/jJLPjdzpAUTdBICsOzobEbiGIZjMIHjVyTg ERK8A87oD8RKohM6aG4Iuwa0YHxnaKiKhlotgt1Alric6C8EWfoVgeVQuSyJNzvtwa59 oybV5FyulVIch3wrCFK2n07hFxF3cBNyqBRZdjGB4Iaw1S8p9FuipL7pdYQIgZ+9W5e1 5UMw== X-Gm-Message-State: AOUpUlG5Rh0sN16rgU9n+LAEFgKwj6ojQLb3zXOLdMebyQ2bWfp545L9 bro8lk+2iUf0w4oXwyfmdF+faLA8 X-Google-Smtp-Source: AAOMgpeGY4vweG+Zg71HuiZLSJBVMNjK73N/w3Ie+sU8L8VS++W7L9Rel5aqAaCJpr18jvIYNjTdiQ== X-Received: by 2002:a62:e00a:: with SMTP id f10-v6mr8177546pfh.208.1531504568605; Fri, 13 Jul 2018 10:56:08 -0700 (PDT) From: Sukrit Bhatnagar To: libvir-list@redhat.com Date: Fri, 13 Jul 2018 23:25:02 +0530 Message-Id: <1531504509-7930-25-git-send-email-skrtbhtngr@gmail.com> In-Reply-To: <1531504509-7930-1-git-send-email-skrtbhtngr@gmail.com> References: <1531504509-7930-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.42]); Fri, 13 Jul 2018 17:56:09 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Fri, 13 Jul 2018 17:56:09 +0000 (UTC) for IP:'209.85.192.179' DOMAIN:'mail-pf0-f179.google.com' HELO:'mail-pf0-f179.google.com' FROM:'skrtbhtngr@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.301 * (DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_NONE, SPF_PASS, T_DKIM_INVALID) 209.85.192.179 mail-pf0-f179.google.com 209.85.192.179 mail-pf0-f179.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.42 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 24/31] 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.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Fri, 13 Jul 2018 17:57:19 +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