From nobody Sun Feb 8 23:58:08 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=1623752872; cv=none; d=zohomail.com; s=zohoarc; b=ignuByG7J15xivX/cZbnbKrHJAblqk16DoNhGKeywXDB0Co4StAKycHje/S7V6qTReFNqi29IqvJAqbaDdt58BtRLsBEvh+K8Lh0WdwhJoeWILRRxjPI6hGZt0e0MbEDy0yC2SxjbrtU8UVexnjlhWxUrXHrO1GvhLiHm0K84zc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623752872; 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=AkysYiU5GOxTfcIUq0wofcK1WijU9Fhk8vOdSf127+o=; b=fs9WOK+uvjQtN/cEyVE1sh0y77G7Mpp111k5L+mfd/2ji1Pn3GjsPMnl2PtnfD5KfqAfIUWLWpdjayM7NEQTg4IONkfJ0vcwdZ02aEXjkH79UsBhyTJKN4aF183iDEZ0FVp2Ix6mpjqAqFkEq8TkejL6npvGnHhoMkPW4JS4zXU= 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 1623752872262187.67521780818288; Tue, 15 Jun 2021 03:27:52 -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-126-ORkNv3bYM5mv3KR3Z2tWCw-1; Tue, 15 Jun 2021 06:27:48 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DE64B8005A2; Tue, 15 Jun 2021 10:27:43 +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 C0704189BB; Tue, 15 Jun 2021 10:27:43 +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 890D446F5F; Tue, 15 Jun 2021 10:27:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 15FARcev019674 for ; Tue, 15 Jun 2021 06:27:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id A76F518A69; Tue, 15 Jun 2021 10:27:38 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0B843189BB for ; Tue, 15 Jun 2021 10:27:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623752871; 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=AkysYiU5GOxTfcIUq0wofcK1WijU9Fhk8vOdSf127+o=; b=cpNIXsqLeXhzJMr2IhRa0ag9gNNdVKJBgUJ9Bwz0p2ZBRrSJxDn/Y5HHJ23NqNum+DCVm6 YTFuJ2m2oEepGXVvqoHafUNAMGdn54tzWWVaMrje4kjY+tlDJiguhYi456r72oP0yhI2gf 8R4B/1+iSvYetrde19gvmFBvp5KJGNc= X-MC-Unique: ORkNv3bYM5mv3KR3Z2tWCw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 07/13] testQemuMonitorJSONGetCommands: Refactor cleanup Date: Tue, 15 Jun 2021 12:27:20 +0200 Message-Id: <9112a7c48f47c0dfc1e04144fcd53abaa282783d.1623752803.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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.11 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" Use g_auto(GStrv) for clearing the string list and thus remove the 'cleanup' section and 'ret' variable. Signed-off-by: Peter Krempa --- tests/qemumonitorjsontest.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 0dce8f6ab5..5d03f83787 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -502,10 +502,8 @@ testQemuMonitorJSONGetCommands(const void *opaque) { const testGenericData *data =3D opaque; virDomainXMLOption *xmlopt =3D data->xmlopt; - int ret =3D -1; - char **commands =3D NULL; + g_auto(GStrv) commands =3D NULL; int ncommands =3D 0; - size_t i; g_autoptr(qemuMonitorTest) test =3D NULL; if (!(test =3D qemuMonitorTestNewSchema(xmlopt, data->schema))) @@ -525,16 +523,16 @@ testQemuMonitorJSONGetCommands(const void *opaque) " } " " ]" "}") < 0) - goto cleanup; + return -1; if ((ncommands =3D qemuMonitorGetCommands(qemuMonitorTestGetMonitor(te= st), &commands)) < 0) - goto cleanup; + return -1; if (ncommands !=3D 3) { virReportError(VIR_ERR_INTERNAL_ERROR, "ncommands %d is not 3", ncommands); - goto cleanup; + return -1; } #define CHECK(i, wantname) \ @@ -543,7 +541,7 @@ testQemuMonitorJSONGetCommands(const void *opaque) virReportError(VIR_ERR_INTERNAL_ERROR, \ "name %s is not %s", \ commands[i], (wantname)); \ - goto cleanup; \ + return -1; \ } \ } while (0) @@ -552,13 +550,8 @@ testQemuMonitorJSONGetCommands(const void *opaque) CHECK(2, "quit"); #undef CHECK - ret =3D 0; - cleanup: - for (i =3D 0; i < ncommands; i++) - VIR_FREE(commands[i]); - VIR_FREE(commands); - return ret; + return 0; } --=20 2.31.1