Use the _unlocked stdio macros only when they're all available

Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Dan Fandrich 2011-06-30 02:59:17 +02:00 committed by Denys Vlasenko
parent 0c4cf42c1e
commit 75214cfe00
2 changed files with 25 additions and 21 deletions

View File

@ -161,23 +161,27 @@ int sysinfo(struct sysinfo* info);
/* Busybox does not use threads, we can speed up stdio. */ /* Busybox does not use threads, we can speed up stdio. */
#undef getc #ifdef HAVE_UNLOCKED_STDIO
#define getc(stream) getc_unlocked(stream) # undef getc
#undef getchar # define getc(stream) getc_unlocked(stream)
#define getchar() getchar_unlocked() # undef getchar
#undef putc # define getchar() getchar_unlocked()
#define putc(c, stream) putc_unlocked(c, stream) # undef putc
#undef putchar # define putc(c, stream) putc_unlocked(c, stream)
#define putchar(c) putchar_unlocked(c) # undef putchar
#undef fgetc # define putchar(c) putchar_unlocked(c)
#define fgetc(stream) getc_unlocked(stream) # undef fgetc
#undef fputc # define fgetc(stream) getc_unlocked(stream)
#define fputc(c, stream) putc_unlocked(c, stream) # undef fputc
# define fputc(c, stream) putc_unlocked(c, stream)
#endif
/* Above functions are required by POSIX.1-2008, below ones are extensions */ /* Above functions are required by POSIX.1-2008, below ones are extensions */
#undef fgets #ifdef HAVE_UNLOCKED_LINE_OPS
#define fgets(s, n, stream) fgets_unlocked(s, n, stream) # undef fgets
#undef fputs # define fgets(s, n, stream) fgets_unlocked(s, n, stream)
#define fputs(s, stream) fputs_unlocked(s, stream) # undef fputs
# define fputs(s, stream) fputs_unlocked(s, stream)
#endif
/* Make all declarations hidden (-fvisibility flag only affects definitions) */ /* Make all declarations hidden (-fvisibility flag only affects definitions) */

View File

@ -350,16 +350,14 @@ typedef unsigned smalluint;
#define HAVE_STRSIGNAL 1 #define HAVE_STRSIGNAL 1
#define HAVE_STRVERSCMP 1 #define HAVE_STRVERSCMP 1
#define HAVE_VASPRINTF 1 #define HAVE_VASPRINTF 1
#define HAVE_UNLOCKED_STDIO 1
#define HAVE_UNLOCKED_LINE_OPS 1
#define HAVE_GETLINE 1 #define HAVE_GETLINE 1
#define HAVE_XTABS 1 #define HAVE_XTABS 1
#define HAVE_MNTENT_H 1 #define HAVE_MNTENT_H 1
#define HAVE_NET_ETHERNET_H 1 #define HAVE_NET_ETHERNET_H 1
#define HAVE_SYS_STATFS_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 defined(__UCLIBC_MAJOR__)
# if __UCLIBC_MAJOR__ == 0 \ # if __UCLIBC_MAJOR__ == 0 \
&& ( __UCLIBC_MINOR__ < 9 \ && ( __UCLIBC_MINOR__ < 9 \
@ -369,7 +367,6 @@ typedef unsigned smalluint;
# endif # endif
#endif #endif
#if defined(__dietlibc__) #if defined(__dietlibc__)
# undef HAVE_STRCHRNUL # undef HAVE_STRCHRNUL
#endif #endif
@ -387,6 +384,8 @@ typedef unsigned smalluint;
# undef HAVE_STRSIGNAL # undef HAVE_STRSIGNAL
# undef HAVE_STRVERSCMP # undef HAVE_STRVERSCMP
# undef HAVE_VASPRINTF # undef HAVE_VASPRINTF
# undef HAVE_UNLOCKED_STDIO
# undef HAVE_UNLOCKED_LINE_OPS
# undef HAVE_NET_ETHERNET_H # undef HAVE_NET_ETHERNET_H
#endif #endif
@ -424,6 +423,7 @@ typedef unsigned smalluint;
# undef HAVE_STPCPY # undef HAVE_STPCPY
# undef HAVE_STRCHRNUL # undef HAVE_STRCHRNUL
# undef HAVE_STRVERSCMP # undef HAVE_STRVERSCMP
# undef HAVE_UNLOCKED_LINE_OPS
# undef HAVE_NET_ETHERNET_H # undef HAVE_NET_ETHERNET_H
#endif #endif