This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.21-162-g1597b74


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  1597b7447a81f372068b68a7830ac83aa3b4527f (commit)
       via  627e7a5f5bd3c623108fe5a4f86294d893fadbf2 (commit)
       via  d176a41a62cad5cee4541176077380a84c0f49d7 (commit)
      from  7e7af3496ee4b13366726546dd8b712a698fa5c4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=1597b7447a81f372068b68a7830ac83aa3b4527f

commit 1597b7447a81f372068b68a7830ac83aa3b4527f
Author: Florian Weimer <fweimer@redhat.com>
Date:   Sun Mar 1 21:52:15 2015 +0100

    vfprintf: Define WORK_BUFFER_SIZE
    
    This constant will allow us to refer to the number of elements in
    work_buffer across a function call boundary.

diff --git a/ChangeLog b/ChangeLog
index 94a2402..c422a37 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,8 +2,10 @@
 
 	* stdio-common/vfprintf.c (THOUSANDS_SEP_T): New typedef.
 	(group_number, vfprintf): Use it.
-        (JUMP_TABLE_BASE_LABEL): New preprocessor macro.
-        (JUMP, REF): Use it.
+	(JUMP_TABLE_BASE_LABEL): New preprocessor macro.
+	(JUMP, REF): Use it.
+	(WORK_BUFFER_SIZE): New enum constant.
+	(process_arg, vfprintf): Use it.
 
 2015-03-06  Rical Jasan  <ricaljasan@pacific.net>
 
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index 030d33d..0e435f2 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -196,9 +196,11 @@ typedef wchar_t THOUSANDS_SEP_T;
 #endif
 
 
-/* Global variables.  */
+/* Global constants.  */
 static const CHAR_T null[] = L_("(null)");
 
+/* Size of the work_buffer variable (in characters, not bytes.  */
+enum { WORK_BUFFER_SIZE = 1000 };
 
 /* Helper function to provide temporary buffering for unbuffered streams.  */
 static int buffered_vfprintf (FILE *stream, const CHAR_T *fmt, va_list)
@@ -235,7 +237,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
   const UCHAR_T *end_of_spec;
 
   /* Buffer intermediate results.  */
-  CHAR_T work_buffer[1000];
+  CHAR_T work_buffer[WORK_BUFFER_SIZE];
   CHAR_T *workstart = NULL;
   CHAR_T *workend;
 
@@ -986,7 +988,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
       /* Print description of error ERRNO.  */				      \
       string =								      \
 	(CHAR_T *) __strerror_r (save_errno, (char *) work_buffer,	      \
-				 sizeof work_buffer);			      \
+				 WORK_BUFFER_SIZE * sizeof (CHAR_T));	      \
       is_long = 0;		/* This is no wide-char string.  */	      \
       goto LABEL (print_string)
 
@@ -1366,7 +1368,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
       CHAR_T spec;
 
       workstart = NULL;
-      workend = &work_buffer[sizeof (work_buffer) / sizeof (CHAR_T)];
+      workend = work_buffer + WORK_BUFFER_SIZE;
 
       /* Get current character in format string.  */
       JUMP (*++f, step0_jumps);
@@ -1465,7 +1467,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
 	    goto all_done;
 	  }
 
-	if (width >= sizeof (work_buffer) / sizeof (work_buffer[0]) - 32)
+	if (width >= WORK_BUFFER_SIZE - 32)
 	  {
 	    /* We have to use a special buffer.  The "32" is just a safe
 	       bet for all the output which is not counted in the width.  */
@@ -1498,7 +1500,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
 	  goto all_done;
 	}
 
-      if (width >= sizeof (work_buffer) / sizeof (work_buffer[0]) - 32)
+      if (width >= WORK_BUFFER_SIZE - 32)
 	{
 	  /* We have to use a special buffer.  The "32" is just a safe
 	     bet for all the output which is not counted in the width.  */
@@ -1564,8 +1566,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
 	}
       else
 	prec = 0;
