From nobody Tue May 13 11:12:41 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 153263915882476.33414408926728; Thu, 26 Jul 2018 14:05:58 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D37E030E6856; Thu, 26 Jul 2018 21:05:55 +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 85A2816D3A; Thu, 26 Jul 2018 21:05:55 +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 1D3D624F5E; Thu, 26 Jul 2018 21:05:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6QL5q4H025059 for ; Thu, 26 Jul 2018 17:05:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 83FDC5D755; Thu, 26 Jul 2018 21:05:52 +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 77C735D6A5 for ; Thu, 26 Jul 2018 21:05:40 +0000 (UTC) Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.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 1B46E81119 for ; Thu, 26 Jul 2018 21:05:39 +0000 (UTC) Received: by mail-pg1-f194.google.com with SMTP id r5-v6so1894796pgv.0 for ; Thu, 26 Jul 2018 14:05:39 -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.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Jul 2018 14:05:37 -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=+wOLMSEb4wEI0LTnrPku6qwyAHW6O4Wf8TkqXX7wG2k=; b=sDQPpbqWjJEprygIy+u5ZYNxcIPCua0wqgC7CcOiBcuK3QUVewxt6UEdBarl7erxnm HMkM4+/hqIoSzU1jGnhQaiZg1x49R52bGCKneJGiv1arL5av1XJJSnx1/3S71ePMxUMb FYS6PCYo4VB0IRNxKIwVnxFk0P6tunjGxaxiU9FDRZhXIP/jr7k6+CwEqMUD7hvh6k14 wdQnQpNBKofir/S77YLLkyjO6cyL7UO7SiYeWtseEZ3n5CaUizLz73HbBX9PGgShEedV 0+6bwH9G8Wwzgy+xLSrLfQeoiEYmHWy76jg9ZP4Q6AaK5p05M34yXDn6rn471+2mmdGy Pl8Q== 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=+wOLMSEb4wEI0LTnrPku6qwyAHW6O4Wf8TkqXX7wG2k=; b=AXaOUd/9YMV67LVa+tdo4oFjvm8fIaBsbNUOUF846eTVEK2lJwXfz20f3wH1R8tucx IjvDKhrmF9hxAsQ4GjHozdRb0NJxbH3bTqhVI2Oy7BwQ9ateqMypPqya1aD6Li6cQ408 ZHQQU5NZbtt5Ib94q3/hbtgA2yhJYRlvcwenr8YO7BfxXJ4MHqNGHsty+G3IcOQMvJ45 KLdpR7ogLAdsCaIvY0+jrTOMpz6sjP7lLz+u+T+DxhBJ4mHzkgSp4xeApW6sq08Yc2PI SrbCz6FnBpIGCC8I2ZmM52uMOuMq/2guqtvycxITKuIsymuVRpkUYKMevlbW1UgoW+hj Idow== X-Gm-Message-State: AOUpUlFCfJTqN70VCrDD2zySNo/RGzqCkPN9lQY3QkAZNkr1bpKhRFrR XRQdEbRXGTPuZVO8+VQKOHgqswhr X-Google-Smtp-Source: AAOMgpfiHmLdEX84WgY2VqftA5VTRWP+DibuKyDy9TxIAyqLvTxDp6jKGQ0c8sdOf+6mfODI3EkIuQ== X-Received: by 2002:a62:ee06:: with SMTP id e6-v6mr3703008pfi.2.1532639138390; Thu, 26 Jul 2018 14:05:38 -0700 (PDT) From: Sukrit Bhatnagar To: libvir-list@redhat.com Date: Tue, 24 Jul 2018 21:22:32 +0530 Message-Id: <1532447562-24010-32-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:39 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 26 Jul 2018 21:05:39 +0000 (UTC) for IP:'209.85.215.194' DOMAIN:'mail-pg1-f194.google.com' HELO:'mail-pg1-f194.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.194 mail-pg1-f194.google.com 209.85.215.194 mail-pg1-f194.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.28 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 31/41] util: netdevvlan: 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Thu, 26 Jul 2018 21:05:56 +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 virNetDevVlanPtr is declared using VIR_AUTOPTR, the function virNetDevVlanFree will be run automatically on it when it goes out of scope. Signed-off-by: Sukrit Bhatnagar Reviewed-by: Erik Skultety --- src/util/virnetdevvlan.c | 1 - src/util/virnetdevvlan.h | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/util/virnetdevvlan.c b/src/util/virnetdevvlan.c index 4c8bce5..0afc47b 100644 --- a/src/util/virnetdevvlan.c +++ b/src/util/virnetdevvlan.c @@ -24,7 +24,6 @@ #include "internal.h" #include "virerror.h" #include "virnetdevvlan.h" -#include "viralloc.h" =20 #define VIR_FROM_THIS VIR_FROM_NONE =20 diff --git a/src/util/virnetdevvlan.h b/src/util/virnetdevvlan.h index 7f63626..be85f59 100644 --- a/src/util/virnetdevvlan.h +++ b/src/util/virnetdevvlan.h @@ -23,6 +23,8 @@ =20 # include =20 +# include "viralloc.h" + typedef enum { VIR_NATIVE_VLAN_MODE_DEFAULT =3D 0, VIR_NATIVE_VLAN_MODE_TAGGED, @@ -48,4 +50,6 @@ void virNetDevVlanFree(virNetDevVlanPtr vlan); int virNetDevVlanEqual(const virNetDevVlan *a, const virNetDevVlan *b); int virNetDevVlanCopy(virNetDevVlanPtr dst, const virNetDevVlan *src); =20 +VIR_DEFINE_AUTOPTR_FUNC(virNetDevVlan, virNetDevVlanFree) + #endif /* __VIR_NETDEV_VLAN_H__ */ --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list