From nobody Fri Apr 26 22:45:39 2024 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=1630785419; cv=none; d=zohomail.com; s=zohoarc; b=a4Xka43XjrVC+u1Vxp/WMX+KZqFlL57eLaS9lsn80JqpM+qnWssKyySjVuMSNGWwneBfwD3IId3dDJYno0tV54GW6zzPxMC4BZPybkwFMaouw8oUzTI7GV644K9zvNKk1271O6o7yfGeXwKLvEQdcMyqu+aWZp8QaYvEHvT346Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630785419; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=eptB/BCakXatfenVEx++ZW3d3WrlKD4WgDxu2n8NHiA=; b=XsaBwL6a/WFgZYh/mfTS/GHvg9eDDNhhbi4QL8NgZcqEsCKDMHG7db/wCL1W+4abUHxp+tzihlHc20itc6TzkCCrX9/GtfiOOjLKumtnCZSkbmhZ4gDFNe197CyTGztpwFzZonr2PPTA9s7g67vmrdtND/rCFckdmw/fsSKMf0w= 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) 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 1630785419823518.6384515614717; Sat, 4 Sep 2021 12:56:59 -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-380-g-fmpd5SNZep2EO1hk16kA-1; Sat, 04 Sep 2021 15:56:56 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 83270835DE3; Sat, 4 Sep 2021 19:56:51 +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 39FAB10074E1; Sat, 4 Sep 2021 19:56:51 +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 5EDBB1809C98; Sat, 4 Sep 2021 19:56:50 +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 184JgJsY003588 for ; Sat, 4 Sep 2021 15:42:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id AC55B1B5C1; Sat, 4 Sep 2021 19:42:19 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 36F4960861 for ; Sat, 4 Sep 2021 19:42:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630785418; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=eptB/BCakXatfenVEx++ZW3d3WrlKD4WgDxu2n8NHiA=; b=h0VgYrT2QSIgme0ksRfvUSMhhAk3QNcnHuzEKBWK9ur7xQSx17vI5lBcK0FCiu308wYVx7 Dvp1c8RmDEF5DXy2YYHUbJ/zUS9UugA3ijRDNPXmdG7tNGPHrNFFalDqnnV7h1P8QgrcXV TBHWUh1Soco4pj8ysJ+dyIMyHwqK1nQ= X-MC-Unique: g-fmpd5SNZep2EO1hk16kA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH] secretxml2xmltest: refactor testCompareXMLToXMLFiles (glib chronicles) Date: Sat, 4 Sep 2021 21:42:13 +0200 Message-Id: <006a4ae7b067a72d6d5365132cca17cdebb6a482.1630784519.git.jtomko@redhat.com> 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.22 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1630785421332100001 Use g_auto where possible and remove the pointless label. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- tests/secretxml2xmltest.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/tests/secretxml2xmltest.c b/tests/secretxml2xmltest.c index 48f48416b5..99aaa9db15 100644 --- a/tests/secretxml2xmltest.c +++ b/tests/secretxml2xmltest.c @@ -10,25 +10,19 @@ static int testCompareXMLToXMLFiles(const char *inxml, const char *outxml) { - char *actual =3D NULL; - int ret =3D -1; - virSecretDef *secret =3D NULL; + g_autofree char *actual =3D NULL; + g_autoptr(virSecretDef) secret =3D NULL; =20 if (!(secret =3D virSecretDefParseFile(inxml))) - goto fail; + return -1; =20 if (!(actual =3D virSecretDefFormat(secret))) - goto fail; + return -1; =20 if (virTestCompareToFile(actual, outxml) < 0) - goto fail; + return -1; =20 - ret =3D 0; - - fail: - VIR_FREE(actual); - virSecretDefFree(secret); - return ret; + return 0; } =20 struct testInfo { --=20 2.31.1