1#ifndef UNLOCKED_IO_H
2# define UNLOCKED_IO_H 1
3
4# ifndef USE_UNLOCKED_IO
5#  define USE_UNLOCKED_IO 1
6# endif
7
8# if USE_UNLOCKED_IO
9
10/* These are wrappers for functions/macros from GNU libc.
11   The standard I/O functions are thread-safe.  These *_unlocked ones are
12   more efficient but not thread-safe.  That they're not thread-safe is
13   fine since all of the applications in this package are single threaded.  */
14
15#  if HAVE_DECL_CLEARERR_UNLOCKED
16#   undef clearerr
17#   define clearerr(x) clearerr_unlocked (x)
18#  endif
19#  if HAVE_DECL_FEOF_UNLOCKED
20#   undef feof
21#   define feof(x) feof_unlocked (x)
22#  endif
23#  if HAVE_DECL_FERROR_UNLOCKED
24#   undef ferror
25#   define ferror(x) ferror_unlocked (x)
26#  endif
27#  if HAVE_DECL_FFLUSH_UNLOCKED
28#   undef fflush
29#   define fflush(x) fflush_unlocked (x)
30#  endif
31#  if HAVE_DECL_FGETS_UNLOCKED
32#   undef fgets
33#   define fgets(x,y,z) fgets_unlocked (x,y,z)
34#  endif
35#  if HAVE_DECL_FPUTC_UNLOCKED
36#   undef fputc
37#   define fputc(x,y) fputc_unlocked (x,y)
38#  endif
39#  if HAVE_DECL_FPUTS_UNLOCKED
40#   undef fputs
41#   define fputs(x,y) fputs_unlocked (x,y)
42#  endif
43#  if HAVE_DECL_FREAD_UNLOCKED
44#   undef fread
45#   define fread(w,x,y,z) fread_unlocked (w,x,y,z)
46#  endif
47#  if HAVE_DECL_FWRITE_UNLOCKED
48#   undef fwrite
49#   define fwrite(w,x,y,z) fwrite_unlocked (w,x,y,z)
50#  endif
51#  if HAVE_DECL_GETC_UNLOCKED
52#   undef getc
53#   define getc(x) getc_unlocked (x)
54#  endif
55#  if HAVE_DECL_GETCHAR_UNLOCKED
56#   undef getchar
57#   define getchar() getchar_unlocked ()
58#  endif
59#  if HAVE_DECL_PUTC_UNLOCKED
60#   undef putc
61#   define putc(x,y) putc_unlocked (x,y)
62#  endif
63#  if HAVE_DECL_PUTCHAR_UNLOCKED
64#   undef putchar
65#   define putchar(x) putchar_unlocked (x)
66#  endif
67
68# endif /* USE_UNLOCKED_IO */
69#endif /* UNLOCKED_IO_H */
70