From nobody Tue Jul 1 05:40:20 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 1531504609530925.3137317511427; Fri, 13 Jul 2018 10:56:49 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2E3BD3E2D4; Fri, 13 Jul 2018 17:56:48 +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 CAE3A5C72C; Fri, 13 Jul 2018 17:56:47 +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 655C824F56; Fri, 13 Jul 2018 17:56:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6DHucB0009097 for ; Fri, 13 Jul 2018 13:56:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5BEE73083326; Fri, 13 Jul 2018 17:56:38 +0000 (UTC) Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 52A303001A5C for ; Fri, 13 Jul 2018 17:56:29 +0000 (UTC) Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) (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 07CAF307CF23 for ; Fri, 13 Jul 2018 17:56:19 +0000 (UTC) Received: by mail-pg1-f170.google.com with SMTP id g2-v6so385431pgs.6 for ; Fri, 13 Jul 2018 10:56:19 -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.16 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Jul 2018 10:56:17 -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=wiKA+BFxfDqLyda7Nx4X2HzAk0MoSA85laoZC1/b9k0=; b=UfIElVOO+xJ/3vxQhWBZ2BI1o9IMfbP9ZY+ziihBmbQ5ALTw/+n7w9Tv/52ftJGOJ4 zE9+063reZurZyjXMul6Aj6y8psu8qFxBYaLz2dj8GCQaES3cnMnUAo9LkwDAeTDwzuN d8wTVHiGyUQZt/PXagWcys2JqDiz9Y1JQfmOoz+qYF9yfcTN4sUFxJkdUttpxo5seRxM FbRTb60ELRdiPUwWqxkozuLs2s4C0KfYJrwAH5uCPJD0GE+ClYgJ9yRvbo7okuC0E6+C jwStnxZJWzp1aXYnT2SoD/TkokXkO2xDQG6YQK+68NRZSRXrHl8A7jE1aJeS5WTk3kit XG4Q== 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=wiKA+BFxfDqLyda7Nx4X2HzAk0MoSA85laoZC1/b9k0=; b=Uin25ASPGxF6cF59EM2RPLMERXWy+4qOZAQnAVa24tq/Ii2KXNj2APHV52AOluyNuG WRpatB5AvCW0PLPOecTMWmwIFFfsupjsqHyfsKaAHHFJTSmJFmDZr7klr36GJds2OMGP ETAD7DQg+8vcgE6DemxO+Gf6hlBaDSt3F1IVi9DwNjnFpBntEJRHbe8astCRCfcB+cNS EaBfjGphsd4GybpgOIORosM0co3LO6+8++bZX49lq+skO780VqNUTIGFfEXnq8rjytkc OcN6IjQVmQzK60YE4UQTkHPtwtyi0DIvJgfnar3v+f+PPGp8JChQenjHCW3rUfqDuPQW 9GeA== X-Gm-Message-State: AOUpUlFbyap+YecciQ+OL8JpUQePcvae5ngS+P7PNM6gC3WQZaxBRADe DubiI6/unEZw4gk10eFWPanGKtOP X-Google-Smtp-Source: AAOMgpfF55WEZWEzpdS5jJwiNtzsTcnV2W/8QxnaNRZG5gj30MxutO+EDg/Lr6YQjTmsPO5z8xfH6Q== X-Received: by 2002:a63:e914:: with SMTP id i20-v6mr7000094pgh.10.1531504578303; Fri, 13 Jul 2018 10:56:18 -0700 (PDT) From: Sukrit Bhatnagar To: libvir-list@redhat.com Date: Fri, 13 Jul 2018 23:25:07 +0530 Message-Id: <1531504509-7930-30-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.44]); Fri, 13 Jul 2018 17:56:19 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Fri, 13 Jul 2018 17:56:19 +0000 (UTC) for IP:'209.85.215.170' DOMAIN:'mail-pg1-f170.google.com' HELO:'mail-pg1-f170.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.215.170 mail-pg1-f170.google.com 209.85.215.170 mail-pg1-f170.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.44 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 29/31] 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.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Fri, 13 Jul 2018 17:56:48 +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/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