summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2011-06-30 00:44:27 (GMT)
committer Denys Vlasenko <vda.linux@googlemail.com>2011-06-30 00:44:27 (GMT)
commit0c4cf42c1e4fbb5af8952cfbec926fe7d7b318d5 (patch)
tree9151f3494f4b2d4f192769dfa4c57ec031896494
parent0e79e7bb420c58fa8e5d2d88c5d3a26f94c761af (diff)
downloadbusybox-0c4cf42c1e4fbb5af8952cfbec926fe7d7b318d5.tar.gz
busybox-0c4cf42c1e4fbb5af8952cfbec926fe7d7b318d5.tar.bz2
libbb.h: tweak _unlocked hack
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--include/libbb.h54
1 files changed, 18 insertions, 36 deletions
diff --git a/include/libbb.h b/include/libbb.h
index 963ae1e..efb925e 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -160,42 +160,24 @@ int sysinfo(struct sysinfo* info);
#endif
-/* Busybox does not use threads, we can speed up stdio.
- * But don't define foo to foo_unlocked if foo_unlocked
- * is a macro (it might be defined back to foo!).
- */
-#ifndef getc_unlocked
-# undef getc
-# define getc(stream) getc_unlocked(stream)
-#endif
-#ifndef getchar_unlocked
-# undef getchar
-# define getchar() getchar_unlocked()
-#endif
-#ifndef putc_unlocked
-# undef putc
-# define putc(c, stream) putc_unlocked(c, stream)
-#endif
-#ifndef putchar_unlocked
-# undef putchar
-# define putchar(c) putchar_unlocked(c)
-#endif
-#ifndef fgetc_unlocked
-# undef fgetc
-# define fgetc(stream) fgetc_unlocked(stream)
-#endif
-#ifndef fputc_unlocked
-# undef fputc
-# define fputc(c, stream) fputc_unlocked(c, stream)
-#endif
-#ifndef fgets_unlocked
-# undef fgets
-# define fgets(s, n, stream) fgets_unlocked(s, n, stream)
-#endif
-#ifndef fputs_unlocked
-# undef fputs
-# define fputs(s, stream) fputs_unlocked(s, stream)
-#endif
+/* 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)
+/* 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)
/* Make all declarations hidden (-fvisibility flag only affects definitions) */