From nobody Tue May 13 11:12:39 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 1532639120996507.07595053182797; Thu, 26 Jul 2018 14:05:20 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C21F130832E4; Thu, 26 Jul 2018 21:05:18 +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 8ECB06017C; Thu, 26 Jul 2018 21:05:18 +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 438AE4A46C; Thu, 26 Jul 2018 21:05:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6QL5BFN024796 for ; Thu, 26 Jul 2018 17:05:11 -0400 Received: by smtp.corp.redhat.com (Postfix) id 42859308BDB4; Thu, 26 Jul 2018 21:05:11 +0000 (UTC) Received: from mx1.redhat.com (ext-mx04.extmail.prod.ext.phx2.redhat.com [10.5.110.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 38B60308BDB3 for ; Thu, 26 Jul 2018 21:05:06 +0000 (UTC) Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) (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 24A458110D for ; Thu, 26 Jul 2018 21:05:06 +0000 (UTC) Received: by mail-pg1-f171.google.com with SMTP id e6-v6so1889526pgv.2 for ; Thu, 26 Jul 2018 14:05:06 -0700 (PDT) Received: from centos.localdomain ([42.106.3.93]) by smtp.gmail.com with ESMTPSA id z10-v6sm3279182pfh.83.2018.07.26.14.05.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Jul 2018 14:05: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=gQpeXyarUnvv1wyrubwLo5J6jMNlul0S+cm54M5G3kc=; b=A8kF6eYxXksYkzLgnnVZZxkEXZGsPjXaK0Z8N1Aw7oCYiuaF9RoR5YV+zyIQA5hHtb q6LR+n7dQ3wXYHKy3hsjL/BV7Ykw/FtypRi3NCHE65WU86vPdWDki/vWAnWXNyYepdvQ z78/JQsIW2IfLJ1yNOGc3aLwQ1wyK//jAtSDn9Ok4Nbi/Mxsm99J1jBQt1sfKBTuDdEW QNXD+JbUNMK0wtCNIZ3+SV+Fd3Di2mehmDMvwyL33Jcpp5o2WBLlPidTQp6oB6YXA2Nq 2SVui8OdtvGYHp6f0tRa5a/YFSp6hJocKVuz5kuiwKls0X6CZdlo1EazGbGe9u/vZuM5 MGdw== 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=gQpeXyarUnvv1wyrubwLo5J6jMNlul0S+cm54M5G3kc=; b=ZP3lR1w2ozPu9dKN4KjZMTMSgkDRyMvgBZ3+ZPYf7pdB/o+RnoDv+b3TQwcR/U9PQa 7DdbVNhbAtnUKZSSducvJ+eTVBh5moRKzjrdkhL8s9d3VXmrinKqoOVhW+x21tKMb1Zl CXp0pYJyIM4PJnWay1Zio/nM3WvChd7CiEg7p86rx3/+v5SBKiI0kwrmdGfheordmhyV F/0FjzKBPNjZ6q03u1yLddn8x4sc1Y0K9YGWiKEvw+LrptHtTy9H2vCJ4Y1wriEuJ2BC aN3dYMz4yCeDY9hUYUlhtXl2NIM5EfxShPVNuMYkBmfS98H/X11EPoGE4XOrt1zKsz2e bPSw== X-Gm-Message-State: AOUpUlGcsxNoy4OeMpauqkBIeZGwk2oUx/ew68Ufd1I5YzboXgH4B34Y 23g2AKP8liSVLJBc3S8iXO7boxoj X-Google-Smtp-Source: AAOMgpcnJgTSCQv4OF2x2wERbW51MEtFx3oacdt5bizwxILwyWnuMhIeeSKc7fmTgqerbP97jJJPMQ== X-Received: by 2002:a63:920c:: with SMTP id o12-v6mr3391424pgd.141.1532639105382; Thu, 26 Jul 2018 14:05:05 -0700 (PDT) From: Sukrit Bhatnagar To: libvir-list@redhat.com Date: Tue, 24 Jul 2018 21:22:15 +0530 Message-Id: <1532447562-24010-15-git-send-email-skrtbhtngr@gmail.com> In-Reply-To: <1532447562-24010-1-git-send-email-skrtbhtngr@gmail.com> References: <1532447562-24010-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.28]); Thu, 26 Jul 2018 21:05:06 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 26 Jul 2018 21:05:06 +0000 (UTC) for IP:'209.85.215.171' DOMAIN:'mail-pg1-f171.google.com' HELO:'mail-pg1-f171.google.com' FROM:'skrtbhtngr@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.389 * (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, RCVD_IN_SORBS_WEB, SPF_PASS) 209.85.215.171 mail-pg1-f171.google.com 209.85.215.171 mail-pg1-f171.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.28 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 14/41] util: firewall: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Thu, 26 Jul 2018 21:05:19 +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" Using the new VIR_DEFINE_AUTOPTR_FUNC macro defined in src/util/viralloc.h, define a new wrapper around an existing cleanup function which will be called when a variable declared with VIR_AUTOPTR macro goes out of scope. Also, drop the redundant viralloc.h include, since that has moved from the source module into the header. When a variable of type virFirewallPtr is declared using VIR_AUTOPTR, the function virFirewallFree will be run automatically on it when it goes out of scope. Signed-off-by: Sukrit Bhatnagar Reviewed-by: Erik Skultety --- src/util/virfirewall.c | 1 - src/util/virfirewall.h | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/util/virfirewall.c b/src/util/virfirewall.c index 10c370a..dfd792f 100644 --- a/src/util/virfirewall.c +++ b/src/util/virfirewall.c @@ -27,7 +27,6 @@ =20 #include =20 -#include "viralloc.h" #include "virfirewallpriv.h" #include "virerror.h" #include "virutil.h" diff --git a/src/util/virfirewall.h b/src/util/virfirewall.h index b04ab48..e024e88 100644 --- a/src/util/virfirewall.h +++ b/src/util/virfirewall.h @@ -25,6 +25,7 @@ # define __VIR_FIREWALL_H__ =20 # include "internal.h" +# include "viralloc.h" =20 typedef struct _virFirewall virFirewall; typedef virFirewall *virFirewallPtr; @@ -116,4 +117,6 @@ int virFirewallApply(virFirewallPtr firewall); =20 void virFirewallSetLockOverride(bool avoid); =20 +VIR_DEFINE_AUTOPTR_FUNC(virFirewall, virFirewallFree) + #endif /* __VIR_FIREWALL_H__ */ --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list