From nobody Tue May 13 18:35:11 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 1530481539658787.9425575941419; Sun, 1 Jul 2018 14:45:39 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7ADAD30820D3; Sun, 1 Jul 2018 21:45:38 +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 44D1F60BE3; Sun, 1 Jul 2018 21:45:38 +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 ECA171800CAD; Sun, 1 Jul 2018 21:45:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w61LjRMY009594 for ; Sun, 1 Jul 2018 17:45:27 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4DBC81001F5A; Sun, 1 Jul 2018 21:45:27 +0000 (UTC) Received: from mx1.redhat.com (ext-mx19.extmail.prod.ext.phx2.redhat.com [10.5.110.48]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 401461001F41 for ; Sun, 1 Jul 2018 21:45:25 +0000 (UTC) Received: from mail-pg0-f50.google.com (mail-pg0-f50.google.com [74.125.83.50]) (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 AD252307D847 for ; Sun, 1 Jul 2018 21:45:14 +0000 (UTC) Received: by mail-pg0-f50.google.com with SMTP id i7-v6so6210451pgp.2 for ; Sun, 01 Jul 2018 14:45:14 -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.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 01 Jul 2018 14:45:13 -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=c80o36F8JCeGv0Mh1VaQytM8dCfW7480fny3RIAKNdo=; b=Luc/KQrNSri+qemo73TKyFl+ewOJ1Hd+GhtECBN8atjRpAZjgnPLmvP18FkPU4/xLL xCULiUQzWTIa+pX1IWNmvAhK1bEGJkyc1ZeuVwG0LIzybFnCXeWUg9iKVONW6e4B/0St S+oH4XoLqgDyNZ2WGGHoJz1cTWWVcKt4H5/qPZlPNB5AVFxh+tkpCXJ8gzVo24xVeJkK ZNMCwy6JKpYTv/bnl7LFoYlZjENmfVYHKinO+2r3KOD5dljTDbxwt16mVvLYzop7reoW 0npTE8pKC2svuAJ6ci7ljOBCGtAPYYpfoma7gtdcr8LGv6FD8XNfbxKrH55PlgMTrEEQ abWA== 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=c80o36F8JCeGv0Mh1VaQytM8dCfW7480fny3RIAKNdo=; b=L7baSEpblJjiX9Efvw3dfgvaki7hcUuLhCkcHQWYGdPC4pMbu8fNsLFya9PfHz7SHm VE5zgonIcn0flcNykwsKvvRCFUq/rBkaOYA1s+5V2vNw8qUmdb6jwAM6BuxIOQWTQ3Lt h+7nzMm8XOsvJXqNVYUXlh9yBFKYQACfPRNrRYMKbjUfTysm9HvnNrxun8ZpYKmTSjmP ZzYcRjjuUcCMmWAMy6hhXwTzPiWlBb2qBWDN1uIZInO6tOfuSOiprYHnFxQJeff1Hl87 on4N4v6vGvb25xdCV/rHJGsvhnpxhGcc9R6QeO6EB8MMz+bx98qi9WIYK6WWIIUokyNQ OjEA== X-Gm-Message-State: APt69E2L9RAMzYHzy2sa8IEYo/gHACSOn6AAOcWMNlzczwt4joLapkIZ V4CHU0ZFtUGiL0gfyyqE3Pcl4yeF X-Google-Smtp-Source: AAOMgpfMI9mkUN+9LVa6CH209efrMfyOd6JZmewYqzfj7R20FD8WXpPUgHagHkwbTQfXN/lFNRRLvw== X-Received: by 2002:a62:90d4:: with SMTP id q81-v6mr14041994pfk.37.1530481513908; Sun, 01 Jul 2018 14:45:13 -0700 (PDT) From: Sukrit Bhatnagar To: libvir-list@redhat.com Date: Sat, 30 Jun 2018 14:30:33 +0530 Message-Id: <1530349239-22049-30-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.48]); Sun, 01 Jul 2018 21:45:14 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Sun, 01 Jul 2018 21:45:14 +0000 (UTC) for IP:'74.125.83.50' DOMAIN:'mail-pg0-f50.google.com' HELO:'mail-pg0-f50.google.com' FROM:'skrtbhtngr@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.786 * (DATE_IN_PAST_24_48, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_NONE, SPF_PASS, T_DKIM_INVALID) 74.125.83.50 mail-pg0-f50.google.com 74.125.83.50 mail-pg0-f50.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.48 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v3 29/35] 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.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Sun, 01 Jul 2018 21:45:39 +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_AUTOFREE macro for declaring scalar variables, majority of the VIR_FREE calls 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/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