-      if (prec > width
-	  && prec > sizeof (work_buffer) / sizeof (work_buffer[0]) - 32)
+      if (prec > width && prec > WORK_BUFFER_SIZE - 32)
 	{
 	  if (__glibc_unlikely (prec >= INT_MAX / sizeof (CHAR_T) - 32))
 	    {
@@ -1935,7 +1936,7 @@ do_positional:
 	CHAR_T spec = specs[nspecs_done].info.spec;
 
 	workstart = NULL;
-	workend = &work_buffer[sizeof (work_buffer) / sizeof (CHAR_T)];
+	workend = work_buffer + WORK_BUFFER_SIZE;
 
 	/* Fill in last information.  */
 	if (specs[nspecs_done].width_arg != -1)
@@ -1969,8 +1970,7 @@ do_positional:
 	  }
 
 	/* Maybe the buffer is too small.  */
-	if (MAX (prec, width) + 32 > (int) (sizeof (work_buffer)
-					    / sizeof (CHAR_T)))
+	if (MAX (prec, width) + 32 > WORK_BUFFER_SIZE)
 	  {
 	    if (__libc_use_alloca ((MAX (prec, width) + 32)
 				   * sizeof (CHAR_T)))

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=627e7a5f5bd3c623108fe5a4f86294d893fadbf2

commit 627e7a5f5bd3c623108fe5a4f86294d893fadbf2
Author: Florian Weimer <fweimer@redhat.com>
Date:   Sun Mar 1 21:47:31 2015 +0100

    vfprintf: Introduce JUMP_TABLE_BASE_LABEL
    
    This makes the offset handling more explicit and avoids
    cross-references between the jump tables.

diff --git a/ChangeLog b/ChangeLog
index 6c6ff44..94a2402 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,8 @@
 
 	* stdio-common/vfprintf.c (THOUSANDS_SEP_T): New typedef.
 	(group_number, vfprintf): Use it.
+        (JUMP_TABLE_BASE_LABEL): New preprocessor macro.
+        (JUMP, REF): Use it.
 
 2015-03-06  Rical Jasan  <ricaljasan@pacific.net>
 
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index d575994..030d33d 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -304,7 +304,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
 	  spec = (ChExpr);						      \
 	  offset = NOT_IN_JUMP_RANGE (spec) ? REF (form_unknown)	      \
 	    : table[CHAR_CLASS (spec)];					      \
-	  ptr = &&do_form_unknown + offset;				      \
+	  ptr = &&JUMP_TABLE_BASE_LABEL + offset;			      \
 	  goto *ptr;							      \
 	}								      \
       while (0)
@@ -1329,7 +1329,8 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
   do
     {
 #ifdef SHARED
-# define REF(Name) &&do_##Name - &&do_form_unknown
+# define JUMP_TABLE_BASE_LABEL do_form_unknown
+# define REF(Name) (&&do_##Name - &&JUMP_TABLE_BASE_LABEL)
 #else
 # define REF(Name) &&do_##Name
 #endif
@@ -1897,7 +1898,9 @@ do_positional:
       {
 #undef REF
 #ifdef SHARED
-# define REF(Name) &&do2_##Name - &&do_form_unknown
+# undef JUMP_TABLE_BASE_LABEL
+# define JUMP_TABLE_BASE_LABEL do2_form_unknown
+# define REF(Name) (&&do2_##Name - &&JUMP_TABLE_BASE_LABEL)
 #else
 # define REF(Name) &&do2_##Name
 #endif

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=d176a41a62cad5cee4541176077380a84c0f49d7

commit d176a41a62cad5cee4541176077380a84c0f49d7
Author: Florian Weimer <fweimer@redhat.com>
Date:   Fri Mar 6 10:26:58 2015 +0100

    vfprintf: Introduce THOUSANDS_SEP_T
    
    This avoids preprocessor conditionals in function declarations.

diff --git a/ChangeLog b/ChangeLog
index c7873da..6c6ff44 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-03-06  Florian Weimer  <fweimer@redhat.com>
+
+	* stdio-common/vfprintf.c (THOUSANDS_SEP_T): New typedef.
+	(group_number, vfprintf): Use it.
+
 2015-03-06  Rical Jasan  <ricaljasan@pacific.net>
 
 	* manual/errno.texi (Error Messages): Complete example function
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index a41449d..d575994 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -81,6 +81,7 @@
 # define CHAR_T		char
 # define UCHAR_T	unsigned char
 # define INT_T		int
+typedef const char *THOUSANDS_SEP_T;
 # define L_(Str)	Str
 # define ISDIGIT(Ch)	((unsigned int) ((Ch) - '0') < 10)
 # define STR_LEN(Str)	strlen (Str)
@@ -108,6 +109,7 @@
 /* This is a hack!!!  There should be a type uwchar_t.  */
 # define UCHAR_T	unsigned int /* uwchar_t */
 # define INT_T		wint_t
+typedef wchar_t THOUSANDS_SEP_T;
 # define L_(Str)	L##Str
 # define ISDIGIT(Ch)	((unsigned int) ((Ch) - L'0') < 10)
 # define STR_LEN(Str)	__wcslen (Str)
@@ -207,25 +209,15 @@ static int printf_unknown (FILE *, const struct printf_info *,
 			   const void *const *) __THROW;
 
 /* Group digits of number string.  */
-#ifdef COMPILE_WPRINTF
-static CHAR_T *group_number (CHAR_T *, CHAR_T *, const char *, wchar_t)
-     __THROW internal_function;
-#else
-static CHAR_T *group_number (CHAR_T *, CHAR_T *, const char *, const char *)
+static CHAR_T *group_number (CHAR_T *, CHAR_T *, const char *, THOUSANDS_SEP_T)
      __THROW internal_function;
-#endif
-
 
 /* The function itself.  */
 int
 vfprintf (FILE *s, const CHAR_T *format, va_list ap)
 {
   /* The character used as thousands separator.  */
-#ifdef COMPILE_WPRINTF
-  wchar_t thousands_sep = L'\0';
-#else
-  const char *thousands_sep = NULL;
-#endif
+  THOUSANDS_SEP_T thousands_sep = 0;
 
   /* The string describing the size of groups of digits.  */
   const char *grouping;
@@ -2150,12 +2142,7 @@ printf_unknown (FILE *s, const struct printf_info *info,
 static CHAR_T *
 internal_function
 group_number (CHAR_T *w, CHAR_T *rear_ptr, const char *grouping,
-#ifdef COMPILE_WPRINTF
-	      wchar_t thousands_sep
-#else
-	      const char *thousands_sep
-#endif
-	      )
+	      THOUSANDS_SEP_T thousands_sep)
 {
   int len;
   CHAR_T *src, *s;

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog               |    9 +++++++
 stdio-common/vfprintf.c |   54 +++++++++++++++++++---------------------------
 2 files changed, 31 insertions(+), 32 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]