From nobody Tue Feb 10 01:15:41 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=1623752954; cv=none; d=zohomail.com; s=zohoarc; b=J2/ZS2b4HksRF0eV36VRxoiVgOaIp1O3UbFJiHW0b7KhvgmHZwcKTTjvVWyXlkLIRm+GnHpGjFnHLj4GMGzHkrh99Q2CJ7f2AS5YgeXXJq3q4DcivosS2dxhDbRRwKsU7oQwX9y0lGOn11j+ZrD9cQtRFfgM3Hx3KobO0DlsVyc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623752954; 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=sgpbbHRLj0OqEvFVLgZqr3ili0QRKS0C6up0xEywuJk=; b=Nk6cER3N9UpUcwYTcYowZI2LHiwi5N2b2Ts2nWrgmFoMIZRLaT5XOV33cGO2D2WduIvs3sdO33gbO1iqSaYgewJXAiWtqD6pr++SBgJuH5fUXW0dpgDWwocmEDYOH5tZHarM4nbEBz5ATFHb0IzAk8DsuTXNRXjD/ylQva5ymxI= 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 1623752954912693.211239837341; Tue, 15 Jun 2021 03:29:14 -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-343-pxeTODAINheR5Vjy6aFMFA-1; Tue, 15 Jun 2021 06:27:55 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 001821850608; Tue, 15 Jun 2021 10:27:50 +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 D62E75D9CA; Tue, 15 Jun 2021 10:27:49 +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 A2E3A46F69; Tue, 15 Jun 2021 10:27:49 +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 15FARhei019734 for ; Tue, 15 Jun 2021 06:27:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id CD602189CE; Tue, 15 Jun 2021 10:27:43 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3790D620DE for ; Tue, 15 Jun 2021 10:27:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623752953; 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=sgpbbHRLj0OqEvFVLgZqr3ili0QRKS0C6up0xEywuJk=; b=W01smKRei0eg8Eev2SoQ0Set+AlZo7hOU58aMfC2nkkxdRNzkO7B4IZJo1NejzyWQ+zNqU 9ocg8rZktKM3lsMeKuN+huyhzRe6UojTrSOXVj2YHuaDJvMD4hKiA+vF82ENFuA1gsf6LR Xu1RezA7x+rZp/TkNP0rT39MB3UcqiU= X-MC-Unique: pxeTODAINheR5Vjy6aFMFA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 12/13] qemuMonitorJSONGetStringArray: Don't return element count Date: Tue, 15 Jun 2021 12:27:25 +0200 Message-Id: <235b4a52ed078c5cd80ee59badb3c9d7b597546b.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.14 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" There's just one caller who cares (testQemuMonitorJSONGetTPMModels). Fix it and remove the counting of elements. Signed-off-by: Peter Krempa --- src/qemu/qemu_monitor_json.c | 2 +- tests/qemumonitorjsontest.c | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 74e06e7604..340d8a1027 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -7219,7 +7219,7 @@ qemuMonitorJSONGetStringArray(qemuMonitor *mon, if (!(*array =3D virJSONValueObjectGetStringArray(reply, "return"))) return -1; - return g_strv_length(*array); + return 0; } int qemuMonitorJSONGetTPMModels(qemuMonitor *mon, diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index ab589135ba..e6746b806f 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -561,7 +561,6 @@ testQemuMonitorJSONGetTPMModels(const void *opaque) const testGenericData *data =3D opaque; virDomainXMLOption *xmlopt =3D data->xmlopt; g_auto(GStrv) tpmmodels =3D NULL; - int ntpmmodels =3D 0; g_autoptr(qemuMonitorTest) test =3D NULL; if (!(test =3D qemuMonitorTestNewSchema(xmlopt, data->schema))) @@ -575,13 +574,12 @@ testQemuMonitorJSONGetTPMModels(const void *opaque) "}") < 0) return -1; - if ((ntpmmodels =3D qemuMonitorGetTPMModels(qemuMonitorTestGetMonitor(= test), - &tpmmodels)) < 0) + if (qemuMonitorGetTPMModels(qemuMonitorTestGetMonitor(test), &tpmmodel= s) < 0) return -1; - if (ntpmmodels !=3D 1) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "ntpmmodels %d is not 1", ntpmmodels); + if (g_strv_length(tpmmodels) !=3D 1) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + "expected 1 tpm model"); return -1; } --=20 2.31.1