Blame gettext-runtime/gnulib-lib/unlocked-io.h

Packit Bot 06c835
/* Prefer faster, non-thread-safe stdio functions if available.
Packit Bot 06c835
Packit Bot 06c835
   Copyright (C) 2001-2004, 2009-2015 Free Software Foundation, Inc.
Packit Bot 06c835
Packit Bot 06c835
   This program is free software: you can redistribute it and/or modify
Packit Bot 06c835
   it under the terms of the GNU General Public License as published by
Packit Bot 06c835
   the Free Software Foundation; either version 3 of the License, or
Packit Bot 06c835
   (at your option) any later version.
Packit Bot 06c835
Packit Bot 06c835
   This program is distributed in the hope that it will be useful,
Packit Bot 06c835
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Bot 06c835
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Bot 06c835
   GNU General Public License for more details.
Packit Bot 06c835
Packit Bot 06c835
   You should have received a copy of the GNU General Public License
Packit Bot 06c835
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
Packit Bot 06c835
Packit Bot 06c835
/* Written by Jim Meyering.  */
Packit Bot 06c835
Packit Bot 06c835
#ifndef UNLOCKED_IO_H
Packit Bot 06c835
# define UNLOCKED_IO_H 1
Packit Bot 06c835
Packit Bot 06c835
/* These are wrappers for functions/macros from the GNU C library, and
Packit Bot 06c835
   from other C libraries supporting POSIX's optional thread-safe functions.
Packit Bot 06c835
Packit Bot 06c835
   The standard I/O functions are thread-safe.  These *_unlocked ones are
Packit Bot 06c835
   more efficient but not thread-safe.  That they're not thread-safe is
Packit Bot 06c835
   fine since all of the applications in this package are single threaded.
Packit Bot 06c835
Packit Bot 06c835
   Also, some code that is shared with the GNU C library may invoke
Packit Bot 06c835
   the *_unlocked functions directly.  On hosts that lack those
Packit Bot 06c835
   functions, invoke the non-thread-safe versions instead.  */
