Revert any potential overriding macro before declaring a new function.

This commit is contained in:
Sam Hocevar 2010-02-27 18:17:21 +00:00 committed by sam
parent 38c86c28ea
commit 6050095bee
4 changed files with 78 additions and 6 deletions

View File

@ -195,12 +195,14 @@ static int (*ORIG(close)) (int fd);
} \ } \
} while(0) } while(0)
#undef open
int NEW(open)(const char *file, int oflag, ...) int NEW(open)(const char *file, int oflag, ...)
{ {
int ret; ZZ_OPEN(open); return ret; int ret; ZZ_OPEN(open); return ret;
} }
#if defined HAVE_OPEN64 #if defined HAVE_OPEN64
#undef open64
int NEW(open64)(const char *file, int oflag, ...) int NEW(open64)(const char *file, int oflag, ...)
{ {
int ret; ZZ_OPEN(open64); return ret; int ret; ZZ_OPEN(open64); return ret;
@ -208,6 +210,7 @@ int NEW(open64)(const char *file, int oflag, ...)
#endif #endif
#if defined HAVE___OPEN64 #if defined HAVE___OPEN64
#undef __open64
int NEW(__open64)(const char *file, int oflag, ...) int NEW(__open64)(const char *file, int oflag, ...)
{ {
int ret; ZZ_OPEN(__open64); return ret; int ret; ZZ_OPEN(__open64); return ret;
@ -215,6 +218,7 @@ int NEW(__open64)(const char *file, int oflag, ...)
#endif #endif
#if defined HAVE_DUP #if defined HAVE_DUP
#undef dup
int NEW(dup)(int oldfd) int NEW(dup)(int oldfd)
{ {
int ret; int ret;
@ -236,6 +240,7 @@ int NEW(dup)(int oldfd)
#endif #endif
#if defined HAVE_DUP2 #if defined HAVE_DUP2
#undef dup2
int NEW(dup2)(int oldfd, int newfd) int NEW(dup2)(int oldfd, int newfd)
{ {
int ret; int ret;
@ -262,6 +267,7 @@ int NEW(dup2)(int oldfd, int newfd)
#endif #endif
#if defined HAVE_ACCEPT #if defined HAVE_ACCEPT
#undef accept
int NEW(accept)(int sockfd, SOCKADDR_T *addr, SOCKLEN_T *addrlen) int NEW(accept)(int sockfd, SOCKADDR_T *addr, SOCKLEN_T *addrlen)
{ {
int ret; int ret;
@ -328,6 +334,7 @@ int NEW(accept)(int sockfd, SOCKADDR_T *addr, SOCKLEN_T *addrlen)
} while(0); } while(0);
#if defined HAVE_BIND #if defined HAVE_BIND
#undef bind
int NEW(bind)(int sockfd, const SOCKADDR_T *my_addr, SOCKLEN_T addrlen) int NEW(bind)(int sockfd, const SOCKADDR_T *my_addr, SOCKLEN_T addrlen)
{ {
int ret; ZZ_CONNECT(bind, my_addr); return ret; int ret; ZZ_CONNECT(bind, my_addr); return ret;
@ -335,6 +342,7 @@ int NEW(bind)(int sockfd, const SOCKADDR_T *my_addr, SOCKLEN_T addrlen)
#endif #endif
#if defined HAVE_CONNECT #if defined HAVE_CONNECT
#undef connect
int NEW(connect)(int sockfd, const SOCKADDR_T *serv_addr, int NEW(connect)(int sockfd, const SOCKADDR_T *serv_addr,
SOCKLEN_T addrlen) SOCKLEN_T addrlen)
{ {
@ -343,6 +351,7 @@ int NEW(connect)(int sockfd, const SOCKADDR_T *serv_addr,
#endif #endif
#if defined HAVE_SOCKET #if defined HAVE_SOCKET
#undef socket
int NEW(socket)(int domain, int type, int protocol) int NEW(socket)(int domain, int type, int protocol)
{ {
int ret; int ret;
@ -389,6 +398,7 @@ int NEW(socket)(int domain, int type, int protocol)
} while(0); } while(0);
#if defined HAVE_RECV #if defined HAVE_RECV
#undef recv
RECV_T NEW(recv)(int s, void *buf, size_t len, int flags) RECV_T NEW(recv)(int s, void *buf, size_t len, int flags)
{ {
int ret; ZZ_RECV(recv); return ret; int ret; ZZ_RECV(recv); return ret;
@ -396,6 +406,7 @@ RECV_T NEW(recv)(int s, void *buf, size_t len, int flags)
#endif #endif
#if defined HAVE___RECV_CHK #if defined HAVE___RECV_CHK
#undef __recv_chk
RECV_T NEW(__recv_chk)(int s, void *buf, size_t len, int flags) RECV_T NEW(__recv_chk)(int s, void *buf, size_t len, int flags)
{ {
int ret; ZZ_RECV(__recv_chk); return ret; int ret; ZZ_RECV(__recv_chk); return ret;
@ -435,6 +446,7 @@ RECV_T NEW(__recv_chk)(int s, void *buf, size_t len, int flags)
} while(0) } while(0)
#if defined HAVE_RECVFROM #if defined HAVE_RECVFROM
#undef recvfrom
RECV_T NEW(recvfrom)(int s, void *buf, size_t len, int flags, RECV_T NEW(recvfrom)(int s, void *buf, size_t len, int flags,
SOCKADDR_T *from, SOCKLEN_T *fromlen) SOCKADDR_T *from, SOCKLEN_T *fromlen)
{ {
@ -443,6 +455,7 @@ RECV_T NEW(recvfrom)(int s, void *buf, size_t len, int flags,
#endif #endif
#if defined HAVE___RECVFROM_CHK #if defined HAVE___RECVFROM_CHK
#undef __recvfrom_chk
RECV_T NEW(__recvfrom_chk)(int s, void *buf, size_t len, int flags, RECV_T NEW(__recvfrom_chk)(int s, void *buf, size_t len, int flags,
SOCKADDR_T *from, SOCKLEN_T *fromlen) SOCKADDR_T *from, SOCKLEN_T *fromlen)
{ {
@ -451,6 +464,7 @@ RECV_T NEW(__recvfrom_chk)(int s, void *buf, size_t len, int flags,
#endif #endif
#if defined HAVE_RECVMSG #if defined HAVE_RECVMSG
#undef recvmsg
RECV_T NEW(recvmsg)(int s, struct msghdr *hdr, int flags) RECV_T NEW(recvmsg)(int s, struct msghdr *hdr, int flags)
{ {
ssize_t ret; ssize_t ret;
@ -495,11 +509,13 @@ RECV_T NEW(recvmsg)(int s, struct msghdr *hdr, int flags)
} while(0) } while(0)
#if defined READ_USES_SSIZE_T #if defined READ_USES_SSIZE_T
#undef read
ssize_t NEW(read)(int fd, void *buf, size_t count) ssize_t NEW(read)(int fd, void *buf, size_t count)
{ {
int ret; ZZ_READ(read); return (ssize_t)ret; int ret; ZZ_READ(read); return (ssize_t)ret;
} }
#else #else
#undef read
int NEW(read)(int fd, void *buf, unsigned int count) int NEW(read)(int fd, void *buf, unsigned int count)
{ {
int ret; ZZ_READ(read); return ret; int ret; ZZ_READ(read); return ret;
@ -507,6 +523,7 @@ int NEW(read)(int fd, void *buf, unsigned int count)
#endif #endif
#if defined HAVE___READ_CHK #if defined HAVE___READ_CHK
#undef __read_chk
ssize_t NEW(__read_chk)(int fd, void *buf, size_t count) ssize_t NEW(__read_chk)(int fd, void *buf, size_t count)
{ {
int ret; ZZ_READ(__read_chk); return (ssize_t)ret; int ret; ZZ_READ(__read_chk); return (ssize_t)ret;
@ -514,6 +531,7 @@ ssize_t NEW(__read_chk)(int fd, void *buf, size_t count)
#endif #endif
#if defined HAVE_READV #if defined HAVE_READV
#undef readv
ssize_t NEW(readv)(int fd, const struct iovec *iov, int count) ssize_t NEW(readv)(int fd, const struct iovec *iov, int count)
{ {
ssize_t ret; ssize_t ret;
@ -533,6 +551,7 @@ ssize_t NEW(readv)(int fd, const struct iovec *iov, int count)
#endif #endif
#if defined HAVE_PREAD #if defined HAVE_PREAD
#undef pread
ssize_t NEW(pread)(int fd, void *buf, size_t count, off_t offset) ssize_t NEW(pread)(int fd, void *buf, size_t count, off_t offset)
{ {
int ret; int ret;
@ -582,6 +601,7 @@ ssize_t NEW(pread)(int fd, void *buf, size_t count, off_t offset)
_zz_setpos(fd, ret); \ _zz_setpos(fd, ret); \
} while(0) } while(0)
#undef lseek
off_t NEW(lseek)(int fd, off_t offset, int whence) off_t NEW(lseek)(int fd, off_t offset, int whence)
{ {
off_t ret; off_t ret;
@ -590,6 +610,7 @@ off_t NEW(lseek)(int fd, off_t offset, int whence)
} }
#if defined HAVE_LSEEK64 #if defined HAVE_LSEEK64
#undef lseek64
off64_t NEW(lseek64)(int fd, off64_t offset, int whence) off64_t NEW(lseek64)(int fd, off64_t offset, int whence)
{ {
off64_t ret; ZZ_LSEEK(lseek64, off64_t); return ret; off64_t ret; ZZ_LSEEK(lseek64, off64_t); return ret;
@ -597,6 +618,7 @@ off64_t NEW(lseek64)(int fd, off64_t offset, int whence)
#endif #endif
#if defined HAVE___LSEEK64 #if defined HAVE___LSEEK64
#undef __lseek64
off64_t NEW(__lseek64)(int fd, off64_t offset, int whence) off64_t NEW(__lseek64)(int fd, off64_t offset, int whence)
{ {
off64_t ret; ZZ_LSEEK(__lseek64, off64_t); return ret; off64_t ret; ZZ_LSEEK(__lseek64, off64_t); return ret;
@ -604,6 +626,7 @@ off64_t NEW(__lseek64)(int fd, off64_t offset, int whence)
#endif #endif
#if defined HAVE_AIO_READ #if defined HAVE_AIO_READ
#undef aio_read
int NEW(aio_read)(struct aiocb *aiocbp) int NEW(aio_read)(struct aiocb *aiocbp)
{ {
int ret; int ret;
@ -623,6 +646,7 @@ int NEW(aio_read)(struct aiocb *aiocbp)
return ret; return ret;
} }
#undef aio_return
ssize_t NEW(aio_return)(struct aiocb *aiocbp) ssize_t NEW(aio_return)(struct aiocb *aiocbp)
{ {
ssize_t ret; ssize_t ret;
@ -652,6 +676,7 @@ ssize_t NEW(aio_return)(struct aiocb *aiocbp)
} }
#endif #endif
#undef close
int NEW(close)(int fd) int NEW(close)(int fd)
{ {
int ret; int ret;

View File

@ -153,6 +153,7 @@ void _zz_mem_init(void)
LOADSYM(realloc); LOADSYM(realloc);
} }
#undef calloc
void *NEW(calloc)(size_t nmemb, size_t size) void *NEW(calloc)(size_t nmemb, size_t size)
{ {
void *ret; void *ret;
@ -176,6 +177,7 @@ void *NEW(calloc)(size_t nmemb, size_t size)
return ret; return ret;
} }
#undef malloc
void *NEW(malloc)(size_t size) void *NEW(malloc)(size_t size)
{ {
void *ret; void *ret;
@ -197,6 +199,7 @@ void *NEW(malloc)(size_t size)
return ret; return ret;
} }
#undef free
void NEW(free)(void *ptr) void NEW(free)(void *ptr)
{ {
if((uintptr_t)ptr >= DUMMY_START && (uintptr_t)ptr < DUMMY_STOP) if((uintptr_t)ptr >= DUMMY_START && (uintptr_t)ptr < DUMMY_STOP)
@ -213,6 +216,7 @@ void NEW(free)(void *ptr)
ORIG(free)(ptr); ORIG(free)(ptr);
} }
#undef realloc
void *NEW(realloc)(void *ptr, size_t size) void *NEW(realloc)(void *ptr, size_t size)
{ {
void *ret; void *ret;
@ -244,6 +248,7 @@ void *NEW(realloc)(void *ptr, size_t size)
} }
#if defined HAVE_VALLOC #if defined HAVE_VALLOC
#undef valloc
void *NEW(valloc)(size_t size) void *NEW(valloc)(size_t size)
{ {
void *ret; void *ret;
@ -257,6 +262,7 @@ void *NEW(valloc)(size_t size)
#endif #endif
#if defined HAVE_MEMALIGN #if defined HAVE_MEMALIGN
#undef memalign
void *NEW(memalign)(size_t boundary, size_t size) void *NEW(memalign)(size_t boundary, size_t size)
{ {
void *ret; void *ret;
@ -270,6 +276,7 @@ void *NEW(memalign)(size_t boundary, size_t size)
#endif #endif
#if defined HAVE_POSIX_MEMALIGN #if defined HAVE_POSIX_MEMALIGN
#undef posix_memalign
int NEW(posix_memalign)(void **memptr, size_t alignment, size_t size) int NEW(posix_memalign)(void **memptr, size_t alignment, size_t size)
{ {
int ret; int ret;
@ -339,6 +346,7 @@ int nbmaps = 0;
} while(0) } while(0)
#if defined HAVE_MMAP #if defined HAVE_MMAP
#undef mmap
void *NEW(mmap)(void *start, size_t length, int prot, int flags, void *NEW(mmap)(void *start, size_t length, int prot, int flags,
int fd, off_t offset) int fd, off_t offset)
{ {
@ -347,6 +355,7 @@ void *NEW(mmap)(void *start, size_t length, int prot, int flags,
#endif #endif
#if defined HAVE_MMAP64 #if defined HAVE_MMAP64
#undef mmap64
void *NEW(mmap64)(void *start, size_t length, int prot, int flags, void *NEW(mmap64)(void *start, size_t length, int prot, int flags,
int fd, off64_t offset) int fd, off64_t offset)
{ {
@ -355,6 +364,7 @@ void *NEW(mmap64)(void *start, size_t length, int prot, int flags,
#endif #endif
#if defined HAVE_MUNMAP #if defined HAVE_MUNMAP
#undef munmap
int NEW(munmap)(void *start, size_t length) int NEW(munmap)(void *start, size_t length)
{ {
int ret, i; int ret, i;
@ -378,6 +388,7 @@ int NEW(munmap)(void *start, size_t length)
#endif #endif
#if defined HAVE_MAP_FD #if defined HAVE_MAP_FD
#undef map_fd
kern_return_t NEW(map_fd)(int fd, vm_offset_t offset, vm_offset_t *addr, kern_return_t NEW(map_fd)(int fd, vm_offset_t offset, vm_offset_t *addr,
boolean_t find_space, vm_size_t numbytes) boolean_t find_space, vm_size_t numbytes)
{ {

View File

@ -90,6 +90,7 @@ static int isfatal(int signum)
} }
} }
#undef signal
SIG_T NEW(signal)(int signum, SIG_T handler) SIG_T NEW(signal)(int signum, SIG_T handler)
{ {
SIG_T ret; SIG_T ret;
@ -107,6 +108,7 @@ SIG_T NEW(signal)(int signum, SIG_T handler)
} }
#if defined HAVE_SIGACTION #if defined HAVE_SIGACTION
#undef sigaction
int NEW(sigaction)(int signum, const struct sigaction *act, int NEW(sigaction)(int signum, const struct sigaction *act,
struct sigaction *oldact) struct sigaction *oldact)
{ {

View File

@ -53,18 +53,22 @@
#include "fd.h" #include "fd.h"
#if defined HAVE___SREFILL #if defined HAVE___SREFILL
#undef __srefill
int NEW(__srefill)(FILE *fp); int NEW(__srefill)(FILE *fp);
#endif #endif
#if defined HAVE___FILBUF #if defined HAVE___FILBUF
#undef __filbuf
int NEW(__filbuf)(FILE *fp); int NEW(__filbuf)(FILE *fp);
#endif #endif
#if defined HAVE___SRGET && !defined HAVE___SREFILL #if defined HAVE___SRGET && !defined HAVE___SREFILL
#undef __srget
int NEW(__srget)(FILE *fp); int NEW(__srget)(FILE *fp);
#endif #endif
#if defined HAVE___UFLOW #if defined HAVE___UFLOW
#undef __uflow
int NEW(__uflow)(FILE *fp); int NEW(__uflow)(FILE *fp);
#endif #endif
@ -293,12 +297,14 @@ static inline void debug_stream(char const *prefix, FILE *stream)
path, mode, fd0, fd1); \ path, mode, fd0, fd1); \
} while(0) } while(0)
#undef fopen
FILE *NEW(fopen)(const char *path, const char *mode) FILE *NEW(fopen)(const char *path, const char *mode)
{ {
FILE *ret; ZZ_FOPEN(fopen); return ret; FILE *ret; ZZ_FOPEN(fopen); return ret;
} }
#if defined HAVE_FOPEN64 #if defined HAVE_FOPEN64
#undef fopen64
FILE *NEW(fopen64)(const char *path, const char *mode) FILE *NEW(fopen64)(const char *path, const char *mode)
{ {
FILE *ret; ZZ_FOPEN(fopen64); return ret; FILE *ret; ZZ_FOPEN(fopen64); return ret;
@ -306,18 +312,21 @@ FILE *NEW(fopen64)(const char *path, const char *mode)
#endif #endif
#if defined HAVE___FOPEN64 #if defined HAVE___FOPEN64
#undef __fopen64
FILE *NEW(__fopen64)(const char *path, const char *mode) FILE *NEW(__fopen64)(const char *path, const char *mode)
{ {
FILE *ret; ZZ_FOPEN(__fopen64); return ret; FILE *ret; ZZ_FOPEN(__fopen64); return ret;
} }
#endif #endif
#undef freopen
FILE *NEW(freopen)(const char *path, const char *mode, FILE *stream) FILE *NEW(freopen)(const char *path, const char *mode, FILE *stream)
{ {
FILE *ret; ZZ_FREOPEN(freopen); return ret; FILE *ret; ZZ_FREOPEN(freopen); return ret;
} }
#if defined HAVE_FREOPEN64 #if defined HAVE_FREOPEN64
#undef freopen64
FILE *NEW(freopen64)(const char *path, const char *mode, FILE *stream) FILE *NEW(freopen64)(const char *path, const char *mode, FILE *stream)
{ {
FILE *ret; ZZ_FREOPEN(freopen64); return ret; FILE *ret; ZZ_FREOPEN(freopen64); return ret;
@ -325,6 +334,7 @@ FILE *NEW(freopen64)(const char *path, const char *mode, FILE *stream)
#endif #endif
#if defined HAVE___FREOPEN64 #if defined HAVE___FREOPEN64
#undef __freopen64
FILE *NEW(__freopen64)(const char *path, const char *mode, FILE *stream) FILE *NEW(__freopen64)(const char *path, const char *mode, FILE *stream)
{ {
FILE *ret; ZZ_FREOPEN(__freopen64); return ret; FILE *ret; ZZ_FREOPEN(__freopen64); return ret;
@ -438,12 +448,14 @@ FILE *NEW(__freopen64)(const char *path, const char *mode, FILE *stream)
debug("%s([%i])", __func__, fd); \ debug("%s([%i])", __func__, fd); \
} while(0) } while(0)
#undef fseek
int NEW(fseek)(FILE *stream, long offset, int whence) int NEW(fseek)(FILE *stream, long offset, int whence)
{ {
int ret; ZZ_FSEEK(fseek); return ret; int ret; ZZ_FSEEK(fseek); return ret;
} }
#if defined HAVE_FSEEKO #if defined HAVE_FSEEKO
#undef fseeko
int NEW(fseeko)(FILE *stream, off_t offset, int whence) int NEW(fseeko)(FILE *stream, off_t offset, int whence)
{ {
int ret; ZZ_FSEEK(fseeko); return ret; int ret; ZZ_FSEEK(fseeko); return ret;
@ -451,6 +463,7 @@ int NEW(fseeko)(FILE *stream, off_t offset, int whence)
#endif #endif
#if defined HAVE_FSEEKO64 #if defined HAVE_FSEEKO64
#undef fseeko64
int NEW(fseeko64)(FILE *stream, off64_t offset, int whence) int NEW(fseeko64)(FILE *stream, off64_t offset, int whence)
{ {
int ret; ZZ_FSEEK(fseeko64); return ret; int ret; ZZ_FSEEK(fseeko64); return ret;
@ -458,6 +471,7 @@ int NEW(fseeko64)(FILE *stream, off64_t offset, int whence)
#endif #endif
#if defined HAVE___FSEEKO64 #if defined HAVE___FSEEKO64
#undef __fseeko64
int NEW(__fseeko64)(FILE *stream, off64_t offset, int whence) int NEW(__fseeko64)(FILE *stream, off64_t offset, int whence)
{ {
int ret; ZZ_FSEEK(__fseeko64); return ret; int ret; ZZ_FSEEK(__fseeko64); return ret;
@ -465,6 +479,7 @@ int NEW(__fseeko64)(FILE *stream, off64_t offset, int whence)
#endif #endif
#if defined HAVE_FSETPOS64 #if defined HAVE_FSETPOS64
#undef fsetpos64
int NEW(fsetpos64)(FILE *stream, const fpos64_t *pos) int NEW(fsetpos64)(FILE *stream, const fpos64_t *pos)
{ {
int ret; ZZ_FSETPOS(fsetpos64); return ret; int ret; ZZ_FSETPOS(fsetpos64); return ret;
@ -472,12 +487,14 @@ int NEW(fsetpos64)(FILE *stream, const fpos64_t *pos)
#endif #endif
#if defined HAVE___FSETPOS64 #if defined HAVE___FSETPOS64
#undef __fsetpos64
int NEW(__fsetpos64)(FILE *stream, const fpos64_t *pos) int NEW(__fsetpos64)(FILE *stream, const fpos64_t *pos)
{ {
int ret; ZZ_FSETPOS(__fsetpos64); return ret; int ret; ZZ_FSETPOS(__fsetpos64); return ret;
} }
#endif #endif
#undef rewind
void NEW(rewind)(FILE *stream) void NEW(rewind)(FILE *stream)
{ {
ZZ_REWIND(rewind); ZZ_REWIND(rewind);
@ -538,13 +555,14 @@ void NEW(rewind)(FILE *stream)
(long int)size, (long int)nmemb, fd, (long int)ret); \ (long int)size, (long int)nmemb, fd, (long int)ret); \
} while(0) } while(0)
#undef fread
size_t NEW(fread)(void *ptr, size_t size, size_t nmemb, FILE *stream) size_t NEW(fread)(void *ptr, size_t size, size_t nmemb, FILE *stream)
{ {
size_t ret; ZZ_FREAD(fread); return ret; size_t ret; ZZ_FREAD(fread); return ret;
} }
#if defined HAVE_FREAD_UNLOCKED #if defined HAVE_FREAD_UNLOCKED
#undef fread_unlocked /* can be a macro; we dont want that */ #undef fread_unlocked
size_t NEW(fread_unlocked)(void *ptr, size_t size, size_t nmemb, FILE *stream) size_t NEW(fread_unlocked)(void *ptr, size_t size, size_t nmemb, FILE *stream)
{ {
size_t ret; ZZ_FREAD(fread_unlocked); return ret; size_t ret; ZZ_FREAD(fread_unlocked); return ret;
@ -618,24 +636,26 @@ size_t NEW(__fread_unlocked_chk)(void *ptr, size_t size, size_t nmemb,
debug("%s([%i]) = '%c'", __func__, fd, ret); \ debug("%s([%i]) = '%c'", __func__, fd, ret); \
} while(0) } while(0)
#undef getc /* can be a macro; we dont want that */ #undef getc
int NEW(getc)(FILE *stream) int NEW(getc)(FILE *stream)
{ {
int ret; ZZ_FGETC(getc, stream, stream); return ret; int ret; ZZ_FGETC(getc, stream, stream); return ret;
} }
#undef getchar /* can be a macro; we dont want that */ #undef getchar
int NEW(getchar)(void) int NEW(getchar)(void)
{ {
int ret; ZZ_FGETC(getchar, stdin, /* empty */); return ret; int ret; ZZ_FGETC(getchar, stdin, /* empty */); return ret;
} }
#undef fgetc
int NEW(fgetc)(FILE *stream) int NEW(fgetc)(FILE *stream)
{ {
int ret; ZZ_FGETC(fgetc, stream, stream); return ret; int ret; ZZ_FGETC(fgetc, stream, stream); return ret;
} }
#if defined HAVE__IO_GETC #if defined HAVE__IO_GETC
#undef _IO_fgetc
int NEW(_IO_getc)(FILE *stream) int NEW(_IO_getc)(FILE *stream)
{ {
int ret; ZZ_FGETC(_IO_getc, stream, stream); return ret; int ret; ZZ_FGETC(_IO_getc, stream, stream); return ret;
@ -643,7 +663,7 @@ int NEW(_IO_getc)(FILE *stream)
#endif #endif
#if defined HAVE_GETC_UNLOCKED #if defined HAVE_GETC_UNLOCKED
#undef getc_unlocked /* can be a macro; we dont want that */ #undef getc_unlocked
int NEW(getc_unlocked)(FILE *stream) int NEW(getc_unlocked)(FILE *stream)
{ {
int ret; ZZ_FGETC(getc_unlocked, stream, stream); return ret; int ret; ZZ_FGETC(getc_unlocked, stream, stream); return ret;
@ -651,7 +671,7 @@ int NEW(getc_unlocked)(FILE *stream)
#endif #endif
#if defined HAVE_GETCHAR_UNLOCKED #if defined HAVE_GETCHAR_UNLOCKED
#undef getchar_unlocked /* can be a macro; we dont want that */ #undef getchar_unlocked
int NEW(getchar_unlocked)(void) int NEW(getchar_unlocked)(void)
{ {
int ret; ZZ_FGETC(getchar_unlocked, stdin, /* empty */); return ret; int ret; ZZ_FGETC(getchar_unlocked, stdin, /* empty */); return ret;
@ -659,7 +679,7 @@ int NEW(getchar_unlocked)(void)
#endif #endif
#if defined HAVE_FGETC_UNLOCKED #if defined HAVE_FGETC_UNLOCKED
#undef fgetc_unlocked /* can be a macro; we dont want that */ #undef fgetc_unlocked
int NEW(fgetc_unlocked)(FILE *stream) int NEW(fgetc_unlocked)(FILE *stream)
{ {
int ret; ZZ_FGETC(fgetc_unlocked, stream, stream); return ret; int ret; ZZ_FGETC(fgetc_unlocked, stream, stream); return ret;
@ -740,12 +760,14 @@ int NEW(fgetc_unlocked)(FILE *stream)
debug("%s(%p, %i, [%i]) = %p", __func__, s, size, fd, ret); \ debug("%s(%p, %i, [%i]) = %p", __func__, s, size, fd, ret); \
} while(0) } while(0)
#undef fgets
char *NEW(fgets)(char *s, int size, FILE *stream) char *NEW(fgets)(char *s, int size, FILE *stream)
{ {
char *ret; ZZ_FGETS(fgets, fgetc); return ret; char *ret; ZZ_FGETS(fgets, fgetc); return ret;
} }
#if defined HAVE_FGETS_UNLOCKED #if defined HAVE_FGETS_UNLOCKED
#undef fgets_unlocked
char *NEW(fgets_unlocked)(char *s, int size, FILE *stream) char *NEW(fgets_unlocked)(char *s, int size, FILE *stream)
{ {
char *ret; ZZ_FGETS(fgets_unlocked, fgetc_unlocked); return ret; char *ret; ZZ_FGETS(fgets_unlocked, fgetc_unlocked); return ret;
@ -753,6 +775,7 @@ char *NEW(fgets_unlocked)(char *s, int size, FILE *stream)
#endif #endif
#if defined HAVE___FGETS_CHK #if defined HAVE___FGETS_CHK
#undef __fgets_chk
char *NEW(__fgets_chk)(char *s, int size, FILE *stream) char *NEW(__fgets_chk)(char *s, int size, FILE *stream)
{ {
char *ret; ZZ_FGETS(__fgets_chk, fgetc); return ret; char *ret; ZZ_FGETS(__fgets_chk, fgetc); return ret;
@ -760,6 +783,7 @@ char *NEW(__fgets_chk)(char *s, int size, FILE *stream)
#endif #endif
#if defined HAVE___FGETS_UNLOCKED_CHK #if defined HAVE___FGETS_UNLOCKED_CHK
#undef __fgets_unlocked_chk
char *NEW(__fgets_unlocked_chk)(char *s, int size, FILE *stream) char *NEW(__fgets_unlocked_chk)(char *s, int size, FILE *stream)
{ {
char *ret; ZZ_FGETS(__fgets_unlocked_chk, fgetc_unlocked); return ret; char *ret; ZZ_FGETS(__fgets_unlocked_chk, fgetc_unlocked); return ret;
@ -770,6 +794,7 @@ char *NEW(__fgets_unlocked_chk)(char *s, int size, FILE *stream)
* ungetc * ungetc
*/ */
#undef ungetc
int NEW(ungetc)(int c, FILE *stream) int NEW(ungetc)(int c, FILE *stream)
{ {
int oldpos, ret, fd; int oldpos, ret, fd;
@ -799,6 +824,7 @@ int NEW(ungetc)(int c, FILE *stream)
* fclose * fclose
*/ */
#undef fclose
int NEW(fclose)(FILE *fp) int NEW(fclose)(FILE *fp)
{ {
int ret, fd; int ret, fd;
@ -906,6 +932,7 @@ int NEW(fclose)(FILE *fp)
} while(0) } while(0)
#if defined HAVE_GETLINE #if defined HAVE_GETLINE
#undef getline
ssize_t NEW(getline)(char **lineptr, size_t *n, FILE *stream) ssize_t NEW(getline)(char **lineptr, size_t *n, FILE *stream)
{ {
ssize_t ret; ZZ_GETDELIM(getline, '\n', 0); return ret; ssize_t ret; ZZ_GETDELIM(getline, '\n', 0); return ret;
@ -913,6 +940,7 @@ ssize_t NEW(getline)(char **lineptr, size_t *n, FILE *stream)
#endif #endif
#if defined HAVE_GETDELIM #if defined HAVE_GETDELIM
#undef getdelim
ssize_t NEW(getdelim)(char **lineptr, size_t *n, int delim, FILE *stream) ssize_t NEW(getdelim)(char **lineptr, size_t *n, int delim, FILE *stream)
{ {
ssize_t ret; ZZ_GETDELIM(getdelim, delim, 1); return ret; ssize_t ret; ZZ_GETDELIM(getdelim, delim, 1); return ret;
@ -920,6 +948,7 @@ ssize_t NEW(getdelim)(char **lineptr, size_t *n, int delim, FILE *stream)
#endif #endif
#if defined HAVE___GETDELIM #if defined HAVE___GETDELIM
#undef __getdelim
ssize_t NEW(__getdelim)(char **lineptr, size_t *n, int delim, FILE *stream) ssize_t NEW(__getdelim)(char **lineptr, size_t *n, int delim, FILE *stream)
{ {
ssize_t ret; ZZ_GETDELIM(__getdelim, delim, 1); return ret; ssize_t ret; ZZ_GETDELIM(__getdelim, delim, 1); return ret;
@ -931,6 +960,7 @@ ssize_t NEW(__getdelim)(char **lineptr, size_t *n, int delim, FILE *stream)
*/ */
#if defined HAVE_FGETLN #if defined HAVE_FGETLN
#undef fgetln
char *NEW(fgetln)(FILE *stream, size_t *len) char *NEW(fgetln)(FILE *stream, size_t *len)
{ {
int64_t oldpos, newpos; int64_t oldpos, newpos;
@ -1070,6 +1100,7 @@ char *NEW(fgetln)(FILE *stream, size_t *len)
while(0) while(0)
#if defined HAVE___SREFILL #if defined HAVE___SREFILL
#undef __srefill
int NEW(__srefill)(FILE *fp) int NEW(__srefill)(FILE *fp)
{ {
int ret; ZZ_REFILL(__srefill, 0); return ret; int ret; ZZ_REFILL(__srefill, 0); return ret;
@ -1077,6 +1108,7 @@ int NEW(__srefill)(FILE *fp)
#endif #endif
#if defined HAVE___SRGET && !defined HAVE___SREFILL #if defined HAVE___SRGET && !defined HAVE___SREFILL
#undef __srget
int NEW(__srget)(FILE *fp) int NEW(__srget)(FILE *fp)
{ {
int ret; ZZ_REFILL(__srget, 1); return ret; int ret; ZZ_REFILL(__srget, 1); return ret;
@ -1084,6 +1116,7 @@ int NEW(__srget)(FILE *fp)
#endif #endif
#if defined HAVE___FILBUF #if defined HAVE___FILBUF
#undef __filbuf
int NEW(__filbuf)(FILE *fp) int NEW(__filbuf)(FILE *fp)
{ {
int ret; ZZ_REFILL(__filbuf, 1); return ret; int ret; ZZ_REFILL(__filbuf, 1); return ret;
@ -1091,6 +1124,7 @@ int NEW(__filbuf)(FILE *fp)
#endif #endif
#if defined HAVE___UFLOW #if defined HAVE___UFLOW
#undef __uflow
int NEW(__uflow)(FILE *fp) int NEW(__uflow)(FILE *fp)
{ {
int ret; ZZ_REFILL(__uflow, 1); return ret; int ret; ZZ_REFILL(__uflow, 1); return ret;