From nobody Sun Feb 8 07:07:38 2026 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 1532806869405930.6903881851043; Sat, 28 Jul 2018 12:41:09 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B429130E6850; Sat, 28 Jul 2018 19:41:07 +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 3E92960930; Sat, 28 Jul 2018 19:41:07 +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 D9D854BB78; Sat, 28 Jul 2018 19:41:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6SJf3Q1020505 for ; Sat, 28 Jul 2018 15:41:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0D1A545B4; Sat, 28 Jul 2018 19:41:03 +0000 (UTC) Received: from mx1.redhat.com (ext-mx16.extmail.prod.ext.phx2.redhat.com [10.5.110.45]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0281989DFA for ; Sat, 28 Jul 2018 19:41:02 +0000 (UTC) Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) (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 247143082A26 for ; Sat, 28 Jul 2018 19:41:02 +0000 (UTC) Received: by mail-pg1-f196.google.com with SMTP id y5-v6so5082724pgv.1 for ; Sat, 28 Jul 2018 12:41:02 -0700 (PDT) Received: from centos.localdomain ([49.32.98.239]) by smtp.gmail.com with ESMTPSA id m26-v6sm20270426pfi.102.2018.07.28.12.40.59 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 28 Jul 2018 12:41:01 -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=0yjDPX/1LjXTUbVaCDH2E8QU/WW55zgVnVxhxVAlGJA=; b=uBJYxrW9+RHtHp3WQaVfqE02XB5sab+V8Z0vTac9OEmBICDwXxELKCyK8wDNIUK7Cg j1aaxFwzlM8SajpIRnouRfRj2kQpAJisFfHWCGp4DKBZojoT9ZFj3lOuDRdP52+ZOwGO TxCXYUIeD77WuEeWBR5AeXibh49qG8cx2WdY9x+WC8P1gCZeHNv7jKiwF0zftF9AZcDA 6G3quKn6k1iXcYetjxAEILIqAlSMf8XV3V5mYHONP4v7ei6wtBBoLNJacpItqWbGUHsr fasGA1rm087wI1orQtaMbrdWys78IcxtaDYe4wzqJJY7bZ9iyUICIB3Il7qX8xzE1erU xIWw== 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=0yjDPX/1LjXTUbVaCDH2E8QU/WW55zgVnVxhxVAlGJA=; b=lrj4eeCtSFFkl5X8l2YM2m4U6Roc/km3c1uot8VBbyaBw4oyS1il4CXmiWPTP/qtP5 nzxsc/apcIIax8Tx8niiKG6yoD4CQK/GKQGSmAiSqTFzM0m4jZrq5NhPMVh2wcuWEbND 4jM5iATEx3K2SrX6+cmTcBnPWqLSeGo+Je/K2X0XWEHtvJxsCU8lCaDAvcYcHiwlLziO OyJL2vI7UNN0Nz48qidPSXnmlUwvcyUpu9hL11S8eMXb8+6dgYgKiQG+jW0Np8cNdBQJ dfVtktYkCR+1Un0guTI6CqaZ4GBx3t2aBNY+mKmp0WMahcoRb67IMRyKYoxjM/xvyLhJ dzzw== X-Gm-Message-State: AOUpUlEjlY79pLNFfBRb6CiILrX/BIw7vplG8UBm/bii+ieoXlpiwqcE J89/NCYn2eyw1tO2Z6llkx8BTmDW X-Google-Smtp-Source: AAOMgpdmMBn9jItW/qfyCoWOdWCVHJgOc9lzNx8xxF/o2qFq+FB9JeuqfsyfNnuveGvZGU0lHTn/rA== X-Received: by 2002:a62:a3d1:: with SMTP id q78-v6mr11629207pfl.5.1532806861445; Sat, 28 Jul 2018 12:41:01 -0700 (PDT) From: Sukrit Bhatnagar To: libvir-list@redhat.com Date: Sat, 28 Jul 2018 23:31:29 +0530 Message-Id: <1532800907-29115-15-git-send-email-skrtbhtngr@gmail.com> In-Reply-To: <1532800907-29115-1-git-send-email-skrtbhtngr@gmail.com> References: <1532800907-29115-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.45]); Sat, 28 Jul 2018 19:41:02 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Sat, 28 Jul 2018 19:41:02 +0000 (UTC) for IP:'209.85.215.196' DOMAIN:'mail-pg1-f196.google.com' HELO:'mail-pg1-f196.google.com' FROM:'skrtbhtngr@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.13 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 209.85.215.196 mail-pg1-f196.google.com 209.85.215.196 mail-pg1-f196.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.45 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v1 14/32] util: netdevmacvlan: 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Sat, 28 Jul 2018 19:41:08 +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 virNetlinkCallbackDataPtr is declared using VIR_AUTOPTR, the function virNetlinkCallbackDataFree will be run automatically on it when it goes out of scope. This commit also adds an intermediate typedef for virNetlinkCallbackData type for use with the cleanup macros. Signed-off-by: Sukrit Bhatnagar --- src/util/virnetdevmacvlan.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c index fb41bf9..91c6244 100644 --- a/src/util/virnetdevmacvlan.c +++ b/src/util/virnetdevmacvlan.c @@ -576,7 +576,7 @@ static const uint32_t modeMap[VIR_NETDEV_MACVLAN_MODE_L= AST] =3D { }; =20 /* Struct to hold the state and configuration of a 802.1qbg port */ -struct virNetlinkCallbackData { +struct _virNetlinkCallbackData { char *cr_ifname; virNetDevVPortProfilePtr virtPortProfile; virMacAddr macaddress; @@ -587,7 +587,8 @@ struct virNetlinkCallbackData { unsigned int linkState; }; =20 -typedef struct virNetlinkCallbackData *virNetlinkCallbackDataPtr; +typedef struct _virNetlinkCallbackData virNetlinkCallbackData; +typedef virNetlinkCallbackData *virNetlinkCallbackDataPtr; =20 # define INSTANCE_STRLEN 36 =20 @@ -870,6 +871,8 @@ virNetlinkCallbackDataFree(virNetlinkCallbackDataPtr ca= lld) VIR_FREE(calld); } =20 +VIR_DEFINE_AUTOPTR_FUNC(virNetlinkCallbackData, virNetlinkCallbackDataFree) + /** * virNetDevMacVLanVPortProfileDestroyCallback: * --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list