[git commit future 1/1] err.c, err.h: no need for hidden functions

Peter S. Mazinger ps.m at gmx.net
Wed Mar 16 19:20:32 UTC 2011


commit: http://git.uclibc.org/uClibc/commit/?id=09dea0d4c5d3f8793c5dff5abdffe92fe35f3831
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future

Since we reuse the functions in the same file, provide static __X()
and use strong_alias to provide the visible functions.

Signed-off-by: Peter S. Mazinger <ps.m at gmx.net>
---
 include/err.h         |    4 ----
 libc/misc/error/err.c |   32 ++++++++++++++++----------------
 2 files changed, 16 insertions(+), 20 deletions(-)

diff --git a/include/err.h b/include/err.h
index 413e1ab..7ff3553 100644
--- a/include/err.h
+++ b/include/err.h
@@ -36,26 +36,22 @@ extern void warn (__const char *__format, ...)
      __attribute__ ((__format__ (__printf__, 1, 2)));
 extern void vwarn (__const char *__format, __gnuc_va_list)
      __attribute__ ((__format__ (__printf__, 1, 0)));
-libc_hidden_proto(vwarn)
 
 /* Likewise, but without ": " and the standard error string.  */
 extern void warnx (__const char *__format, ...)
      __attribute__ ((__format__ (__printf__, 1, 2)));
 extern void vwarnx (__const char *__format, __gnuc_va_list)
      __attribute__ ((__format__ (__printf__, 1, 0)));
-libc_hidden_proto(vwarnx)
 
 /* Likewise, and then exit with STATUS.  */
 extern void err (int __status, __const char *__format, ...)
      __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)));
 extern void verr (int __status, __const char *__format, __gnuc_va_list)
      __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));
-libc_hidden_proto(verr)
 extern void errx (int __status, __const char *__format, ...)
      __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)));
 extern void verrx (int __status, __const char *, __gnuc_va_list)
      __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));
-libc_hidden_proto(verrx)
 
 __END_DECLS
 
diff --git a/libc/misc/error/err.c b/libc/misc/error/err.c
index 9ddb596..76f66f3 100644
--- a/libc/misc/error/err.c
+++ b/libc/misc/error/err.c
@@ -50,68 +50,68 @@ static void vwarn_work(const char *format, va_list args, int showerr)
 	__STDIO_AUTO_THREADUNLOCK(stderr);
 }
 
-void vwarn(const char *format, va_list args)
+static void __vwarn(const char *format, va_list args)
 {
 	vwarn_work(format, args, 1);
 }
-libc_hidden_def(vwarn)
+strong_alias(__vwarn,vwarn)
 
 void warn(const char *format, ...)
 {
 	va_list args;
 
 	va_start(args, format);
-	vwarn(format, args);
+	__vwarn(format, args);
 	va_end(args);
 }
 
-void vwarnx(const char *format, va_list args)
+static void __vwarnx(const char *format, va_list args)
 {
 	vwarn_work(format, args, 0);
 }
-libc_hidden_def(vwarnx)
+strong_alias(__vwarnx,vwarnx)
 
 void warnx(const char *format, ...)
 {
 	va_list args;
 
 	va_start(args, format);
-	vwarnx(format, args);
+	__vwarnx(format, args);
 	va_end(args);
 }
 
-void verr(int status, const char *format, va_list args)
+static void __verr(int status, const char *format, va_list args)
 {
-	vwarn(format, args);
+	__vwarn(format, args);
 	exit(status);
 }
-libc_hidden_def(verr)
+strong_alias(__verr,verr)
 
-void attribute_noreturn err(int status, const char *format, ...)
+void err(int status, const char *format, ...)
 {
 	va_list args;
 
 	va_start(args, format);
-	verr(status, format, args);
+	__verr(status, format, args);
 	/* This should get optimized away.  We'll leave it now for safety. */
 	/* The loop is added only to keep gcc happy. */
 	while(1)
 		va_end(args);
 }
 
-void verrx(int status, const char *format, va_list args)
+static void __verrx(int status, const char *format, va_list args)
 {
-	vwarnx(format, args);
+	__vwarnx(format, args);
 	exit(status);
 }
-libc_hidden_def(verrx)
+strong_alias(__verrx,verrx)
 
-void attribute_noreturn errx(int status, const char *format, ...)
+void errx(int status, const char *format, ...)
 {
 	va_list args;
 
 	va_start(args, format);
-	verrx(status, format, args);
+	__verrx(status, format, args);
 	/* This should get optimized away.  We'll leave it now for safety. */
 	/* The loop is added only to keep gcc happy. */
 	while(1)
-- 
1.7.3.4



More information about the uClibc-cvs mailing list