From nobody Tue Feb 10 01:20:01 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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=1622450191; cv=none; d=zohomail.com; s=zohoarc; b=mEXtR4PsBCxOkg6chEyBKGcofTmzGOJ2+GG2onElLpB0wLkCF7XP7wnyW0egiZW0ZROJS2JHjfVoGY6vi/gFZbzWd2mklauWPEDqMkdrfJSKZR8FrRW2zh3dNF3s95y6WX8QLxKOwDn4wemM+97tHGu8A7bn6ZYXuFsN7lPy15o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622450191; h=Content-Type:Content-Transfer-Encoding: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=2GSPrOMKR7h3GG2QZjiVyPAtDXoD7vsDUHsjPStzIko=; b=DfWt5REDEz0B7XqQfl4HXyfJzDQz6w8Ysxbh2Wz9wikXrIhgp5M4klXq4TB8wzkgoPR2vPhOOvIRPdHxA3TQubAjFGbO3R3PI3thoBKseukAPB0csxMi2f4DjDtVdafir8Kjd9B5Cktyvpc4XqTv7LfVjjtoeXXw5NC7uDt4nQ8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1622450191735887.2755544999053; Mon, 31 May 2021 01:36:31 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-162-VsIvJnBBNzWAvncdjS4_Ww-1; Mon, 31 May 2021 04:36:27 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3816D19251B0; Mon, 31 May 2021 08:36:23 +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 DCF0C2BE74; Mon, 31 May 2021 08:36:22 +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 C5F061800BBE; Mon, 31 May 2021 08:36:20 +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 14V8aIbg007438 for ; Mon, 31 May 2021 04:36:18 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0D3C06A04D; Mon, 31 May 2021 08:36:18 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.192.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7756A687EE for ; Mon, 31 May 2021 08:36:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622450190; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=2GSPrOMKR7h3GG2QZjiVyPAtDXoD7vsDUHsjPStzIko=; b=UIqrtTksHgB9uSS+TrXEyVKDP6zAFdu/ugJopaQ0g7/mAV5WRpNatYSu5/PU8tWpwkKfn4 KhOoIZlLGbF5nmQZoYHnZgOi53RB4Y+nSVSaEvS/7tAonTEsj17ymQPhK0zsjU4ZXnUZLe CfFp1kzTfksCJncc5sIIaBgfG9F2Vx0= X-MC-Unique: VsIvJnBBNzWAvncdjS4_Ww-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v1 01/10] tests: glib-ify vircaps2xmltest Date: Mon, 31 May 2021 10:36:02 +0200 Message-Id: <37b4b70b07ac7b5da3e2bc46c9f2b4e586012ffc.1622449288.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Ideally, turning pointers into g_auto* would be done in one step and dropping cleanup label and unused @ret variable in second step, but since this is a test we don't care that much, do we? Signed-off-by: Michal Privoznik --- tests/vircaps2xmltest.c | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/tests/vircaps2xmltest.c b/tests/vircaps2xmltest.c index 5b1b60124a..1e6c113c77 100644 --- a/tests/vircaps2xmltest.c +++ b/tests/vircaps2xmltest.c @@ -38,12 +38,11 @@ test_virCapabilities(const void *opaque) { struct virCapabilitiesData *data =3D (struct virCapabilitiesData *) op= aque; const char *archStr =3D virArchToString(data->arch); - virCaps *caps =3D NULL; - char *capsXML =3D NULL; - char *path =3D NULL; - char *system =3D NULL; - char *resctrl =3D NULL; - int ret =3D -1; + g_autoptr(virCaps) caps =3D NULL; + g_autofree char *capsXML =3D NULL; + g_autofree char *path =3D NULL; + g_autofree char *system =3D NULL; + g_autofree char *resctrl =3D NULL; =20 system =3D g_strdup_printf("%s/vircaps2xmldata/linux-%s/system", abs_s= rcdir, data->filename); @@ -56,34 +55,26 @@ test_virCapabilities(const void *opaque) caps =3D virCapabilitiesNew(data->arch, data->offlineMigrate, data->li= veMigrate); =20 if (!caps) - goto cleanup; + return -1; =20 if (!(caps->host.numa =3D virCapabilitiesHostNUMANewHost())) - goto cleanup; + return -1; =20 if (virCapabilitiesInitCaches(caps) < 0) - goto cleanup; + return -1; =20 virFileWrapperClearPrefixes(); =20 if (!(capsXML =3D virCapabilitiesFormatXML(caps))) - goto cleanup; + return -1; =20 path =3D g_strdup_printf("%s/vircaps2xmldata/vircaps-%s-%s.xml", abs_s= rcdir, archStr, data->filename); =20 if (virTestCompareToFile(capsXML, path) < 0) - goto cleanup; + return -1; =20 - ret =3D 0; - - cleanup: - VIR_FREE(system); - VIR_FREE(resctrl); - VIR_FREE(path); - VIR_FREE(capsXML); - virObjectUnref(caps); - return ret; + return 0; } =20 static int --=20 2.31.1