From nobody Mon Feb 9 19:30:35 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=1681907046; cv=none; d=zohomail.com; s=zohoarc; b=DN04wFPgkAbBKZbr5ipu1+jBk1pu1Sf1FiEdpn1QQZE3RR/8IQ10dVchB62V92CnWB9nkcxavijnWNi6naSq5b89SMITYx3h/+F/tMhB6dV3THGp5XG5buOJbujd+fJZlaJKR5d/SUrkymAeqyQET4LNxTvfLEtfUTFsWXFaH7w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681907046; 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=1JEJ+ged3/sKuy9HbyRjHmdegAUIMcnv79tCIEMS7us=; b=OD0fn5rkpR2UmH+fgHJVT3qN/5vpJLlFOunYQM1FqSGMZtrwQqS3e5K6EFym0xOuo9Ecx16FQ9ZBM8I6p5zdOFcApPOolPUlFgSpneCLeD4UFRu61kTDmdI2cao8BaGzhZyWpm7QcJY9oSc4Omrbp6vp7S4kITKFU2oi+LktsVA= 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 1681907046835843.8215888000842; Wed, 19 Apr 2023 05:24:06 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-511-Fe4CXaNpMuW9nLB5FpaJFA-1; Wed, 19 Apr 2023 08:23:43 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 64BF210146E8; Wed, 19 Apr 2023 12:23:41 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4FDB42166B34; Wed, 19 Apr 2023 12:23:41 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id A71AE1946A41; Wed, 19 Apr 2023 12:23:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 7356D19465A0 for ; Wed, 19 Apr 2023 12:04:51 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 58F23492B07; Wed, 19 Apr 2023 12:04:51 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.45.242.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id D24BD492B04 for ; Wed, 19 Apr 2023 12:04:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681907045; 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=1JEJ+ged3/sKuy9HbyRjHmdegAUIMcnv79tCIEMS7us=; b=KIZdkJvmaMtxTfqt6WedFeuHwoI4JQngHsH2OMsN0J7Nvn5LORGEYkcHVoBZ+A1o7MInVZ 9cIibuxy3ghzFPbBjhEgUTLKkXBwLdVK4fO/kMaz2MSh2/Nag4fWeFJoWvPukABlXVt83v e1KrH2WX5IuwGYT51/Oxi2H2JcvDJ08= X-MC-Unique: Fe4CXaNpMuW9nLB5FpaJFA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v3 08/25] util: typedparam: Introduce 'virTypedParamListConcat' Date: Wed, 19 Apr 2023 14:04:25 +0200 Message-Id: <01f9010c5ad152823c65374feccb9681fdec1345.1681905482.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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: 1681907049012100003 Content-Type: text/plain; charset="utf-8" Introduce a helper function to concatenate two virTypedParamLists. This will allow us to refactor qemuDomainGetStatsBlock to not access the list directly. Signed-off-by: Peter Krempa Reviewed-by: Martin Kletzander --- src/libvirt_private.syms | 1 + src/util/virtypedparam.c | 24 ++++++++++++++++++++++++ src/util/virtypedparam.h | 4 ++++ 3 files changed, 29 insertions(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index c596ef0f87..0f42c2de0b 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -3555,6 +3555,7 @@ virTypedParamListAddLLong; virTypedParamListAddString; virTypedParamListAddUInt; virTypedParamListAddULLong; +virTypedParamListConcat; virTypedParamListFree; virTypedParamListFromParams; virTypedParamListNew; diff --git a/src/util/virtypedparam.c b/src/util/virtypedparam.c index de3a4e76b4..f8dce9ed98 100644 --- a/src/util/virtypedparam.c +++ b/src/util/virtypedparam.c @@ -712,6 +712,30 @@ virTypedParamListNew(void) } +/** + * virTypedParamListConcat: + * + * @to: typed param list to concatenate into + * @fromptr: pointer to pointer to a typed param list to concatenate into = @from + * + * Concatenates all params from the virTypedParamList pointed to by @fromp= tr + * into @to and deallocates the list pointed to by @fromptr and clears the + * variable. + */ +void +virTypedParamListConcat(virTypedParamList *to, + virTypedParamList **fromptr) +{ + g_autoptr(virTypedParamList) from =3D g_steal_pointer(fromptr); + + VIR_RESIZE_N(to->par, to->par_alloc, to->npar, from->npar); + + memcpy(to->par + to->npar, from->par, sizeof(*(to->par)) * from->npar); + to->npar +=3D from->npar; + from->npar =3D 0; +} + + void virTypedParamListFree(virTypedParamList *list) { diff --git a/src/util/virtypedparam.h b/src/util/virtypedparam.h index 4aa597bc81..45422c2673 100644 --- a/src/util/virtypedparam.h +++ b/src/util/virtypedparam.h @@ -156,6 +156,10 @@ virTypedParamList * virTypedParamListFromParams(virTypedParameterPtr *params, size_t nparams); +void +virTypedParamListConcat(virTypedParamList *to, + virTypedParamList **fromptr); + int virTypedParamListAddInt(virTypedParamList *list, int value, --=20 2.39.2