aboutsummaryrefslogtreecommitdiff
path: root/include/libbb.h
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2011-06-30 02:59:17 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2011-06-30 02:59:17 +0200
commit75214cfe00c72c51c67c9ac2541f06b0540136f1 (patch)
tree98b611e6152e59a4cab9c0a44bef43a67aacc476 /include/libbb.h
parent0c4cf42c1e4fbb5af8952cfbec926fe7d7b318d5 (diff)
downloadbusybox-w32-75214cfe00c72c51c67c9ac2541f06b0540136f1.tar.gz
busybox-w32-75214cfe00c72c51c67c9ac2541f06b0540136f1.tar.bz2
busybox-w32-75214cfe00c72c51c67c9ac2541f06b0540136f1.zip
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.h36
1 files changed, 20 insertions, 16 deletions
diff --git a/include/libbb.h b/include/libbb.h
index efb925eaf..1502272f6 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -161,23 +161,27 @@ int sysinfo(struct sysinfo* info);
161 161
162 162
163/* Busybox does not use threads, we can speed up stdio. */ 163/* Busybox does not use threads, we can speed up stdio. */
164#undef getc 164#ifdef HAVE_UNLOCKED_STDIO
165#define getc(stream) getc_unlocked(stream) 165# undef getc
166#undef getchar 166# define getc(stream) getc_unlocked(stream)
167#define getchar() getchar_unlocked() 167# undef getchar
168#undef putc 168# define getchar() getchar_unlocked()
169#define putc(c, stream) putc_unlocked(c, stream) 169# undef putc
170#undef putchar 170# define putc(c, stream) putc_unlocked(c, stream)
171#define putchar(c) putchar_unlocked(c) 171# undef putchar
172#undef fgetc 172# define putchar(c) putchar_unlocked(c)
173#define fgetc(stream) getc_unlocked(stream) 173# undef fgetc
174#undef fputc 174# define fgetc(stream) getc_unlocked(stream)
175#define fputc(c, stream) putc_unlocked(c, stream) 175# undef fputc
176# define fputc(c, stream) putc_unlocked(c, stream)
177#endif
176/* Above functions are required by POSIX.1-2008, below ones are extensions */ 178/* Above functions are required by POSIX.1-2008, below ones are extensions */
177#undef fgets 179#ifdef HAVE_UNLOCKED_LINE_OPS
178#define fgets(s, n, stream) fgets_unlocked(s, n, stream) 180# undef fgets
179#undef fputs 181# define fgets(s, n, stream) fgets_unlocked(s, n, stream)
180#define fputs(s, stream) fputs_unlocked(s, stream) 182# undef fputs
183# define fputs(s, stream) fputs_unlocked(s, stream)
184#endif
181 185
182 186
183/* Make all declarations hidden (-fvisibility flag only affects definitions) */ 187/* Make all declarations hidden (-fvisibility flag only affects definitions) */