From nobody Tue May 13 22:21:08 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 1528400134556791.3546209068861; Thu, 7 Jun 2018 12:35:34 -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 27F09308FBA0; Thu, 7 Jun 2018 19:35:33 +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 DC4C0A1433; Thu, 7 Jun 2018 19:35:32 +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 8C38E180BA84; Thu, 7 Jun 2018 19:35:32 +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 w57JZJIj018936 for ; Thu, 7 Jun 2018 15:35:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4ABE820155E4; Thu, 7 Jun 2018 19:35:19 +0000 (UTC) Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4358B20155E2 for ; Thu, 7 Jun 2018 19:35:19 +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 4D6E180F90 for ; Thu, 7 Jun 2018 19:35:06 +0000 (UTC) Received: by mail-pf0-f179.google.com with SMTP id q1-v6so5390026pff.13 for ; Thu, 07 Jun 2018 12:35:06 -0700 (PDT) Received: from centos.localdomain ([49.32.106.159]) by smtp.gmail.com with ESMTPSA id d23-v6sm86686407pfn.3.2018.06.07.12.35.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 12:35:04 -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=RoIyP4mMvVb64gdogSoWxPXJknyV7QZBvrBLEM/1is4=; b=a44QLC7AmzNtZuoV7lMIxWFRKswcGG3OJHuiKc3rW0NGDLU/DB7yIxG3ViGhsvbPQr E4Gv9bldsgBeKA6j6p8VItNg+5tLGvs/NfoFjUHvV92YHl8PoobRpApuGpFg4QpsHx+/ 4NGQLP7nE3s4pCulfG11f7Ugai5Uh3OgGJQz0XpYVGtXoYY6xHXFn5z628ebcw4HuyWq qCzBjcvOeGTuY3rPShminVBWFs48aVp9RSEOipS44jGuVMjCEsv18BuCFWKGnmKDIsN2 vzWtmBpue9dh2ycDnADroFe7m1nL7BJ3TRQJO5zXYV9S1grNGUKLDSiCzd/Rg3c1L20o w5IQ== 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=RoIyP4mMvVb64gdogSoWxPXJknyV7QZBvrBLEM/1is4=; b=OwgiWpXEtDspKCprpMyhUCSCS0V3GNTK69i7eQZsUgMiD1fJ9gKlkHpFq/voD/EUU/ a7cJvXiQPg9fdJsLE3PmnQYbsAy//JO/M5l4xNowRHCbxLaeDtJSyo2EvzKKS9ZP6POw qF1Kf7Vny9pvoPLmdU/ZJAQgjLM6/i2MkIEzBbo9m2dgB0SwC9UERLPYyEdCtG7AO94w wn1mzINuMCXW0iZuR4YFlaM/tmx58t4Q+SGjsK3w02NGrGfr0qZLX7OALfyyfRwoPhX1 CU36Ir5v5fTznPuIGIvTC1G/DcJBejxb2X4tSkMRJsui/LisW2ibupzzhNZzECK0tsGl 6iRA== X-Gm-Message-State: APt69E1oLCduJhmdyRz+cZsNKU8iovKBMmJh/l5Fz00Uj0HqTpC0/ILR 0uMC/nActVhVpUZkpulM5F/+y7CR X-Google-Smtp-Source: ADUXVKIErSRZJpTm56x16VnO6IPGCCUM1+P1AF/l8BpumvtAkPL4aLRQfK0w5dFF0U4B8+rOdF37bg== X-Received: by 2002:a62:9513:: with SMTP id p19-v6mr2931133pfd.239.1528400105156; Thu, 07 Jun 2018 12:35:05 -0700 (PDT) From: Sukrit Bhatnagar To: libvir-list@redhat.com Date: Fri, 8 Jun 2018 01:04:28 +0530 Message-Id: <1528400083-6788-7-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.27]); Thu, 07 Jun 2018 19:35:06 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 07 Jun 2018 19:35:06 +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.78 on 10.5.110.27 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v1 06/21] util: eventpoll: 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.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Thu, 07 Jun 2018 19:35:33 +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/vireventpoll.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/util/vireventpoll.c b/src/util/vireventpoll.c index 81ecab4..13d278d 100644 --- a/src/util/vireventpoll.c +++ b/src/util/vireventpoll.c @@ -618,7 +618,7 @@ static void virEventPollCleanupHandles(void) */ int virEventPollRunOnce(void) { - struct pollfd *fds =3D NULL; + VIR_AUTOFREE(struct pollfd *) fds =3D NULL; int ret, timeout, nfds; =20 virMutexLock(&eventLoop.lock); @@ -645,7 +645,7 @@ int virEventPollRunOnce(void) goto retry; virReportSystemError(errno, "%s", _("Unable to poll on file handles")); - goto error_unlocked; + return -1; } EVENT_DEBUG("Poll got %d event(s)", ret); =20 @@ -662,13 +662,10 @@ int virEventPollRunOnce(void) =20 eventLoop.running =3D 0; virMutexUnlock(&eventLoop.lock); - VIR_FREE(fds); return 0; =20 error: virMutexUnlock(&eventLoop.lock); - error_unlocked: - VIR_FREE(fds); return -1; } =20 --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list