From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23312 invoked by alias); 26 Mar 2018 15:41:09 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 23282 invoked by uid 89); 26 Mar 2018 15:41:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.1 required=5.0 tests=BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_ASCII_DIVIDERS,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=H*F:D*br X-HELO: mo19.mail-out.ovh.net Date: Mon, 26 Mar 2018 15:41:00 -0000 From: "Gabriel F. T. Gomes" To: Zack Weinberg CC: Subject: Re: [PATCH 5/9] Add __v*printf_internal with flags arguments. Message-ID: <20180326124056.5e1c8c75@tereshkova> In-Reply-To: <20180307193205.4751-6-zackw@panix.com> References: <20180307193205.4751-1-zackw@panix.com> <20180307193205.4751-6-zackw@panix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: EX2.emp.local (172.16.2.2) To EX3.emp.local (172.16.2.3) X-Ovh-Tracer-Id: 1481684279544696397 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedtgedrvdeigdelfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd X-SW-Source: 2018-03/txt/msg00553.txt.bz2 On Wed, 07 Mar 2018, Zack Weinberg wrote: > int >-_IO_vdprintf (int d, const char *format, va_list arg) >+__vdprintf_internal (int d, const char *format, va_list arg, >+ unsigned int mode_flags) ~~~~~~~~~~~~~~~~ Spaces that could be converted to tabs. > int >-__IO_vsprintf (char *string, const char *format, va_list args) >+__vsprintf_internal (char *string, const char *format, va_list args, >+ unsigned int mode_flags) ~~~~~~~~~~~~~~~~ Likewise. >--- a/libio/libio.h >+++ b/libio/libio.h >@@ -298,8 +298,6 @@ weak_extern (_IO_stdin_used); > > extern int _IO_vfwscanf (FILE * __restrict, const wchar_t * __restrict, > __gnuc_va_list, int *__restrict); >-extern int _IO_vfwprintf (FILE *__restrict, const wchar_t *__restrict, >- __gnuc_va_list); In the second patch in this series, you mentioned that _IO_vfwscanf was being kept because external callers could theoretically exist. I don't have the necessary background to understand why this doesn't apply to _IO_vfwprintf, too. Doesn't it? >+/* Internal versions of v*printf that take an additional flags >+ parameter. */ >+extern int __vfprintf_internal (FILE *fp, const char *format, va_list ap, >+ unsigned int mode_flags); >+extern int __vfwprintf_internal (FILE *fp, const wchar_t *format, va_list ap, >+ unsigned int mode_flags); >+ >+extern int __vasprintf_internal (char **result_ptr, const char *format, >+ va_list ap, unsigned int mode_flags); >+extern int __vdprintf_internal (int d, const char *format, va_list ap, >+ unsigned int mode_flags); >+extern int __obstack_vprintf_internal (struct obstack *ob, const char *fmt, >+ va_list ap, unsigned int mode_flags); >+ >+extern int __vsprintf_internal (char *string, const char *format, va_list ap, >+ unsigned int mode_flags); >+extern int __vsnprintf_internal (char *string, size_t maxlen, >+ const char *format, va_list ap, >+ unsigned int mode_flags); >+extern int __vswprintf_internal (wchar_t *string, size_t maxlen, >+ const wchar_t *format, va_list ap, >+ unsigned int mode_flags); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In this block of function prototypes, some spaces that could be converted to tabs. > int >-_IO_obstack_vprintf (struct obstack *obstack, const char *format, va_list args) >+__obstack_vprintf_internal (struct obstack *obstack, const char *format, >+ va_list args, unsigned int mode_flags) ~~~~~~~~~~~~~~~~~~~~~~~~ Likewise. >- result = _IO_vfprintf (&new_f.ofile.file.file, format, args); >+ result = __vfprintf_internal (&new_f.ofile.file.file, format, args, >+ mode_flags); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Likewise. > int >-_IO_vasprintf (char **result_ptr, const char *format, va_list args) >+__vasprintf_internal (char **result_ptr, const char *format, va_list args, >+ unsigned int mode_flags) ~~~~~~~~~~~~~~~~ Likewise. > int >-_IO_vsnprintf (char *string, size_t maxlen, const char *format, >- va_list args) >+__vsnprintf_internal (char *string, size_t maxlen, const char *format, >+ va_list args, unsigned int mode_flags) ~~~~~~~~~~~~~~~~ Likewise. >+int >+___vsnprintf (char *string, size_t maxlen, const char *format, va_list args) >+{ >+ return __vsnprintf_internal (string, maxlen, format, args, 0); >+} >+ldbl_weak_alias (___vsnprintf, __vsnprintf) >+ldbl_hidden_def (___vsnprintf, __vsnprintf) >+ldbl_weak_alias (___vsnprintf, vsnprintf) OK. > /* Helper function to provide temporary buffering for unbuffered streams. */ >-static int buffered_vfprintf (FILE *stream, const CHAR_T *fmt, va_list) >+static int buffered_vfprintf (FILE *stream, const CHAR_T *fmt, va_list, >+ unsigned int) ~~~~~~~~~~~~~~~~~~~~~~~~ Spaces instead of tabs. >@@ -1223,7 +1230,9 @@ static int printf_positional (FILE *s, > va_list ap, va_list *ap_savep, int done, > int nspecs_done, const UCHAR_T *lead_str_end, > CHAR_T *work_buffer, int save_errno, >- const char *grouping, THOUSANDS_SEP_T); >+ const char *grouping, >+ THOUSANDS_SEP_T thousands_sep, >+ unsigned int mode_flags); ~~~~~~~~~~~~~~~~~~~~~~~~ Likewise. >@@ -1699,7 +1714,8 @@ printf_positional (FILE *s, const CHAR_T *format, int readonly_format, > va_list ap, va_list *ap_savep, int done, int nspecs_done, > const UCHAR_T *lead_str_end, > CHAR_T *work_buffer, int save_errno, >- const char *grouping, THOUSANDS_SEP_T thousands_sep) >+ const char *grouping, THOUSANDS_SEP_T thousands_sep, >+ unsigned int mode_flags) ~~~~~~~~~~~~~~~~ Likewise. > static int >-buffered_vfprintf (FILE *s, const CHAR_T *format, va_list args) >+buffered_vfprintf (FILE *s, const CHAR_T *format, va_list args, >+ unsigned int mode_flags) ~~~~~~~~~~~~~~~~ Likewise. > /* Now print to helper instead. */ >-#ifndef COMPILE_WPRINTF >- result = _IO_vfprintf (hp, format, args); >-#else >- result = vfprintf (hp, format, args); >-#endif >+ result = vfprintf (hp, format, args, mode_flags); OK. >--- a/stdlib/strfrom-skeleton.c >+++ b/stdlib/strfrom-skeleton.c >@@ -106,7 +106,7 @@ STRFROM (char *dest, size_t size, const char *format, FLOAT f) > } > > /* The following code to prepare the virtual file has been adapted from the >- function _IO_vsnprintf from libio. */ >+ function __vsnprintf from libio. */ ~~~~~~~~~~~ It would be more precise to mention __vsnprint_internal.