[git commit] Use the _unlocked stdio macros only when they're all available

Denys Vlasenko vda.linux at googlemail.com
Thu Jun 30 00:59:17 UTC 2011


commit: http://git.busybox.net/busybox/commit/?id=75214cfe00c72c51c67c9ac2541f06b0540136f1
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Dan Fandrich <dan at coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 include/libbb.h    |   36 ++++++++++++++++++++----------------
 include/platform.h |   10 +++++-----
 2 files changed, 25 insertions(+), 21 deletions(-)

diff --git a/include/libbb.h b/include/libbb.h
index efb925e..1502272 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -161,23 +161,27 @@ int sysinfo(struct sysinfo* info);
 
 
 /* Busybox does not use threads, we can speed up stdio. */
-#undef  getc
-#define getc(stream) getc_unlocked(stream)
-#undef  getchar
-#define getchar() getchar_unlocked()
-#undef  putc
-#define putc(c, stream) putc_unlocked(c, stream)
-#undef  putchar
-#define putchar(c) putchar_unlocked(c)
-#undef  fgetc
-#define fgetc(stream) getc_unlocked(stream)
-#undef  fputc
-#define fputc(c, stream) putc_unlocked(c, stream)
+#ifdef HAVE_UNLOCKED_STDIO
+# undef  getc
+# define getc(stream) getc_unlocked(stream)
+# undef  getchar
+# define getchar() getchar_unlocked()
+# undef  putc
+# define putc(c, stream) putc_unlocked(c, stream)
+# undef  putchar
+# define putchar(c) putchar_unlocked(c)
+# undef  fgetc
+# define fgetc(stream) getc_unlocked(stream)
+# undef  fputc
+# define fputc(c, stream) putc_unlocked(c, stream)
+#endif
 /* Above functions are required by POSIX.1-2008, below ones are extensions */
-#undef  fgets
-#define fgets(s, n, stream) fgets_unlocked(s, n, stream)
-#undef  fputs
-#define fputs(s, stream) fputs_unlocked(s, stream)
+#ifdef HAVE_UNLOCKED_LINE_OPS
+# undef  fgets
+# define fgets(s, n, stream) fgets_unlocked(s, n, stream)
+# undef  fputs
+# define fputs(s, stream) fputs_unlocked(s, stream)
+#endif
 
 
 /* Make all declarations hidden (-fvisibility flag only affects definitions) */
diff --git a/include/platform.h b/include/platform.h
index d186e49..60864c9 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -350,16 +350,14 @@ typedef unsigned smalluint;
 #define HAVE_STRSIGNAL 1
 #define HAVE_STRVERSCMP 1
 #define HAVE_VASPRINTF 1
+#define HAVE_UNLOCKED_STDIO 1
+#define HAVE_UNLOCKED_LINE_OPS 1
 #define HAVE_GETLINE 1
 #define HAVE_XTABS 1
 #define HAVE_MNTENT_H 1
 #define HAVE_NET_ETHERNET_H 1
 #define HAVE_SYS_STATFS_H 1
 
-#if defined(__GLIBC__) && (__GLIBC__ < 2 || __GLIBC_MINOR__ < 1)
-# undef HAVE_NET_ETHERNET_H
-#endif
-
 #if defined(__UCLIBC_MAJOR__)
 # if __UCLIBC_MAJOR__ == 0 \
   && (   __UCLIBC_MINOR__ < 9 \
@@ -369,7 +367,6 @@ typedef unsigned smalluint;
 # endif
 #endif
 
-
 #if defined(__dietlibc__)
 # undef HAVE_STRCHRNUL
 #endif
@@ -387,6 +384,8 @@ typedef unsigned smalluint;
 # undef HAVE_STRSIGNAL
 # undef HAVE_STRVERSCMP
 # undef HAVE_VASPRINTF
+# undef HAVE_UNLOCKED_STDIO
+# undef HAVE_UNLOCKED_LINE_OPS
 # undef HAVE_NET_ETHERNET_H
 #endif
 
@@ -424,6 +423,7 @@ typedef unsigned smalluint;
 # undef HAVE_STPCPY
 # undef HAVE_STRCHRNUL
 # undef HAVE_STRVERSCMP
+# undef HAVE_UNLOCKED_LINE_OPS
 # undef HAVE_NET_ETHERNET_H
 #endif
 
-- 
1.7.3.4



More information about the busybox-cvs mailing list