From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by sourceware.org (Postfix) with ESMTPS id 6795F385829E for ; Fri, 16 Feb 2024 13:40:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6795F385829E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6795F385829E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::531 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708090830; cv=none; b=dRfOU1nYGtLImcsrtp4uf7o1C7LkCueVbMc7Gf6uCfSOCeNiAGH74/e8himHnskwjfkPprErfDSwqfXGAKt73L0AEblVSgCq+Dd30zEKENxK4LV3o8O5yuis5K3FoTj8xNXxvvATYApJ9bQNuxvKZIK2uwTxv3LraEdf26GQ4Tw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708090830; c=relaxed/simple; bh=/YzWxH+CPDKr/xh87PHTKxl9fMu0tkVfOIzZo7BiX7o=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=fVLmLwJaQIfpkhBFGzN4eUGH8mpaFwIMQLnSn5g/41/PWW0Pgii24JIdbNdKUBEalLKoUbH03CeSYxwDWp4tXB3xFiO9iGtFFHkoWnwP8JwOVjaqG3CvTsLvj35V1BBt2ZlAznqW+LPKuioGhOu2j0vjH40s5T0MyMLm1C5J1us= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pg1-x531.google.com with SMTP id 41be03b00d2f7-53fbf2c42bfso628297a12.3 for ; Fri, 16 Feb 2024 05:40:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708090826; x=1708695626; darn=sourceware.org; h=content-transfer-encoding:in-reply-to:organization:from:references :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=H2GjZoj/QZqP/u9+CdnvNHQDqGBte8L+gd7zldUNnJ8=; b=oy7AdZdbcmuTmUPidYL6ZxiYvt+T8tyGSL3/fohBm9TMUcy+tvHyjg2dR9Hb2Np1St wSd8xXNhZC65G3lD9jJDIvetU/uTnNBbC25uvSi7MJhYNz2+S5mp5VxHiySvrEAmZ0MD SNfSmL/S5yh+AUM944qMAi3Q01HMOSx0PcXRO7i1SPMm6k9QiC4Gn34QuPD2pYIO8iI5 WDhjXNTQS8WZ8y0qEBHOHdD5WF5EqyeZTjyxn/sy0ovJROmzDRyDSiP/k9Zkdk4SF4D/ hPF033G+IR+j0IDcDyviN6B5cdb5piv8P7I/llnZ1spKe5WGcwvQd6E8f0d9OOCc20/Z sz8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708090826; x=1708695626; h=content-transfer-encoding:in-reply-to:organization:from:references :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=H2GjZoj/QZqP/u9+CdnvNHQDqGBte8L+gd7zldUNnJ8=; b=mKGkfCh/VGFcTgMvGblw5e8toM2ii9/izgTHbCZHd4X9Bd+qWUYRS6VpLSoBdSml3I r0C3yr6DvRM7Pc/FMExg5FIXrZpCmnP5jcpxCv9kM2k1PcvCkOWcz/P2z6U3FRcbIOmh hLoClTTZbHnnzoHEtfHVxTu7TwBbVvODO72/pOrEIABYPCHtqflCFf3fNgNbeOhbRrqw XnZPTs1Xtq6hnIiqAzjHqkSOblwcEcnsDZ1KAKr7CQArLaZ5ZOevHw8HeevnxxTOkvFE iZwxYXxpdZS5yjIEognXaluHM5ztYXVrL/4pW7Y3P+BITne7E2H4zzqKyByEi5b5vvyg da2Q== X-Forwarded-Encrypted: i=1; AJvYcCVUz9hvqbZZW5k6WFinDF5h9tNwMWyLK0dt/6q7whfq7tCE3AxxI8ua6QFX1PTxzIGLYWdm7yU8jyY/60DdPRnn/j2n6vEseEbZ X-Gm-Message-State: AOJu0YwTYiBcyldhrnNL16l7hmUFoSXLyPlZkO4UuhnvRV/N54aN++WF gQWq9Oks8dvB2BCkNOppaBToFc2V+3P8qnDWKOfBAC5JO9J+dGImTKxSnPiW/cTafUUPCRr9Ewg M X-Google-Smtp-Source: AGHT+IH8/dbtLwv6BY8Ng2uvQ8sxJu5DUgZMhq0tQE6DdlnSXg7jcREk9WTnD9aUEE49K5k88vSrdA== X-Received: by 2002:a05:6a20:c90c:b0:1a0:5f8b:2cad with SMTP id gx12-20020a056a20c90c00b001a05f8b2cadmr5597093pzb.13.1708090826328; Fri, 16 Feb 2024 05:40:26 -0800 (PST) Received: from ?IPV6:2804:1b3:a7c0:8177:542a:9f26:15a9:5ce4? ([2804:1b3:a7c0:8177:542a:9f26:15a9:5ce4]) by smtp.gmail.com with ESMTPSA id d6-20020a62f806000000b006e13d0424c5sm1241251pfh.171.2024.02.16.05.40.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 16 Feb 2024 05:40:25 -0800 (PST) Message-ID: <2f79b0ab-073d-4df5-8b36-941b93d5e7c3@linaro.org> Date: Fri, 16 Feb 2024 10:40:23 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 06/11] stdio: Rename __printf_buffer to __vfprintf_buffer Content-Language: en-US To: Florian Weimer , libc-alpha@sourceware.org References: From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 09/02/24 12:25, Florian Weimer wrote: > And __wprintf_buffer to __vwprintf_buffer. These functions take > a va_list argument, so they are closer to the v-variant functions > in . > > Also move the declaration to , which is arguably > a better fit than (which contains lots of printf > internals). LGTM, thanks. Reviewed-by: Adhemerval Zanella > --- > include/printf.h | 9 +-------- > include/printf_buffer.h | 9 +++++++++ > libio/iovdprintf.c | 2 +- > libio/iovsprintf.c | 2 +- > libio/obprintf.c | 2 +- > libio/vasprintf.c | 2 +- > libio/vsnprintf.c | 2 +- > libio/vswprintf.c | 2 +- > stdio-common/vfprintf-internal.c | 10 ++++++---- > 9 files changed, 22 insertions(+), 18 deletions(-) > > diff --git a/include/printf.h b/include/printf.h > index 2c998059d4..78aac4dcad 100644 > --- a/include/printf.h > +++ b/include/printf.h > @@ -65,18 +65,11 @@ int __translated_number_width (locale_t loc, > const char *first, const char *last) > attribute_hidden; > > - > -struct __printf_buffer; > -void __printf_buffer (struct __printf_buffer *buf, const char *format, > - va_list ap, unsigned int mode_flags); > -struct __wprintf_buffer; > -void __wprintf_buffer (struct __wprintf_buffer *buf, const wchar_t *format, > - va_list ap, unsigned int mode_flags); > - > extern int __printf_fp (FILE *, const struct printf_info *, > const void *const *); > libc_hidden_proto (__printf_fp) > > +struct __printf_buffer; > void __printf_fphex_l_buffer (struct __printf_buffer *, locale_t, > const struct printf_info *, > const void *const *) attribute_hidden; > diff --git a/include/printf_buffer.h b/include/printf_buffer.h > index eff8e3413a..fb0b42178e 100644 > --- a/include/printf_buffer.h > +++ b/include/printf_buffer.h > @@ -200,6 +200,12 @@ int __printf_buffer_done (struct __printf_buffer *buf) attribute_hidden; > known, and the flush implementation can be called directly. */ > bool __printf_buffer_flush (struct __printf_buffer *buf) attribute_hidden; > > +/* Building block for printf-style functions. Write argument list AP > + to BUF according to FORMAT. MODE_FLAGS contains PRINTF_* flags > + defined in . */ > +void __vprintf_buffer (struct __printf_buffer *buf, const char *format, > + va_list ap, unsigned int mode_flags) attribute_hidden; > + > /* Wide version of struct __printf_buffer follows. */ > > enum __wprintf_buffer_mode > @@ -274,6 +280,9 @@ int __wprintf_buffer_done (struct __wprintf_buffer *buf) attribute_hidden; > > bool __wprintf_buffer_flush (struct __wprintf_buffer *buf) attribute_hidden; > > +void __vwprintf_buffer (struct __wprintf_buffer *buf, const wchar_t *format, > + va_list ap, unsigned int mode_flags) attribute_hidden; > + > /* Type-generic convenience macros. They are useful if > printf_buffer-char.h or printf_buffer-wchar_t.h is included as > well. */ > diff --git a/libio/iovdprintf.c b/libio/iovdprintf.c > index 6894fa8347..47d9d0ba8f 100644 > --- a/libio/iovdprintf.c > +++ b/libio/iovdprintf.c > @@ -66,7 +66,7 @@ __vdprintf_internal (int d, const char *format, va_list arg, > __printf_buffer_init (&buf.base, buf.buf, array_length (buf.buf), > __printf_buffer_mode_dprintf); > buf.fd = d; > - __printf_buffer (&buf.base, format, arg, mode_flags); > + __vprintf_buffer (&buf.base, format, arg, mode_flags); > if (__printf_buffer_has_failed (&buf.base)) > return -1; > __printf_buffer_flush_dprintf (&buf); > diff --git a/libio/iovsprintf.c b/libio/iovsprintf.c > index 2d81ee3507..7fdc06dcd4 100644 > --- a/libio/iovsprintf.c > +++ b/libio/iovsprintf.c > @@ -59,7 +59,7 @@ __vsprintf_internal (char *string, size_t maxlen, > __printf_buffer_init_end (&buf, string, (char *) ~(uintptr_t) 0, > __printf_buffer_mode_sprintf); > > - __printf_buffer (&buf, format, args, mode_flags); > + __vprintf_buffer (&buf, format, args, mode_flags); > > /* Write the NUL terminator if there is room. Do not use the putc > operation to avoid overflowing the character write count. */ > diff --git a/libio/obprintf.c b/libio/obprintf.c > index 491d14fbae..24d1edf260 100644 > --- a/libio/obprintf.c > +++ b/libio/obprintf.c > @@ -92,7 +92,7 @@ __obstack_vprintf_internal (struct obstack *obstack, const char *format, > /* Now allocate the rest of the current chunk. */ > obstack_blank_fast (obstack, room); > > - __printf_buffer (&buf.base, format, args, mode_flags); > + __vprintf_buffer (&buf.base, format, args, mode_flags); > > if (buf.base.write_ptr == &buf.ch + 1) > /* buf.ch is in use. Put it into the obstack. */ > diff --git a/libio/vasprintf.c b/libio/vasprintf.c > index 999ae526f4..edcfab2323 100644 > --- a/libio/vasprintf.c > +++ b/libio/vasprintf.c > @@ -99,7 +99,7 @@ __vasprintf_internal (char **result_ptr, const char *format, va_list args, > __printf_buffer_init (&buf.base, buf.direct, array_length (buf.direct), > __printf_buffer_mode_asprintf); > > - __printf_buffer (&buf.base, format, args, mode_flags); > + __vprintf_buffer (&buf.base, format, args, mode_flags); > int done = __printf_buffer_done (&buf.base); > if (done < 0) > { > diff --git a/libio/vsnprintf.c b/libio/vsnprintf.c > index dd7a585cbe..7077fcd9f2 100644 > --- a/libio/vsnprintf.c > +++ b/libio/vsnprintf.c > @@ -93,7 +93,7 @@ __vsnprintf_internal (char *string, size_t maxlen, const char *format, > { > struct __printf_buffer_snprintf buf; > __printf_buffer_snprintf_init (&buf, string, maxlen); > - __printf_buffer (&buf.base, format, args, mode_flags); > + __vprintf_buffer (&buf.base, format, args, mode_flags); > return __printf_buffer_snprintf_done (&buf); > } > > diff --git a/libio/vswprintf.c b/libio/vswprintf.c > index 5990bd2eff..d73246ba41 100644 > --- a/libio/vswprintf.c > +++ b/libio/vswprintf.c > @@ -41,7 +41,7 @@ __vswprintf_internal (wchar_t *string, size_t maxlen, const wchar_t *format, > struct __wprintf_buffer buf; > __wprintf_buffer_init (&buf, string, maxlen, __wprintf_buffer_mode_swprintf); > > - __wprintf_buffer (&buf, format, args, mode_flags); > + __vwprintf_buffer (&buf, format, args, mode_flags); > > if (buf.write_ptr == buf.write_end) > { > diff --git a/stdio-common/vfprintf-internal.c b/stdio-common/vfprintf-internal.c > index 771beca9bf..23754232f2 100644 > --- a/stdio-common/vfprintf-internal.c > +++ b/stdio-common/vfprintf-internal.c > @@ -122,6 +122,7 @@ > > #ifndef COMPILE_WPRINTF > # include "printf_buffer-char.h" > +# define VFPRINTF_BUFFER __vprintf_buffer > # define vfprintf __vfprintf_internal > # define OTHER_CHAR_T wchar_t > # define UCHAR_T unsigned char > @@ -136,6 +137,7 @@ typedef const char *THOUSANDS_SEP_T; > # define CONVERT_FROM_OTHER_STRING __wcsrtombs > #else > # include "printf_buffer-wchar_t.h" > +# define VFPRINTF_BUFFER __vwprintf_buffer > # define vfprintf __vfwprintf_internal > # define OTHER_CHAR_T char > /* This is a hack!!! There should be a type uwchar_t. */ > @@ -595,8 +597,8 @@ static void group_number (struct Xprintf_buffer *buf, > > /* The buffer-based function itself. */ > void > -Xprintf_buffer (struct Xprintf_buffer *buf, const CHAR_T *format, > - va_list ap, unsigned int mode_flags) > +VFPRINTF_BUFFER (struct Xprintf_buffer *buf, const CHAR_T *format, > + va_list ap, unsigned int mode_flags) > { > /* The character used as thousands separator. */ > THOUSANDS_SEP_T thousands_sep = 0; > @@ -1541,7 +1543,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap, unsigned int mode_flags) > { > struct Xprintf (buffer_to_file) wrap; > Xprintf (buffer_to_file_init) (&wrap, s); > - Xprintf_buffer (&wrap.base, format, ap, mode_flags); > + VFPRINTF_BUFFER (&wrap.base, format, ap, mode_flags); > return Xprintf (buffer_to_file_done) (&wrap); > } > > @@ -1556,7 +1558,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap, unsigned int mode_flags) > Xprintf (buffer_to_file_init) (&wrap, s); > > /* Perform the printing operation on the buffer. */ > - Xprintf_buffer (&wrap.base, format, ap, mode_flags); > + VFPRINTF_BUFFER (&wrap.base, format, ap, mode_flags); > done = Xprintf (buffer_to_file_done) (&wrap); > > /* Unlock the stream. */