From nobody Tue Jul 1 11:24:09 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 1531504633975162.2614623668677; Fri, 13 Jul 2018 10:57:13 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 54321307C70E; Fri, 13 Jul 2018 17:57:09 +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 202913001B84; Fri, 13 Jul 2018 17:57:09 +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 B190F1800B84; Fri, 13 Jul 2018 17:57:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6DHuMxW008956 for ; Fri, 13 Jul 2018 13:56:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1B0E95C545; Fri, 13 Jul 2018 17:56:22 +0000 (UTC) Received: from mx1.redhat.com (ext-mx14.extmail.prod.ext.phx2.redhat.com [10.5.110.43]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0CFF05C72C for ; Fri, 13 Jul 2018 17:56:21 +0000 (UTC) Received: from mail-pf0-f194.google.com (mail-pf0-f194.google.com [209.85.192.194]) (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 1F5A230E4E82 for ; Fri, 13 Jul 2018 17:56:11 +0000 (UTC) Received: by mail-pf0-f194.google.com with SMTP id l123-v6so23031115pfl.13 for ; Fri, 13 Jul 2018 10:56:11 -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.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Jul 2018 10:56:09 -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=NLdXWdon241mh1bL8DmW93pgy/o9jsEHW7trYZmr6dg=; b=OB7aYIS6mGazsVrocnPrHeNBSIxtbd1eMM2eiz86eyL5lwVyg5l/8okW4T/FZ0Wq9L JSUSzhlPjXdzL6nGtXf01k2exyu2aCTq+ba5t2juiOGV3L2omPml9CNyqi29Zv6tXvfh oWFHAsSPBLlABHnjJQP07lhKJcQI3EmjvZv4Yoz6WpHaQ224b+hlhnTYYrmc+/9Po3PG HNdWzv7XUWlM4bgdSV2SqmR8Q5pN2Hhoc+6IiFObowwTTw7kJHQVKuDEnrkcKJsR9uXK jczg+lPg3AC9p3GfTelqatM46ZR5Xj1vJXIULCPF+bvlFPuDPG3oI+AOMbAl/tWNqiNI 0RNA== 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=NLdXWdon241mh1bL8DmW93pgy/o9jsEHW7trYZmr6dg=; b=ONBz57ZAYZymqzO5L4EqOMz0X58Z16/qB2uUuSYWco/hJegpnGrUSaLcQwj2Pgwk+s swp/AKphuZmXEO/Lbx1gRWPKeZqgJDGx7m5Sb4YQ997bSCT128CIF6gc45i1uep344DH rL/b5d7NAzqxDq0sMd8xC3q3cL4ARLsTtScN9nqqNRuVoc2THrfcNV02vETurSzkyRpy tGf7NboJqcpRt4X10E68w0g6dARgqEMKASCXNx6RUnVn6nIiKAmYI9yyfUGPRWuCV6ct cz4YevR6dYLbXhebqctGBN3w2txUQEtZyVtVyJCHkk2k6ZY6m6aroez2U1fJPWtcyEmD MQ+A== X-Gm-Message-State: AOUpUlE0LEGgKZiOVdlquBt98BM3SamG3nKkMkq+PnUl+7yBZMS1LGHV 4wJtwP1k/AE3NZvzeU+b7Bf0QXfF X-Google-Smtp-Source: AAOMgpesRa/uZMnIArX6Vi0bv1t8JMFdDQ46KbGqCxiApk6in74c4OUnL/VQx+3KzyhyTO93197D8g== X-Received: by 2002:a63:dd09:: with SMTP id t9-v6mr7013225pgg.370.1531504570349; Fri, 13 Jul 2018 10:56:10 -0700 (PDT) From: Sukrit Bhatnagar To: libvir-list@redhat.com Date: Fri, 13 Jul 2018 23:25:03 +0530 Message-Id: <1531504509-7930-26-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.43]); Fri, 13 Jul 2018 17:56:11 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Fri, 13 Jul 2018 17:56:11 +0000 (UTC) for IP:'209.85.192.194' DOMAIN:'mail-pf0-f194.google.com' HELO:'mail-pf0-f194.google.com' FROM:'skrtbhtngr@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.3 * (DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS, T_DKIM_INVALID) 209.85.192.194 mail-pf0-f194.google.com 209.85.192.194 mail-pf0-f194.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.43 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 25/31] 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.26 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:57:13 +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