Packit Bot 06c835
Packit Bot 06c835
# include <stdio.h>
Packit Bot 06c835
Packit Bot 06c835
# if HAVE_DECL_CLEARERR_UNLOCKED
Packit Bot 06c835
#  undef clearerr
Packit Bot 06c835
#  define clearerr(x) clearerr_unlocked (x)
Packit Bot 06c835
# else
Packit Bot 06c835
#  define clearerr_unlocked(x) clearerr (x)
Packit Bot 06c835
# endif
Packit Bot 06c835
Packit Bot 06c835
# if HAVE_DECL_FEOF_UNLOCKED
Packit Bot 06c835
#  undef feof
Packit Bot 06c835
#  define feof(x) feof_unlocked (x)
Packit Bot 06c835
# else
Packit Bot 06c835
#  define feof_unlocked(x) feof (x)
Packit Bot 06c835
# endif
Packit Bot 06c835
Packit Bot 06c835
# if HAVE_DECL_FERROR_UNLOCKED
Packit Bot 06c835
#  undef ferror
Packit Bot 06c835
#  define ferror(x) ferror_unlocked (x)
Packit Bot 06c835
# else
Packit Bot 06c835
#  define ferror_unlocked(x) ferror (x)
Packit Bot 06c835
# endif
Packit Bot 06c835
Packit Bot 06c835
# if HAVE_DECL_FFLUSH_UNLOCKED
Packit Bot 06c835
#  undef fflush
Packit Bot 06c835
#  define fflush(x) fflush_unlocked (x)
Packit Bot 06c835
# else
Packit Bot 06c835
#  define fflush_unlocked(x) fflush (x)
Packit Bot 06c835
# endif
Packit Bot 06c835
Packit Bot 06c835
# if HAVE_DECL_FGETS_UNLOCKED
Packit Bot 06c835
#  undef fgets
Packit Bot 06c835
#  define fgets(x,y,z) fgets_unlocked (x,y,z)
Packit Bot 06c835
# else
Packit Bot 06c835
#  define fgets_unlocked(x,y,z) fgets (x,y,z)
Packit Bot 06c835
# endif
Packit Bot 06c835
Packit Bot 06c835
# if HAVE_DECL_FPUTC_UNLOCKED
Packit Bot 06c835
#  undef fputc
Packit Bot 06c835
#  define fputc(x,y) fputc_unlocked (x,y)
Packit Bot 06c835
# else
Packit Bot 06c835
#  define fputc_unlocked(x,y) fputc (x,y)
Packit Bot 06c835
# endif
Packit Bot 06c835
Packit Bot 06c835
# if HAVE_DECL_FPUTS_UNLOCKED
Packit Bot 06c835
#  undef fputs
Packit Bot 06c835
#  define fputs(x,y) fputs_unlocked (x,y)
Packit Bot 06c835
# else
Packit Bot 06c835
#  define fputs_unlocked(x,y) fputs (x,y)
Packit Bot 06c835
# endif
Packit Bot 06c835
Packit Bot 06c835
# if HAVE_DECL_FREAD_UNLOCKED
Packit Bot 06c835
#  undef fread
Packit Bot 06c835
#  define fread(w,x,y,z) fread_unlocked (w,x,y,z)
Packit Bot 06c835
# else
Packit Bot 06c835
#  define fread_unlocked(w,x,y,z) fread (w,x,y,z)
Packit Bot 06c835
# endif
Packit Bot 06c835
Packit Bot 06c835
# if HAVE_DECL_FWRITE_UNLOCKED
Packit Bot 06c835
#  undef fwrite
Packit Bot 06c835
#  define fwrite(w,x,y,z) fwrite_unlocked (w,x,y,z)
Packit Bot 06c835
# else
Packit Bot 06c835
#  define fwrite_unlocked(w,x,y,z) fwrite (w,x,y,z)
Packit Bot 06c835
# endif
Packit Bot 06c835
Packit Bot 06c835
# if HAVE_DECL_GETC_UNLOCKED
Packit Bot 06c835
#  undef getc
Packit Bot 06c835
#  define getc(x) getc_unlocked (x)
Packit Bot 06c835
# else
Packit Bot 06c835
#  define getc_unlocked(x) getc (x)
Packit Bot 06c835
# endif
Packit Bot 06c835
Packit Bot 06c835
# if HAVE_DECL_GETCHAR_UNLOCKED
Packit Bot 06c835
#  undef getchar
Packit Bot 06c835
#  define getchar() getchar_unlocked ()
Packit Bot 06c835
# else
Packit Bot 06c835
#  define getchar_unlocked() getchar ()
Packit Bot 06c835
# endif
Packit Bot 06c835
Packit Bot 06c835
# if HAVE_DECL_PUTC_UNLOCKED
Packit Bot 06c835
#  undef putc
Packit Bot 06c835
#  define putc(x,y) putc_unlocked (x,y)
Packit Bot 06c835
# else
Packit Bot 06c835
#  define putc_unlocked(x,y) putc (x,y)
Packit Bot 06c835
# endif
Packit Bot 06c835
Packit Bot 06c835
# if HAVE_DECL_PUTCHAR_UNLOCKED
Packit Bot 06c835
#  undef putchar
Packit Bot 06c835
#  define putchar(x) putchar_unlocked (x)
Packit Bot 06c835
# else
Packit Bot 06c835
#  define putchar_unlocked(x) putchar (x)
Packit Bot 06c835
# endif
Packit Bot 06c835
Packit Bot 06c835
# undef flockfile
Packit Bot 06c835
# define flockfile(x) ((void) 0)
Packit Bot 06c835
Packit Bot 06c835
# undef ftrylockfile
Packit Bot 06c835
# define ftrylockfile(x) 0
Packit Bot 06c835
Packit Bot 06c835
# undef funlockfile
Packit Bot 06c835
# define funlockfile(x) ((void) 0)
Packit Bot 06c835
Packit Bot 06c835
#endif /* UNLOCKED_IO_H */