From nobody Tue May 13 22:20:03 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 1528400118449984.4038217668727; Thu, 7 Jun 2018 12:35:18 -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 185D0356F1; Thu, 7 Jun 2018 19:35:17 +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 CBFD3308BDB1; Thu, 7 Jun 2018 19:35:16 +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 6CAF14CA83; Thu, 7 Jun 2018 19:35:16 +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 w57JZDBK018907 for ; Thu, 7 Jun 2018 15:35:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9D7215D6A3; Thu, 7 Jun 2018 19:35:13 +0000 (UTC) Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 909C45B680 for ; Thu, 7 Jun 2018 19:35:09 +0000 (UTC) Received: from mail-pf0-f175.google.com (mail-pf0-f175.google.com [209.85.192.175]) (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 4965281E01 for ; Thu, 7 Jun 2018 19:34:59 +0000 (UTC) Received: by mail-pf0-f175.google.com with SMTP id b74-v6so5400803pfl.5 for ; Thu, 07 Jun 2018 12:34:59 -0700 (PDT) Received: from centos.localdomain ([49.32.106.159]) by smtp.gmail.com with ESMTPSA id d23-v6sm86686407pfn.3.2018.06.07.12.34.56 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 12:34:57 -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=G6my9eecfsICZ3VpfOCzXFAk5lImfrctXcaq4tJHJBQ=; b=Av4vnTlICctebMuIyKZVA+B8re9fyWzrctceuXAEmhsBuip6KUPq8ceMfBb/1LALAP mEvFpcn13dcnIb1Uj/q96aOq3oMCNCAbULiryx2fczUPSNT/kWrHUf05VKulISBSZ4te 1o/M1bhSqPVyKbILGiEHMTukrGZWNqjzaZoQOt3eMRuO9Pxip6tjRDiEYqStidT0uSNk q2evcQ0pzmlTfyovpS1lFYdH08WY4qT+8DQlqlru2kmQXCqMW/SOhqQolEjqnozjBMU9 jZFWeSPmUVbL9KpXe1hwCfvpC60faD81oXSEX0PyeDcdSQELe2QITASMGIjyoucF27QA nQUA== 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=G6my9eecfsICZ3VpfOCzXFAk5lImfrctXcaq4tJHJBQ=; b=fWaSUK6qgLItPn2Wpb+JIVBvTqbRivFpqwrHgTX5zQSz7wlsrloOAGeiwU5cUUkDff O3sTGSI2IWztVP4AvwwZeVfHf5qgzgp2xPNYfASTKegNt+M7BhjzDe2pMkknMYWFDSQg PWmtwtA6pWhk9SNDw6QpfYyOu0gSZDzWgC8z8kPgbNkkmfGHARA6YACmIMkh1YgFiHYk cnX9k0xVRFuuGB80bryXlMnjft37nI2tIwWFGmnpFFCGyi18ImfrU5p0EJvhGJY5soOR ore3jrTu1FreWNPJLGE3nVMAk8/myhfqQnF3BQuEtqUrPTkDZ2uMf7mRcLEDNlovp0fB Bi1g== X-Gm-Message-State: APt69E2/uWFqeefF8FdMf80ZSTdhUUDyToHH2FlUObfcxWswaQf82Vcy OuPcFeTtCRwXNictUkL5vLaYOMa6 X-Google-Smtp-Source: ADUXVKLMsDW8Dk0TYq+LBMnsyMRDr8xpDc4Ihbr7bAYxbzZ3XwGAafh7CS3PsB8Iiy4f1TQM3/e9Hg== X-Received: by 2002:a62:d712:: with SMTP id b18-v6mr2985526pfh.70.1528400098351; Thu, 07 Jun 2018 12:34:58 -0700 (PDT) From: Sukrit Bhatnagar To: libvir-list@redhat.com Date: Fri, 8 Jun 2018 01:04:25 +0530 Message-Id: <1528400083-6788-4-git-send-email-skrtbhtngr@gmail.com> In-Reply-To: <1528400083-6788-1-git-send-email-skrtbhtngr@gmail.com> References: <1528400083-6788-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.25]); Thu, 07 Jun 2018 19:34:59 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 07 Jun 2018 19:34:59 +0000 (UTC) for IP:'209.85.192.175' DOMAIN:'mail-pf0-f175.google.com' HELO:'mail-pf0-f175.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.175 mail-pf0-f175.google.com 209.85.192.175 mail-pf0-f175.google.com X-Scanned-By: MIMEDefang 2.83 on 10.5.110.25 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v1 03/21] util: iohelper: use VIR_AUTOFREE instead of VIR_FREE for scalar 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.30]); Thu, 07 Jun 2018 19:35:17 +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 the GCC's __attribute__((cleanup)) handled by VIR_AUTOFREE macro, majority of the VIR_FREE calls can be dropped, which in turn leads to getting rid of most of our cleanup sections. --- src/util/iohelper.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/util/iohelper.c b/src/util/iohelper.c index bb8a8dd..f7794dc 100644 --- a/src/util/iohelper.c +++ b/src/util/iohelper.c @@ -46,7 +46,7 @@ static int runIO(const char *path, int fd, int oflags) { - void *base =3D NULL; /* Location to be freed */ + VIR_AUTOFREE(void *) base =3D NULL; /* Location to be freed */ char *buf =3D NULL; /* Aligned location within base */ size_t buflen =3D 1024*1024; intptr_t alignMask =3D 64*1024 - 1; @@ -174,8 +174,6 @@ runIO(const char *path, int fd, int oflags) virReportSystemError(errno, _("Unable to close %s"), path); ret =3D -1; } - - VIR_FREE(base); return ret; } =20 --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list