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 1532639198086608.3081038318; Thu, 26 Jul 2018 14:06:38 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5A22282DF; Thu, 26 Jul 2018 21:06:18 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 09933CE6BD; Thu, 26 Jul 2018 21:06: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 8317C1800541; Thu, 26 Jul 2018 21:06:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6QL5X8s024943 for ; Thu, 26 Jul 2018 17:05:33 -0400 Received: by smtp.corp.redhat.com (Postfix) id 69E536090E; Thu, 26 Jul 2018 21:05:33 +0000 (UTC) Received: from mx1.redhat.com (ext-mx13.extmail.prod.ext.phx2.redhat.com [10.5.110.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5F879608F8 for ; Thu, 26 Jul 2018 21:05:24 +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 6BDE73082140 for ; Thu, 26 Jul 2018 21:05:23 +0000 (UTC) Received: by mail-pl0-f44.google.com with SMTP id s17-v6so1342634plp.7 for ; Thu, 26 Jul 2018 14:05:23 -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.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Jul 2018 14:05:22 -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=MJhjAJtaqxhy9cdPxQBtHL0ZBDPLkbQaCYeCkb7AwNA=; b=px/BAFp4z0P4P1bm1H776Nf9TLhQJaTQsDczSHZFejDsFGHB+Dl6Ho3HOLyosb133m SBljgzPxNM1hr4nFUpdSwWh8oRrbtKmTm3ZSeb+/4Db5aMR8N5fK0XXVBNGx9qQ4h9jR c7ER2l7szRe1S8a9cpxI0qCqexBi4vUPGZhXtiJ2M35MMdj7fSUlTw/MNl8tuGSlSiH6 ICT3HF/X0IpalHCDFut+xgHB8iIofP7sBBZfiKxF2IUUOAixuSW0e89Ak3guQmD5m8Tg i3+iuSUOpCZoQL93/sgxFmpS1JqZAmeJMKkwglYwfeXyP3PhdjSPbnTtLmRjkLXGp6+E R02A== 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=MJhjAJtaqxhy9cdPxQBtHL0ZBDPLkbQaCYeCkb7AwNA=; b=gsqecOWMrIq8drHlQq4sx/76yGQer4l2QRDYsJK/F1GhIzET/FpirxTCe2XRfO670x CKrxWM8tSTvS6TFHkyaABF27BbkBc4kbfZXWnzGGZ4Of2ZsSfqxOr1f+c4C4+4E8jZzO Yt330Jq68Qe4+g4l8JceQ0O4+NstPgdVflVyRyfnbPBBzEP9JN/xrMOOarn/YEPdvquC WekUdWMVYAubRntdEmpulhTnYdrht71PDpVk/U/4UeAh/lwbNUgr54qV30p6tLsgPTgw EFhiP/GUhYB2D8OuRlqeiqZQwoIALpAQ7qCoCT1Wgdm9+jZvcHvd3ShjjkeOexdsyn/6 tOIQ== X-Gm-Message-State: AOUpUlFtDzGOaQ2VNoAkMbkv5MvRERj3hbKlUNpfhUv8XSwLBWkfI5vO W4PdFqKSJKnMfpHerkslKJDQHKvZ X-Google-Smtp-Source: AAOMgpeds3s0S3KDc9ZbtLyQh5aV2xFw/CmLUTrRHrtP/aFwSKbno1T2OUKTjeC5EDO0+RW0fpDi7A== X-Received: by 2002:a17:902:3081:: with SMTP id v1-v6mr3451193plb.266.1532639122676; Thu, 26 Jul 2018 14:05:22 -0700 (PDT) From: Sukrit Bhatnagar To: libvir-list@redhat.com Date: Tue, 24 Jul 2018 21:22:24 +0530 Message-Id: <1532447562-24010-24-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.42]); Thu, 26 Jul 2018 21:05:23 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Thu, 26 Jul 2018 21:05:23 +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.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.160.44 mail-pl0-f44.google.com 209.85.160.44 mail-pl0-f44.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.42 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 23/41] util: usb: 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.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 26 Jul 2018 21:06:36 +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 virUSBDevicePtr is declared using VIR_AUTOPTR, the function virUSBDeviceFree will be run automatically on it when it goes out of scope. Signed-off-by: Sukrit Bhatnagar Reviewed-by: Erik Skultety --- src/util/virusb.c | 1 - src/util/virusb.h | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/util/virusb.c b/src/util/virusb.c index 7818232..90f947b 100644 --- a/src/util/virusb.c +++ b/src/util/virusb.c @@ -35,7 +35,6 @@ =20 #include "virusb.h" #include "virlog.h" -#include "viralloc.h" #include "virutil.h" #include "virerror.h" #include "virfile.h" diff --git a/src/util/virusb.h b/src/util/virusb.h index 078dee6..afaaf95 100644 --- a/src/util/virusb.h +++ b/src/util/virusb.h @@ -27,6 +27,7 @@ =20 # include "internal.h" # include "virobject.h" +# include "viralloc.h" =20 # define USB_DEVFS "/dev/bus/usb/" =20 @@ -99,4 +100,6 @@ void virUSBDeviceListDel(virUSBDeviceListPtr list, virUSBDevicePtr virUSBDeviceListFind(virUSBDeviceListPtr list, virUSBDevicePtr dev); =20 +VIR_DEFINE_AUTOPTR_FUNC(virUSBDevice, virUSBDeviceFree) + #endif /* __VIR_USB_H__ */ --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list