From nobody Sun Feb 8 19:59:58 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 1532175097906316.4856673289112; Sat, 21 Jul 2018 05:11:37 -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 B67CE356DC; Sat, 21 Jul 2018 12:11:36 +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 7BFA516EFE; Sat, 21 Jul 2018 12:11:35 +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 2FFE94EE12; Sat, 21 Jul 2018 12:11:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6LC8Mja016424 for ; Sat, 21 Jul 2018 08:08:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id CF318CC105; Sat, 21 Jul 2018 12:08:22 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C8121C4A64 for ; Sat, 21 Jul 2018 12:08:22 +0000 (UTC) Received: from mail-pl0-f44.google.com (mail-pl0-f44.google.com [209.85.160.44]) (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 1481285A02 for ; Sat, 21 Jul 2018 12:08:12 +0000 (UTC) Received: by mail-pl0-f44.google.com with SMTP id 94-v6so6300009ple.12 for ; Sat, 21 Jul 2018 05:08:12 -0700 (PDT) Received: from centos.localdomain ([42.106.1.69]) by smtp.gmail.com with ESMTPSA id s16-v6sm5861694pfm.114.2018.07.21.05.08.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 21 Jul 2018 05:08:10 -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=IeWcnShwSf4Q5+CZOnFvEVy4YuGOGea+GiGRzmsmPog=; b=UMhTSKwsThHzWOwRAW9KAPkx/lzylA8VqmiZCv4NnxqIKBu/w5vYa1SKk5r3vx7dgk NDKK6cE1K6KxyhzZkW/idvjOP39khhWzNoHS0mo+zo/KbAwlPtmdifVI6tK1lhDPoT7V Wh4A8D+h4PbaQRtm+xQMSYvyemlAWmVvCGdPu3vD+OWkk9spX7t56MjxwCQf/gVVwmSe A+HnzT6hwKa+os3E4F8oLCzi/hX0Ndjw3C5mS6S2TU91XmKGZ9CAaQsHeSiwr6HkAGX/ STpoLFKtLPoU/FZ06TutWArGkksx96hdd6I9at/Z2XwpP/oGdHG23Lg6Ju6rAQzlvmBE WP0Q== 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=IeWcnShwSf4Q5+CZOnFvEVy4YuGOGea+GiGRzmsmPog=; b=pv7Nkm2QVyO8PU8duMqwGjh3a10ltncfLDputxnledBFLeVFFYYVLQK4jc650IZthW //Y4gRShx7bj5RVcrPeUhuWlmW7FLWJoX0SQIu/5CVbmArSJlhTzonDEJJUkikCXWrH5 PAgAwhTKVDEZlkhj/H6nvwjQBUP6BXqHJagZkr6U7dfow1igoDtZFQOUSo+goXjvuRdA ID22o8xxSpPBx28MM7+XrsmqrTetJyj1HrvPUHdH3/LtYSpuf6X2gAeyQriL6OFeCmFX wZ4o6sFLfwfoVWidbRAxcAo6vjy9kG/mg0/AtQEhoS1Fv6opROTxzKBocwfnIO66/g2L ddoA== X-Gm-Message-State: AOUpUlHKVFYfVK+ojjJ8cmHpEZH2caUNUl/AYqiA6Hx4Bn76vr5t2Pbf zI8kNcRqcJ6lVoyYdT9hlZmiFr/S X-Google-Smtp-Source: AAOMgpeIF3IFLBMmGh+28Hkxlcb4IxyMNG/klQBIfPFIo6qrDdM1Fq8sHI+iChvKkJ4v2CrS3JIaHQ== X-Received: by 2002:a17:902:b594:: with SMTP id a20-v6mr5730869pls.140.1532174891320; Sat, 21 Jul 2018 05:08:11 -0700 (PDT) From: Sukrit Bhatnagar To: libvir-list@redhat.com Date: Sat, 21 Jul 2018 17:36:51 +0530 Message-Id: <1532174832-21644-20-git-send-email-skrtbhtngr@gmail.com> In-Reply-To: <1532174832-21644-1-git-send-email-skrtbhtngr@gmail.com> References: <1532174832-21644-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.26]); Sat, 21 Jul 2018 12:08:12 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Sat, 21 Jul 2018 12:08:12 +0000 (UTC) for IP:'209.85.160.44' DOMAIN:'mail-pl0-f44.google.com' HELO:'mail-pl0-f44.google.com' FROM:'skrtbhtngr@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.3 * (DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS, T_DKIM_INVALID) 209.85.160.44 mail-pl0-f44.google.com 209.85.160.44 mail-pl0-f44.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v1 19/40] util: pci: 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.30]); Sat, 21 Jul 2018 12:11:37 +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 variables of type virPCIDevicePtr and virPCIEDeviceInfoPtr are declared using VIR_AUTOPTR, the functions virPCIDeviceFree and virPCIEDeviceInfoFree, respectively, will be run automatically on them when they go out of scope. Signed-off-by: Sukrit Bhatnagar Reviewed-by: Erik Skultety --- src/util/virpci.c | 1 - src/util/virpci.h | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/util/virpci.c b/src/util/virpci.c index 8d02366..a606462 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -39,7 +39,6 @@ =20 #include "dirname.h" #include "virlog.h" -#include "viralloc.h" #include "vircommand.h" #include "virerror.h" #include "virfile.h" diff --git a/src/util/virpci.h b/src/util/virpci.h index 794b7e5..8fc8716 100644 --- a/src/util/virpci.h +++ b/src/util/virpci.h @@ -28,6 +28,7 @@ # include "virmdev.h" # include "virobject.h" # include "virutil.h" +# include "viralloc.h" =20 typedef struct _virPCIDevice virPCIDevice; typedef virPCIDevice *virPCIDevicePtr; @@ -253,4 +254,7 @@ void virPCIEDeviceInfoFree(virPCIEDeviceInfoPtr dev); ssize_t virPCIGetMdevTypes(const char *sysfspath, virMediatedDeviceType ***types); =20 +VIR_DEFINE_AUTOPTR_FUNC(virPCIDevice, virPCIDeviceFree) +VIR_DEFINE_AUTOPTR_FUNC(virPCIEDeviceInfo, virPCIEDeviceInfoFree) + #endif /* __VIR_PCI_H__ */ --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list