[git commit] *_strerror_r.c: keep all occurences in sync with string.h

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Fri Jun 15 12:00:27 UTC 2012


commit: http://git.uclibc.org/uClibc/commit/?id=938467ad2d9972c8d7ddcbde5dd9fe634da1ca3b
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master

libc-internal.h: this has to provide the reversed case of what string.h defines.
Accomodate for later possibility to compile without _GNU_SOURCE defined

Signed-off-by: Peter S. Mazinger <ps.m at gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
---
 include/libc-internal.h          |    8 ++++----
 libc/string/__glibc_strerror_r.c |    7 +++++++
 libc/string/__xpg_strerror_r.c   |    9 ++++++++-
 3 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/include/libc-internal.h b/include/libc-internal.h
index dfd1dfc..74c3542 100644
--- a/include/libc-internal.h
+++ b/include/libc-internal.h
@@ -44,12 +44,12 @@
 #  include <stddef.h>
 
 /* sources are built w/ _GNU_SOURCE, this gets undefined */
-#ifdef __USE_GNU
-extern int __xpg_strerror_r (int __errnum, char *__buf, size_t __buflen);
-libc_hidden_proto(__xpg_strerror_r)
-#else
+#if defined __USE_XOPEN2K && !defined  __USE_GNU
 extern char *__glibc_strerror_r (int __errnum, char *__buf, size_t __buflen);
 libc_hidden_proto(__glibc_strerror_r)
+#else
+extern int __xpg_strerror_r (int __errnum, char *__buf, size_t __buflen);
+libc_hidden_proto(__xpg_strerror_r)
 #endif
 
 /* #include <pthread.h> */
diff --git a/libc/string/__glibc_strerror_r.c b/libc/string/__glibc_strerror_r.c
index e97e552..96b8817 100644
--- a/libc/string/__glibc_strerror_r.c
+++ b/libc/string/__glibc_strerror_r.c
@@ -5,9 +5,13 @@
  * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  */
 
+/* get rid of REDIRECT */
+#define strerror_r __hide_strerror_r
+
 #include <features.h>
 #include <string.h>
 
+#undef strerror_r
 
 char *__glibc_strerror_r(int errnum, char *strerrbuf, size_t buflen)
 {
@@ -16,3 +20,6 @@ char *__glibc_strerror_r(int errnum, char *strerrbuf, size_t buflen)
     return strerrbuf;
 }
 libc_hidden_def(__glibc_strerror_r)
+#if !defined __USE_XOPEN2K || defined __USE_GNU
+strong_alias(__glibc_strerror_r,strerror_r)
+#endif
diff --git a/libc/string/__xpg_strerror_r.c b/libc/string/__xpg_strerror_r.c
index 5979b1e..3e78da1 100644
--- a/libc/string/__xpg_strerror_r.c
+++ b/libc/string/__xpg_strerror_r.c
@@ -5,11 +5,16 @@
  * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  */
 
+/* get rid of REDIRECT */
+#define strerror_r __hide_strerror_r
+
 #include <features.h>
 #include <errno.h>
 #include <string.h>
 #include "_syserrmsg.h"
 
+#undef strerror_r
+
 #ifdef __UCLIBC_HAS_ERRNO_MESSAGES__
 
 extern const char _string_syserrmsgs[] attribute_hidden;
@@ -267,4 +272,6 @@ int __xpg_strerror_r(int errnum, char *strerrbuf, size_t buflen)
 
 #endif /* __UCLIBC_HAS_ERRNO_MESSAGES__ */
 libc_hidden_def(__xpg_strerror_r)
-strong_alias_untyped(__xpg_strerror_r, strerror_r)
+#if defined __USE_XOPEN2K && !defined __USE_GNU
+strong_alias(__xpg_strerror_r,strerror_r)
+#endif


More information about the uClibc-cvs mailing list