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.13-214-gadcd5c1


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  adcd5c15d2a37794d021104160b425ff61f88219 (commit)
      from  7ea72f99966a65a56aedba817ee2413ff9b1f23c (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=adcd5c15d2a37794d021104160b425ff61f88219

commit adcd5c15d2a37794d021104160b425ff61f88219
Author: Ulrich Drepper <drepper@gmail.com>
Date:   Sat May 21 16:19:06 2011 -0400

    Fix last change
    
    And optimize a bit.

diff --git a/string/xpg-strerror.c b/string/xpg-strerror.c
index 00256c3..10fc1bf 100644
--- a/string/xpg-strerror.c
+++ b/string/xpg-strerror.c
@@ -19,20 +19,10 @@
 
 #include <assert.h>
 #include <errno.h>
-#include <libintl.h>
 #include <stdio.h>
 #include <string.h>
 #include <sys/param.h>
-#include <stdio-common/_itoa.h>
 
-/* It is critical here that we always use the `dcgettext' function for
-   the message translation.  Since <libintl.h> only defines the macro
-   `dgettext' to use `dcgettext' for optimizing programs this is not
-   always guaranteed.  */
-#ifndef dgettext
-# include <locale.h>		/* We need LC_MESSAGES.  */
-# define dgettext(domainname, msgid) dcgettext (domainname, msgid, LC_MESSAGES)
-#endif
 
 /* Fill buf with a string describing the errno code in ERRNUM.  */
 int
@@ -41,13 +31,18 @@ __xpg_strerror_r (int errnum, char *buf, size_t buflen)
   const char *estr = __strerror_r (errnum, buf, buflen);
   size_t estrlen = strlen (estr);
 
-  if (errnum < 0 || errnum >= _sys_nerr_internal
-      || _sys_errlist_internal[errnum] == NULL)
-    return EINVAL;
-
-  assert (estr != buf);
-/* Terminate the string in any case.  */
-  *((char *) __mempcpy (buf, estr, MIN (buflen - 1, estrlen))) = '\0';
+  if (estr == buf)
+    {
+      assert (errnum < 0 || errnum >= _sys_nerr_internal
+	      || _sys_errlist_internal[errnum] == NULL);
+      return EINVAL;
+    }
+  assert (errnum >= 0 && errnum < _sys_nerr_internal
+	  && _sys_errlist_internal[errnum] != NULL);
+
+  /* Terminate the string in any case.  */
+  if (buflen > 0)
+    *((char *) __mempcpy (buf, estr, MIN (buflen - 1, estrlen))) = '\0';
 
   return buflen <= estrlen ? ERANGE : 0;
 }

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

Summary of changes:
 string/xpg-strerror.c |   29 ++++++++++++-----------------
 1 files changed, 12 insertions(+), 17 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]