diff options
author | Dan Fandrich | 2011-06-30 02:59:17 +0200 |
---|---|---|
committer | Denys Vlasenko | 2011-06-30 02:59:17 +0200 |
commit | 75214cfe00c72c51c67c9ac2541f06b0540136f1 (patch) | |
tree | 98b611e6152e59a4cab9c0a44bef43a67aacc476 /include/libbb.h | |
parent | 0c4cf42c1e4fbb5af8952cfbec926fe7d7b318d5 (diff) | |
download | busybox-75214cfe00c72c51c67c9ac2541f06b0540136f1.zip busybox-75214cfe00c72c51c67c9ac2541f06b0540136f1.tar.gz |
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>
Diffstat (limited to 'include/libbb.h')
-rw-r--r-- | include/libbb.h | 36 |
1 files changed, 20 insertions, 16 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) */ |