From nobody Fri May 16 00:14:15 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; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1500903632424130.73959829625505; Mon, 24 Jul 2017 06:40:32 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8C8688125F; Mon, 24 Jul 2017 13:40:29 +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 5A7C16933D; Mon, 24 Jul 2017 13:40:29 +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 F3C9D180B467; Mon, 24 Jul 2017 13:40:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v6ODd9cs001755 for ; Mon, 24 Jul 2017 09:39:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 133D54DA74; Mon, 24 Jul 2017 13:39:09 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.41]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8E48B17AF7 for ; Mon, 24 Jul 2017 13:39:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8C8688125F Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 8C8688125F From: Pavel Hrdina To: libvir-list@redhat.com Date: Mon, 24 Jul 2017 15:38:55 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 2/9] util: move and rename virDomainsFreep 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 24 Jul 2017 13:40:30 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Move it to the same place as virDomainFreep(). Signed-off-by: Pavel Hrdina --- src/manager.c | 18 ++---------------- src/util.h | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/manager.c b/src/manager.c index 6459ec9..0cf0f8e 100644 --- a/src/manager.c +++ b/src/manager.c @@ -12,20 +12,6 @@ struct VirtManager { int callback_ids[VIR_DOMAIN_EVENT_ID_LAST]; }; =20 -static void -virDomainsFreep(virDomainPtr **domainsp) -{ - virDomainPtr *domains =3D *domainsp; - - if (!domains) - return; - - for (int i =3D 0; domains[i] !=3D NULL; i +=3D 1) - virDomainFree(domains[i]); - - free(domains); -} - static int domain_get_name(sd_bus *bus, const char *path, @@ -504,7 +490,7 @@ enumerate_domains(sd_bus *bus, sd_bus_error *error) { VirtManager *manager =3D userdata; - _cleanup_(virDomainsFreep) virDomainPtr *domains =3D NULL; + _cleanup_(virDomainListFreep) virDomainPtr *domains =3D NULL; _cleanup_(strv_freep) char **paths =3D NULL; int n_domains; =20 @@ -530,7 +516,7 @@ virt_manager_list_domains(sd_bus_message *message, { VirtManager *manager =3D userdata; _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply =3D NULL; - _cleanup_(virDomainsFreep) virDomainPtr *domains =3D NULL; + _cleanup_(virDomainListFreep) virDomainPtr *domains =3D NULL; uint32_t flags; int r; =20 diff --git a/src/util.h b/src/util.h index 91e35d6..bc39f44 100644 --- a/src/util.h +++ b/src/util.h @@ -53,3 +53,17 @@ virDomainFreep(virDomainPtr *domainp) if (*domainp) virDomainFree(*domainp); } + +static inline void +virDomainListFreep(virDomainPtr **domainsp) +{ + virDomainPtr *domains =3D *domainsp; + + if (!domains) + return; + + for (int i =3D 0; domains[i] !=3D NULL; i +=3D 1) + virDomainFree(domains[i]); + + free(domains); +} --=20 2.13.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list