From nobody Fri May 16 05:34:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1501063398407542.0458226030745; Wed, 26 Jul 2017 03:03:18 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 88190356F0; Wed, 26 Jul 2017 10:03:15 +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 5F5BD53CCA; Wed, 26 Jul 2017 10:03:15 +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 83FB514B34; Wed, 26 Jul 2017 10:03:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v6QA0wQI008771 for ; Wed, 26 Jul 2017 06:00:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id B7AE551C89; Wed, 26 Jul 2017 10:00:58 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.201]) by smtp.corp.redhat.com (Postfix) with ESMTP id 120896FE6E; Wed, 26 Jul 2017 10:00:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 88190356F0 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 26 Jul 2017 12:00:36 +0200 Message-Id: <26b537a9e8d2f7b8d1b1674a1b9450801483123f.1501062802.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 06/24] util: buffer: Add virBufferStrcatVArgs 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 26 Jul 2017 10:03:16 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Split out the worker loop into a separate function and export it. --- src/libvirt_private.syms | 1 + src/util/virbuffer.c | 27 +++++++++++++++++++++------ src/util/virbuffer.h | 2 ++ 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index fa2cd08fe..588b76b43 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1345,6 +1345,7 @@ virBufferFreeAndReset; virBufferGetIndent; virBufferSetIndent; virBufferStrcat; +virBufferStrcatVArgs; virBufferTrim; virBufferURIEncodeString; virBufferUse; diff --git a/src/util/virbuffer.c b/src/util/virbuffer.c index f07b119c0..28a291bb0 100644 --- a/src/util/virbuffer.c +++ b/src/util/virbuffer.c @@ -831,6 +831,26 @@ virBufferEscapeShell(virBufferPtr buf, const char *str) } /** + * virBufferStrcatVArgs: + * @buf: the buffer to append to + * @ap: variable argument structure + * + * See virBufferStrcat. + */ +void +virBufferStrcatVArgs(virBufferPtr buf, + va_list ap) +{ + char *str; + + if (buf->error) + return; + + while ((str =3D va_arg(ap, char *)) !=3D NULL) + virBufferAdd(buf, str, -1); +} + +/** * virBufferStrcat: * @buf: the buffer to append to * @...: the variable list of strings, the last argument must be NULL @@ -842,14 +862,9 @@ void virBufferStrcat(virBufferPtr buf, ...) { va_list ap; - char *str; - - if (buf->error) - return; va_start(ap, buf); - while ((str =3D va_arg(ap, char *)) !=3D NULL) - virBufferAdd(buf, str, -1); + virBufferStrcatVArgs(buf, ap); va_end(ap); } diff --git a/src/util/virbuffer.h b/src/util/virbuffer.h index 7a7014aa7..f34217968 100644 --- a/src/util/virbuffer.h +++ b/src/util/virbuffer.h @@ -80,6 +80,8 @@ void virBufferVasprintf(virBufferPtr buf, const char *for= mat, va_list ap) ATTRIBUTE_FMT_PRINTF(2, 0); void virBufferStrcat(virBufferPtr buf, ...) ATTRIBUTE_SENTINEL; +void virBufferStrcatVArgs(virBufferPtr buf, va_list ap); + void virBufferEscape(virBufferPtr buf, char escape, const char *toescape, const char *format, const char *str); void virBufferEscapeN(virBufferPtr buf, const char *format, --=20 2.13.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list