From nobody Sun Feb 8 05:27:16 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; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1570704877; cv=none; d=zoho.com; s=zohoarc; b=iogGMVcXJTpEknB/0K0bDgjk+qWlJBoZJ29qUWrYTvZ5nrHrAp3zmzuILZGgsRBuexnREqRzi9mBOGr6hgrg2lTCJ6bISbzEcwWuYMLbJANkG0c0FFkJscY+WigY9QtKNtimH09A/F/VotiORkjf9HrRm1ZpaVD0iLoY2+aInGc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570704877; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=S1Zr8VOEER8g/6MZ1c11k5gqX3LTXX31a0Jj1FIGnvo=; b=n2Mn3RLrO0uc9pjV6k7xW4fFfBPL3i4qEj+wKqGLOlmw20lt9LQOEb7isfrujUq21OoDkklJTYgmwpdUf8ebwMoPTOXtDqK2GDBIQPBhcCce1piCkfZxlIG9vR07hLFCZlwnngm3njEiwmWYO566Ak0a/2HQO9D4HY0GF3b7Mkw= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 157070487775489.93321496097042; Thu, 10 Oct 2019 03:54:37 -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 3FB933086E23; Thu, 10 Oct 2019 10:54: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 1A03D5C241; Thu, 10 Oct 2019 10:54:36 +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 CC7F64EE69; Thu, 10 Oct 2019 10:54:35 +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 x9AAsMag010368 for ; Thu, 10 Oct 2019 06:54:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id 865095C231; Thu, 10 Oct 2019 10:54:22 +0000 (UTC) Received: from dhcp-16-231.lcy.redhat.com (unknown [10.42.16.231]) by smtp.corp.redhat.com (Postfix) with ESMTP id D6EFE5C1B5; Thu, 10 Oct 2019 10:54:21 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Thu, 10 Oct 2019 11:53:59 +0100 Message-Id: <20191010105413.4091-6-berrange@redhat.com> In-Reply-To: <20191010105413.4091-1-berrange@redhat.com> References: <20191010105413.4091-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?J=C3=A1n=20Tomko?= Subject: [libvirt] [PATCH v3 05/19] util: convert virSystemdActivation to use 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: , Content-Type: text/plain; charset="utf-8" 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.44]); Thu, 10 Oct 2019 10:54:36 +0000 (UTC) Using the standard macro will facilitate the conversion to glib's auto cleanup macros. Reviewed-by: J=C3=A1n Tomko Signed-off-by: Daniel P. Berrang=C3=A9 --- src/util/virsystemd.c | 10 +++++----- src/util/virsystemd.h | 5 +++-- tests/virsystemdtest.c | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c index 2efc0dd72c..c2e4c3df51 100644 --- a/src/util/virsystemd.c +++ b/src/util/virsystemd.c @@ -917,7 +917,7 @@ virSystemdActivationNew(virSystemdActivationMap *map, return act; =20 error: - virSystemdActivationFree(&act); + virSystemdActivationFree(act); return NULL; } =20 @@ -1046,12 +1046,12 @@ virSystemdActivationClaimFDs(virSystemdActivationPt= r act, * associated with the activation object */ void -virSystemdActivationFree(virSystemdActivationPtr *act) +virSystemdActivationFree(virSystemdActivationPtr act) { - if (!*act) + if (!act) return; =20 - virHashFree((*act)->fds); + virHashFree(act->fds); =20 - VIR_FREE(*act); + VIR_FREE(act); } diff --git a/src/util/virsystemd.h b/src/util/virsystemd.h index 5f1a4413fe..2c0a0d8dc0 100644 --- a/src/util/virsystemd.h +++ b/src/util/virsystemd.h @@ -22,6 +22,7 @@ #pragma once =20 #include "internal.h" +#include "virautoclean.h" =20 typedef struct _virSystemdActivation virSystemdActivation; typedef virSystemdActivation *virSystemdActivationPtr; @@ -81,6 +82,6 @@ void virSystemdActivationClaimFDs(virSystemdActivationPtr= act, int **fds, size_t *nfds); =20 -void virSystemdActivationFree(virSystemdActivationPtr *act); +void virSystemdActivationFree(virSystemdActivationPtr act); =20 -#define virSystemdActivationAutoPtrFree virSystemdActivationFree +VIR_DEFINE_AUTOPTR_FUNC(virSystemdActivation, virSystemdActivationFree); diff --git a/tests/virsystemdtest.c b/tests/virsystemdtest.c index 3add1ab56f..d33a7c192f 100644 --- a/tests/virsystemdtest.c +++ b/tests/virsystemdtest.c @@ -650,7 +650,7 @@ testActivationEmpty(const void *opaque ATTRIBUTE_UNUSED) =20 if (act !=3D NULL) { fprintf(stderr, "Unexpectedly got activation object"); - virSystemdActivationFree(&act); + virSystemdActivationFree(act); return -1; } =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list