* Implement getc_unlocked() and fgetc_unlocked().

This commit is contained in:
Sam Hocevar 2008-05-17 23:10:41 +00:00 committed by sam
parent 04b9c5f1f0
commit 8e56c6de5a
2 changed files with 21 additions and 1 deletions

View File

@ -29,7 +29,7 @@ AC_SUBST(DLL_LDFLAGS)
AC_CHECK_HEADERS(windows.h winsock2.h io.h process.h unistd.h inttypes.h stdint.h getopt.h libc.h malloc.h dlfcn.h regex.h sys/socket.h netinet/in.h sys/uio.h aio.h sys/mman.h sys/wait.h sys/resource.h sys/time.h endian.h)
AC_CHECK_FUNCS(setenv waitpid setrlimit gettimeofday fork kill pipe _pipe)
AC_CHECK_FUNCS(open64 lseek64 mmap64 fopen64 dup dup2 fseeko _IO_getc getline getdelim __getdelim fgetln __srefill map_fd memalign posix_memalign aio_read accept bind connect socket readv pread recv recvfrom recvmsg mmap valloc sigaction getpagesize)
AC_CHECK_FUNCS(open64 lseek64 mmap64 fopen64 dup dup2 fseeko _IO_getc getline getdelim __getdelim fgetln __srefill map_fd memalign posix_memalign aio_read accept bind connect socket readv pread recv recvfrom recvmsg mmap valloc sigaction getpagesize getc_unlocked getchar_unlocked fgetc_unlocked fread_unlocked fgets_unlocked)
AC_CHECK_TYPES(sighandler_t, [], [],
[#define _GNU_SOURCE

View File

@ -62,6 +62,12 @@ static int (*ORIG(fgetc)) (FILE *stream);
#if defined HAVE__IO_GETC
static int (*ORIG(_IO_getc)) (FILE *stream);
#endif
#if defined HAVE_GETC_UNLOCKED
static int (*ORIG(getc_unlocked)) (FILE *stream);
#endif
#if defined HAVE_FGETC_UNLOCKED
static int (*ORIG(fgetc_unlocked)) (FILE *stream);
#endif
static char * (*ORIG(fgets)) (char *s, int size, FILE *stream);
static int (*ORIG(ungetc)) (int c, FILE *stream);
static int (*ORIG(fclose)) (FILE *fp);
@ -324,6 +330,20 @@ int NEW(_IO_getc)(FILE *stream)
}
#endif
#if defined HAVE_GETC_UNLOCKED
int NEW(getc_unlocked)(FILE *stream)
{
int ret; FGETC(getc_unlocked); return ret;
}
#endif
#if defined HAVE_FGETC_UNLOCKED
int NEW(fgetc_unlocked)(FILE *stream)
{
int ret; FGETC(fgetc_unlocked); return ret;
}
#endif
char *NEW(fgets)(char *s, int size, FILE *stream)
{
char *ret = s;