Blame gnu/unlocked-io.h

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