about summary refs log tree commit diff
path: root/stdio-common
diff options
context:
space:
mode:
authorGabriel F. T. Gomes <gabriel@inconstante.eti.br>2018-06-06 11:48:49 -0300
committerGabriel F. T. Gomes <gabriel@inconstante.eti.br>2019-02-21 10:28:50 -0300
commitf43b8dd55588c32d12a461251e4f7598c5fed97f (patch)
treef4d0ba0396fc8740476256e709075302d7e60d4e /stdio-common
parentdc0afac3252d0c53716ccaf0b424f7769a66d695 (diff)
downloadglibc-f43b8dd55588c32d12a461251e4f7598c5fed97f.tar.gz
glibc-f43b8dd55588c32d12a461251e4f7598c5fed97f.tar.xz
glibc-f43b8dd55588c32d12a461251e4f7598c5fed97f.zip
Add internal implementations for argp.h, err.h, and error.h functions
Since the introduction of explicit flags in the internal implementation
of the printf family of functions, the 'mode' parameter can be used to
select which format long double parameters have (with the mode flag:
PRINTF_LDBL_IS_DBL).  This patch uses this feature in the implementation
of some functions in argp.h, err.h, and error.h (only those that take a
format string and positional parameters).  Future patches will add
support for 'nldbl' and 'ieee128' versions of these functions.

Tested for powerpc64le and x86_64.
Diffstat (limited to 'stdio-common')
-rw-r--r--stdio-common/fxprintf.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/stdio-common/fxprintf.c b/stdio-common/fxprintf.c
index 9e71499d44..9866c8b3be 100644
--- a/stdio-common/fxprintf.c
+++ b/stdio-common/fxprintf.c
@@ -24,10 +24,11 @@
 #include <libioP.h>
 
 static int
-locked_vfxprintf (FILE *fp, const char *fmt, va_list ap)
+locked_vfxprintf (FILE *fp, const char *fmt, va_list ap,
+		  unsigned int mode_flags)
 {
   if (_IO_fwide (fp, 0) <= 0)
-    return __vfprintf_internal (fp, fmt, ap, 0);
+    return __vfprintf_internal (fp, fmt, ap, mode_flags);
 
   /* We must convert the narrow format string to a wide one.
      Each byte can produce at most one wide character.  */
@@ -53,7 +54,7 @@ locked_vfxprintf (FILE *fp, const char *fmt, va_list ap)
   res = __mbsrtowcs (wfmt, &fmt, len, &mbstate);
 
   if (res != -1)
-    res = __vfwprintf_internal (fp, wfmt, ap, 0);
+    res = __vfwprintf_internal (fp, wfmt, ap, mode_flags);
 
   if (used_malloc)
     free (wfmt);
@@ -62,12 +63,13 @@ locked_vfxprintf (FILE *fp, const char *fmt, va_list ap)
 }
 
 int
-__vfxprintf (FILE *fp, const char *fmt, va_list ap)
+__vfxprintf (FILE *fp, const char *fmt, va_list ap,
+	     unsigned int mode_flags)
 {
   if (fp == NULL)
     fp = stderr;
   _IO_flockfile (fp);
-  int res = locked_vfxprintf (fp, fmt, ap);
+  int res = locked_vfxprintf (fp, fmt, ap, mode_flags);
   _IO_funlockfile (fp);
   return res;
 }
@@ -77,7 +79,7 @@ __fxprintf (FILE *fp, const char *fmt, ...)
 {
   va_list ap;
   va_start (ap, fmt);
-  int res = __vfxprintf (fp, fmt, ap);
+  int res = __vfxprintf (fp, fmt, ap, 0);
   va_end (ap);
   return res;
 }
@@ -94,7 +96,7 @@ __fxprintf_nocancel (FILE *fp, const char *fmt, ...)
   int save_flags2 = fp->_flags2;
   fp->_flags2 |= _IO_FLAGS2_NOTCANCEL;
 
-  int res = locked_vfxprintf (fp, fmt, ap);
+  int res = locked_vfxprintf (fp, fmt, ap, 0);
 
   fp->_flags2 = save_flags2;
   _IO_funlockfile (fp);