From nobody Sun Feb 8 19:24:20 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1623333921; cv=none; d=zohomail.com; s=zohoarc; b=TSJRiU/7a6MBy/0WQAhhkgrpd++Stg8t4NkxApZLRU/RoFmQZdoM/kodfxpnO27SvXi8bawwEapwVYge9PVryp1Emw4GrWB9qr4hHaLTKeqVmHUtVucPPs1vPCCrY4rF7n6+JW281MAD/hQ7ryBd7dAYl1wQR+UaoNkFg4OeodM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623333921; 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=xHUcrZx4J7wfLWcnVUqWwK26sqAao+GWML+Iqphardo=; b=n+CJpRP+NP4tdG2+1XU+TM/IshEfHQQm1y7qR7M8SjzA9FyTZMX+RnnBzz/FZT5prT0GTIG3Tc7v3xiYbeNRp2xaVxI0G7J1sHLaP7H+ggjEdNvJTSo+Bc8ZDsWa1I1gy1Rk7XlrPqVTi3PrEpW3nOhljQhulM9lAMCD72kvq0Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1623333921442902.5192697508681; Thu, 10 Jun 2021 07:05:21 -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-223-82CY8oe_NN-zHL0bfuwxuA-1; Thu, 10 Jun 2021 10:03:51 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2A2D41084F4C; Thu, 10 Jun 2021 14:03:45 +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 0607660C04; Thu, 10 Jun 2021 14:03:45 +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 C16D146F5D; Thu, 10 Jun 2021 14:03:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 15ADvQrl005289 for ; Thu, 10 Jun 2021 09:57:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1FB3E19C45; Thu, 10 Jun 2021 13:57:26 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.193.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9743419C46 for ; Thu, 10 Jun 2021 13:57:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623333833; 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=xHUcrZx4J7wfLWcnVUqWwK26sqAao+GWML+Iqphardo=; b=Y8oiDZOGAOhohjqbF/izIGzczIhHRbL10++eWjyHhjhU50UaTlQ37yY+JFvKrUUhgN7GGb bjn9XxsM4fcIvGLr4a5073naW5lWJUH5gRX9ltUJdnKxP/9scn7/AmkXyUYGLCyyL3S3at P9WsK5EEiQWCbOm09Ah5Pnee2+4x7n0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623333920; 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=xHUcrZx4J7wfLWcnVUqWwK26sqAao+GWML+Iqphardo=; b=P84PtvVMBM6WnQ56QWNC+n2AHYRCcsq1GELsl4O8DygM2yHVebmog/JtI0DLCYPFG0jM1P m051M8RfgE22/EyeiYPwbGJ15L9k0oOKHTb8laKYq8ygTFXIEAbCnQx6anEyVUkfF9TCQj b7T9gu2ksBDXIoQQ+2WyD8kkb+U9q0k= X-MC-Unique: 82CY8oe_NN-zHL0bfuwxuA-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v2 01/10] tests: glib-ify vircaps2xmltest Date: Thu, 10 Jun 2021 15:57:10 +0200 Message-Id: <684477689a9f3461b9a6d0efc0cff01aaaa15f4a.1623333178.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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.79 on 10.5.11.12 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) (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 Reviewed-by: Martin Kletzander --- 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