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.17-330-ge1b4269


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  e1b42695eaea6518a632ab02b83f1e4c502a0d13 (commit)
      from  2d67d91ac08aa2f793d220ad8712541fefa0ba79 (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://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=e1b42695eaea6518a632ab02b83f1e4c502a0d13

commit e1b42695eaea6518a632ab02b83f1e4c502a0d13
Author: Paul Pluzhnikov <ppluzhnikov@google.com>
Date:   Tue Mar 5 21:38:19 2013 -0800

    Replace __builtin_expect(..., 0) with __glibc_unlikely().

diff --git a/ChangeLog b/ChangeLog
index e7fa53a..f1e8b4f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-03-06  Paul Pluzhnikov  <ppluzhnikov@google.com>
+
+	* stdio-common/vfprintf.c: Replace __builtin_expect with
+	__glibc_unlikely.
+
 2013-03-06  Joseph Myers  <joseph@codesourcery.com>
 
 	[BZ #13550]
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index 7042090..c8bcf5a 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -67,7 +67,7 @@
   do {									      \
     unsigned int _val = val;						      \
     assert ((unsigned int) done < (unsigned int) INT_MAX);		      \
-    if (__builtin_expect (INT_MAX - done < _val, 0))			      \
+    if (__glibc_unlikely (INT_MAX - done < _val))			      \
       {									      \
 	done = -1;							      \
 	 __set_errno (EOVERFLOW);					      \
@@ -91,7 +91,7 @@
     if (width > 0)							      \
       {									      \
 	unsigned int d = _IO_padn (s, (Padchar), width);		      \
-	if (__builtin_expect (d == EOF, 0))				      \
+	if (__glibc_unlikely (d == EOF))				      \
 	  {								      \
 	    done = -1;							      \
 	    goto all_done;						      \
@@ -120,7 +120,7 @@
     if (width > 0)							      \
       {									      \
 	unsigned int d = _IO_wpadn (s, (Padchar), width);		      \
-	if (__builtin_expect (d == EOF, 0))				      \
+	if (__glibc_unlikely (d == EOF))				      \
 	  {								      \
 	    done = -1;							      \
 	    goto all_done;						      \
@@ -166,7 +166,7 @@
 	  done = -1;							      \
 	  goto all_done;						      \
 	}								      \
-      if (__builtin_expect (INT_MAX - done < (Len), 0))			      \
+      if (__glibc_unlikely (INT_MAX - done < (Len)))			      \
       {									      \
 	done = -1;							      \
 	 __set_errno (EOVERFLOW);					      \
@@ -1108,7 +1108,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
 	outstring (string, len);					      \
 	if (left)							      \
 	  PAD (L' ');							      \
-	if (__builtin_expect (string_malloced, 0))			      \
+	if (__glibc_unlikely (string_malloced))				      \
 	  free (string);						      \
       }									      \
       break;
@@ -1254,7 +1254,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
 	outstring (string, len);					      \
 	if (left)							      \
 	  PAD (' ');							      \
-	if (__builtin_expect (string_malloced, 0))			      \
+	if (__glibc_unlikely (string_malloced))			              \
 	  free (string);						      \
       }									      \
       break;
@@ -1315,9 +1315,9 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
     goto all_done;
 
   /* Use the slow path in case any printf handler is registered.  */
-  if (__builtin_expect (__printf_function_table != NULL
+  if (__glibc_unlikely (__printf_function_table != NULL
 			|| __printf_modifier_table != NULL
-			|| __printf_va_arg_table != NULL, 0))
+			|| __printf_va_arg_table != NULL))
     goto do_positional;
 
   /* Process whole format string.  */
@@ -1452,7 +1452,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
 	    left = 1;
 	  }
 
-	if (__builtin_expect (width >= INT_MAX / sizeof (CHAR_T) - 32, 0))
+	if (__glibc_unlikely (width >= INT_MAX / sizeof (CHAR_T) - 32))
 	  {
 	    __set_errno (EOVERFLOW);
 	    done = -1;
@@ -1484,8 +1484,8 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
     LABEL (width):
       width = read_int (&f);
 
-      if (__builtin_expect (width == -1
-			    || width >= INT_MAX / sizeof (CHAR_T) - 32, 0))
+      if (__glibc_unlikely (width == -1
+			    || width >= INT_MAX / sizeof (CHAR_T) - 32))
 	{
 	  __set_errno (EOVERFLOW);
 	  done = -1;
@@ -1561,7 +1561,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
       if (prec > width
 	  && prec > sizeof (work_buffer) / sizeof (work_buffer[0]) - 32)
 	{
-	  if (__builtin_expect (prec >= INT_MAX / sizeof (CHAR_T) - 32, 0))
+	  if (__glibc_unlikely (prec >= INT_MAX / sizeof (CHAR_T) - 32))
 	    {
 	      __set_errno (EOVERFLOW);
 	      done = -1;
@@ -1645,7 +1645,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
       /* The format is correctly handled.  */
       ++nspecs_done;
 
-      if (__builtin_expect (workstart != NULL, 0))
+      if (__glibc_unlikely (workstart != NULL))
 	free (workstart);
       workstart = NULL;
 
@@ -1691,7 +1691,7 @@ do_positional:
     /* Just a counter.  */
     size_t cnt;
 
-    if (__builtin_expect (workstart != NULL, 0))
+    if (__glibc_unlikely (workstart != NULL))
       free (workstart);
     workstart = NULL;
 
@@ -1737,7 +1737,7 @@ do_positional:
 		     + sizeof (*args_type));
 
     /* Check for potential integer overflow.  */
-    if (__builtin_expect (nargs > INT_MAX / bytes_per_arg, 0))
+    if (__glibc_unlikely (nargs > INT_MAX / bytes_per_arg))
       {
 	 __set_errno (EOVERFLOW);
 	 done = -1;
@@ -1842,7 +1842,7 @@ do_positional:
 	default:
 	  if ((args_type[cnt] & PA_FLAG_PTR) != 0)
 	    args_value[cnt].pa_pointer = va_arg (ap_save, void *);
-	  else if (__builtin_expect (__printf_va_arg_table != NULL, 0)
+	  else if (__glibc_unlikely (__printf_va_arg_table != NULL)
 		   && __printf_va_arg_table[args_type[cnt] - PA_LAST] != NULL)
 	    {
 	      args_value[cnt].pa_user = alloca (args_size[cnt]);
@@ -2027,7 +2027,7 @@ do_positional:
 	    break;
 	  }
 
-	if (__builtin_expect (workstart != NULL, 0))
+	if (__glibc_unlikely (workstart != NULL))
 	  free (workstart);
 	workstart = NULL;
 
@@ -2039,9 +2039,9 @@ do_positional:
   }
 
 all_done:
-  if (__builtin_expect (args_malloced != NULL, 0))
+  if (__glibc_unlikely (args_malloced != NULL))
     free (args_malloced);
-  if (__builtin_expect (workstart != NULL, 0))
+  if (__glibc_unlikely (workstart != NULL))
     free (workstart);
   /* Unlock the stream.  */
   _IO_funlockfile (s);

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

Summary of changes:
 ChangeLog               |    5 +++++
 stdio-common/vfprintf.c |   38 +++++++++++++++++++-------------------
 2 files changed, 24 insertions(+), 19 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]