From nobody Mon Feb 9 17:24:36 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1640175703; cv=none; d=zohomail.com; s=zohoarc; b=c7aiUuWzjE9cqdTnOH227X5zA26n63DR43DCAeUu+lP7ieaVqXmQAWkTrF6mx8detuUT2aG0y17fvV6pEpFKALg9KrN2lrXwfLOMoLaoA7S9bfTflJMJi7VndXeW7LdxkJq14UNVHkQAs7RwtvUQ10SKkLKn6Maxo0rRe/lq78g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1640175703; 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=ST/s460K6Y/ArzYNLRZrp3rSK7hBEoNonOOBVW1uoTY=; b=Y+0ghum9HStmSZ73Bm29GMLfa5AQOsgASoMT7K4blMwTmf+GBljzMBrWqh6OYWxPvmJ1+lVaD2K718PVdsyH/f57oTvtji6GAOxHvOSwIVLMjSC4Gyp/Wnj/QW4eBejAxoJwDuDriztX+k/AqUtNQ7ZHH6y/jJMba8zbF1H1s9M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1640175703963560.0770522775231; Wed, 22 Dec 2021 04:21:43 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-265-4xd_3TiTPpm_H-VIZ2O6Uw-1; Wed, 22 Dec 2021 07:21:39 -0500 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 E92B0760C6; Wed, 22 Dec 2021 12:21:33 +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 DB5AF5F914; Wed, 22 Dec 2021 12:21:32 +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 01E594A7C8; Wed, 22 Dec 2021 12:21:28 +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 1BMC3SGQ008405 for ; Wed, 22 Dec 2021 07:03:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id E803B7314B; Wed, 22 Dec 2021 12:03:28 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4A444709AA for ; Wed, 22 Dec 2021 12:03:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1640175703; 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=ST/s460K6Y/ArzYNLRZrp3rSK7hBEoNonOOBVW1uoTY=; b=NQA9EX2KwxqRC450tg81TS72jBPEXoDVBUyrlNpL5z5Dmao9yfggEBvEh+XHEGnXA2yIba ki2sB6c2UExMzUGS3nSojx7ga9SdXo459C8vCHsWYoMVbN5h4xyh9SFsTV0knLDXlWcxcn Sp5BBjRRCBMA16Fm5fGjWCf1YAj3NNI= X-MC-Unique: 4xd_3TiTPpm_H-VIZ2O6Uw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/6] Replace open coded virJSONValueArrayAppendString Date: Wed, 22 Dec 2021 13:02:38 +0100 Message-Id: <92b1a6a5ade6cab94e4fc964af76618430afd75b.1640174526.git.pkrempa@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.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) X-ZM-MESSAGEID: 1640175705546100001 Content-Type: text/plain; charset="utf-8" In two instances we've created a string virJSONValue just to append it to the array. Replace it by use of the virJSONValueArrayAppendString helper. Signed-off-by: Peter Krempa --- src/qemu/qemu_agent.c | 4 +--- src/util/virmacmap.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c index e2107e5cbf..cb3bf97415 100644 --- a/src/qemu/qemu_agent.c +++ b/src/qemu/qemu_agent.c @@ -1168,9 +1168,7 @@ qemuAgentMakeStringsArray(const char **strings, unsig= ned int len) g_autoptr(virJSONValue) ret =3D virJSONValueNewArray(); for (i =3D 0; i < len; i++) { - g_autoptr(virJSONValue) str =3D virJSONValueNewString(strings[i]); - - if (virJSONValueArrayAppend(ret, &str) < 0) + if (virJSONValueArrayAppendString(ret, strings[i]) < 0) return NULL; } diff --git a/src/util/virmacmap.c b/src/util/virmacmap.c index 0b7b758c6d..cf554205a8 100644 --- a/src/util/virmacmap.c +++ b/src/util/virmacmap.c @@ -214,9 +214,7 @@ virMACMapHashDumper(void *payload, GSList *next; for (next =3D macs; next; next =3D next->next) { - g_autoptr(virJSONValue) m =3D virJSONValueNewString((const char *)= next->data); - - if (virJSONValueArrayAppend(arr, &m) < 0) + if (virJSONValueArrayAppendString(arr, (const char *) next->data) = < 0) return -1; } --=20 2.31.1