From nobody Mon Feb 9 10:28:37 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 1533714230276451.4605105287782; Wed, 8 Aug 2018 00:43:50 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5478A307C94E; Wed, 8 Aug 2018 07:43: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 17A67308BDB5; Wed, 8 Aug 2018 07:43: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 C2E2A264FB; Wed, 8 Aug 2018 07:43:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w787hkdi005681 for ; Wed, 8 Aug 2018 03:43:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0AAA41001F45; Wed, 8 Aug 2018 07:43:46 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0361A1001938 for ; Wed, 8 Aug 2018 07:43:45 +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 071D321BAA for ; Wed, 8 Aug 2018 07:43:45 +0000 (UTC) Received: by mail-pg1-f194.google.com with SMTP id w10-v6so698392pgv.2 for ; Wed, 08 Aug 2018 00:43:44 -0700 (PDT) Received: from centos.localdomain ([42.106.0.165]) by smtp.gmail.com with ESMTPSA id 9-v6sm9617719pfv.53.2018.08.08.00.43.42 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 00:43:43 -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=R5r6wcHsGpqL/nYPPN7eYa0W8JPHi9YDaJqiPvezCX4=; b=XnOLw7eh7L1r1+tRMZtPbtZK/KiPVZKZqS3wEIaObTQZSVNvYOgsSwP17LqbKZEves FIBgXIR/3z98LyhgDT9fV3Pky657CahXWemz42AWIIV+BLFNnKvCkQloj5PYv6FIt2wh pagSX0LmSvy4LgKruWX58myRge0P7FP2jiSHZt06q9ihFN5wuwVj/MmW+USGPAy0wLHY tbjuBAIZle9YeMzR8ROLUpRlwamodJrxwdTsnKxa+a+34F7kQSEta30qYMGJwKRkcO/Z Kpbx+yVe0JZrUZ2KIhSv28PgoFj0Kc0TS1FfP864AwIJcAMJqG0B1q3KrNgjXbDpugn4 9GTw== 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=R5r6wcHsGpqL/nYPPN7eYa0W8JPHi9YDaJqiPvezCX4=; b=aW2ljclqpo+KlDTOwL6YQMqIG+0QUOkLKetGBtcm7axI6DE6bmXM5Gbx8KroZJNPSS iKHgERZSIuLvcwdsgexRAv0j8S6wL5MZFDe7t5TNWNME6IawN0pCl9ZvBtwSMsl1J/RP Rt0WXj0+m2oOrHJM6JG1DPIO6ZMGk/QIEtghQrLAzw6sx/zYYBBqoJQiClUn1TopBh3J myzfz3SJ3HLaC7m7JfnqvCGsnKOXWh3Vf3d4qyQtu4+y0OMp/DLdNOauKyW4/jaPFcVG rySBzZsEchcCr8EmKBcb1PX/iXMBUB8ex7zH/aIq8DzqvxRVmyjTeMZWqTaHM29Yg63t PElg== X-Gm-Message-State: AOUpUlGjcMVN8n4QIeG7iiWurSp2+1287qKdNIceVO5/VNUE4nMWhTbP S5lNt4ZTV9CRb+C6xM+8lfjyy+V8 X-Google-Smtp-Source: AA+uWPxsFbu+50AT+dxc6cSLHEkTb3NNSWehVzTcjEPJ6baCwhqvOUN5n97w5RoF0uzlcda1wX94Uw== X-Received: by 2002:a62:6003:: with SMTP id u3-v6mr1734458pfb.114.1533714224263; Wed, 08 Aug 2018 00:43:44 -0700 (PDT) From: Sukrit Bhatnagar To: libvir-list@redhat.com Date: Mon, 6 Aug 2018 02:13:43 +0530 Message-Id: <1533501842-24503-17-git-send-email-skrtbhtngr@gmail.com> In-Reply-To: <1533501842-24503-1-git-send-email-skrtbhtngr@gmail.com> References: <1533501842-24503-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.30]); Wed, 08 Aug 2018 07:43:45 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 08 Aug 2018 07:43:45 +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: -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.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.30 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 16/35] util: netdevip: 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.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Wed, 08 Aug 2018 07:43:49 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 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 variables of type virNetDevIPAddrPtr and virNetDevIPRoutePtr are declared using VIR_AUTOPTR, the functions virNetDevIPAddrFree and virNetDevIPRouteFree, respectively, will be run automatically on them when they go out of scope. Signed-off-by: Sukrit Bhatnagar --- src/util/virnetdevip.c | 1 - src/util/virnetdevip.h | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/util/virnetdevip.c b/src/util/virnetdevip.c index 7197d07..fdb0b74 100644 --- a/src/util/virnetdevip.c +++ b/src/util/virnetdevip.c @@ -27,7 +27,6 @@ #include "virnetlink.h" #include "virfile.h" #include "virerror.h" -#include "viralloc.h" #include "virlog.h" #include "virstring.h" #include "virutil.h" diff --git a/src/util/virnetdevip.h b/src/util/virnetdevip.h index dfc978d..9cfd27c 100644 --- a/src/util/virnetdevip.h +++ b/src/util/virnetdevip.h @@ -24,6 +24,7 @@ # define __VIR_NETDEVIP_H__ =20 # include "virsocketaddr.h" +# include "viralloc.h" =20 typedef struct _virNetDevIPAddr virNetDevIPAddr; typedef virNetDevIPAddr *virNetDevIPAddrPtr; @@ -98,4 +99,7 @@ void virNetDevIPInfoClear(virNetDevIPInfoPtr ip); int virNetDevIPInfoAddToDev(const char *ifname, virNetDevIPInfo const *ipInfo); =20 +VIR_DEFINE_AUTOPTR_FUNC(virNetDevIPAddr, virNetDevIPAddrFree) +VIR_DEFINE_AUTOPTR_FUNC(virNetDevIPRoute, virNetDevIPRouteFree) + #endif /* __VIR_NETDEVIP_H__ */ --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list