From nobody Tue May 13 18:37:27 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 1530481550676283.18148057866415; Sun, 1 Jul 2018 14:45:50 -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 2B677804E9; Sun, 1 Jul 2018 21:45:49 +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 D8C5560BE7; Sun, 1 Jul 2018 21:45:48 +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 8D5041800CAF; Sun, 1 Jul 2018 21:45:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w61LjYGB009690 for ; Sun, 1 Jul 2018 17:45:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id D2DAF6090A; Sun, 1 Jul 2018 21:45:34 +0000 (UTC) Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C881560851 for ; Sun, 1 Jul 2018 21:45:34 +0000 (UTC) Received: from mail-pl0-f50.google.com (mail-pl0-f50.google.com [209.85.160.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 A17155F740 for ; Sun, 1 Jul 2018 21:45:23 +0000 (UTC) Received: by mail-pl0-f50.google.com with SMTP id t6-v6so6949056plo.7 for ; Sun, 01 Jul 2018 14:45:23 -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.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 01 Jul 2018 14:45:22 -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=m3/gUvx0MnHb7L72ql0Ea3uygNixqYb3QCGyn8SKFl0=; b=vWVYvUgs3mOd6oEzwr+W6JBkAwModOMeTpgTxnH9K6bZkWnsGjBDMOhZi9z4YaUz/y dU23e1yjx2hL5hMbVuNwEIeRgKKKmZS9+7pEz9i5WzXXROE2l9MxO8TpUGl1ps3Mr4Ku 1mLSDyAUhIpZIB3bX32m+9iDPBqBW/CNi0SoTbmr8ZDWS3TUSDxzHjunpWxIUxnvvtCW GAG6x3N8uVEtgIscJAeIoxwahIKFHmBxsU+dW+F/47wQuHwgXnltlGwQ2paydwpcRAkp YFABtyFCcSeRvHyVcIoN9a2tQyOQK9sJBPVAha6aPkJhLH4gdgivhzTHTg7sljK11MMS 5H6g== 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=m3/gUvx0MnHb7L72ql0Ea3uygNixqYb3QCGyn8SKFl0=; b=BJfmkzSsInlExNtz/nJAr5ui4tTpW6gCt7DGJzrUuqXSh/aOmYyGAcnu/AHcemVQ3l 2L+MVbJ69bDo867jYBc3yhk5mdoBy7jr42hUVoKdPn2SjcSSoanNDUFObKIc7Vdi+W7h riwTzXHkpCLgASPcDODbeOEoc4xXGLZA4rOBN95G+bMtca0c/sF2EqsWZz1ogQnpeEz+ 39JOD280uY1t11FKelzg8uYgzxHim8PVnkXCKbt6aUM2HuUF0oGBHnDRrSB31WgP8vHp TvIDJjvd/wXwaZyzBXQBuqIPnsrp6J5xmJEXvzQo02D8DuoiMQwpQcZ6AZetXg3SjEZs 97VQ== X-Gm-Message-State: APt69E1Gmxbj4IwGnT3r8pC8wB7aN7XpLjjvWobeuixeqo1xoElFQghu TI9QHVdQMtpJwCrl0a1emkpOiOFN X-Google-Smtp-Source: AAOMgpe1v1JcBAy7qLx1Yy1kY1WmhbGDM+JkDUgzTyG+ptzT02IIZhGA43chUbLIK1/oGEjGbTrpBw== X-Received: by 2002:a17:902:528a:: with SMTP id a10-v6mr15213934pli.73.1530481522944; Sun, 01 Jul 2018 14:45:22 -0700 (PDT) From: Sukrit Bhatnagar To: libvir-list@redhat.com Date: Sat, 30 Jun 2018 14:30:37 +0530 Message-Id: <1530349239-22049-34-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.39]); Sun, 01 Jul 2018 21:45:23 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Sun, 01 Jul 2018 21:45:23 +0000 (UTC) for IP:'209.85.160.50' DOMAIN:'mail-pl0-f50.google.com' HELO:'mail-pl0-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) 209.85.160.50 mail-pl0-f50.google.com 209.85.160.50 mail-pl0-f50.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.39 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v3 33/35] 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Sun, 01 Jul 2018 21:45:50 +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 --- 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