Blame lib/unlocked-io.h

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