1 /* Prefer faster, non-thread-safe stdio functions if available.
3 Copyright (C) 2001, 2002 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify it
6 under the terms of the GNU Library General Public License as published
7 by the Free Software Foundation; either version 2, or (at your option)
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20 /* Written by Jim Meyering. */
23 # define UNLOCKED_IO_H 1
25 # ifndef USE_UNLOCKED_IO
26 # define USE_UNLOCKED_IO 1
31 /* These are wrappers for functions/macros from GNU libc.
32 The standard I/O functions are thread-safe. These *_unlocked ones are
33 more efficient but not thread-safe. That they're not thread-safe is
34 fine since all of the applications in this package are single threaded. */
36 # if HAVE_DECL_CLEARERR_UNLOCKED
38 # define clearerr(x) clearerr_unlocked (x)
40 # if HAVE_DECL_FEOF_UNLOCKED
42 # define feof(x) feof_unlocked (x)
44 # if HAVE_DECL_FERROR_UNLOCKED
46 # define ferror(x) ferror_unlocked (x)
48 # if HAVE_DECL_FFLUSH_UNLOCKED
50 # define fflush(x) fflush_unlocked (x)
52 # if HAVE_DECL_FGETS_UNLOCKED
54 # define fgets(x,y,z) fgets_unlocked (x,y,z)
56 # if HAVE_DECL_FPUTC_UNLOCKED
58 # define fputc(x,y) fputc_unlocked (x,y)
60 # if HAVE_DECL_FPUTS_UNLOCKED
62 # define fputs(x,y) fputs_unlocked (x,y)
64 # if HAVE_DECL_FREAD_UNLOCKED
66 # define fread(w,x,y,z) fread_unlocked (w,x,y,z)
68 # if HAVE_DECL_FWRITE_UNLOCKED
70 # define fwrite(w,x,y,z) fwrite_unlocked (w,x,y,z)
72 # if HAVE_DECL_GETC_UNLOCKED
74 # define getc(x) getc_unlocked (x)
76 # if HAVE_DECL_GETCHAR_UNLOCKED
78 # define getchar() getchar_unlocked ()
80 # if HAVE_DECL_PUTC_UNLOCKED
82 # define putc(x,y) putc_unlocked (x,y)
84 # if HAVE_DECL_PUTCHAR_UNLOCKED
86 # define putchar(x) putchar_unlocked (x)
89 # endif /* USE_UNLOCKED_IO */
90 #endif /* UNLOCKED_IO_H */