From b3dc18436403d035a8d5676026bc2a9e95b5c021 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 17 Apr 2008 02:01:23 +0200 Subject: [PATCH] Add tentative support for Linux libc5. --- ChangeLog | 16 ++++++++++++++++ lib/fbufmode.c | 2 +- lib/fpurge.c | 2 +- lib/freadable.c | 2 +- lib/freadahead.c | 2 +- lib/freading.c | 2 +- lib/freadptr.c | 2 +- lib/freadseek.c | 2 +- lib/fseeko.c | 2 +- lib/fseterr.c | 2 +- lib/fwritable.c | 2 +- lib/fwriting.c | 2 +- 12 files changed, 27 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index a4d19aacf..8f8a6f20b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2008-04-16 Bruno Haible + + Add tentative support for Linux libc5. + * lib/fbufmode.c (fbufmode) [__GNU_LIBRARY__==1]: Reuse glibc2 code. + * lib/fpurge.c (fpurge): Likewise. + * lib/freadable.c (freadable): Likewise. + * lib/freadahead.c (freadahead): Likewise. + * lib/freading.c (freading): Likewise. + * lib/freadptr.c (freadptr): Likewise. + * lib/freadseek.c (freadptrinc): Likewise. + * lib/fseeko.c (rpl_fseeko): Likewise. + * lib/fseterr.c (fseterr): Likewise. + * lib/fwritable.c (fwritable): Likewise. + * lib/fwriting.c (fwriting): Likewise. + Reported by Alain Guibert . + 2008-04-15 Bruno Haible * modules/mathl (configure.ac): Define module indicator. diff --git a/lib/fbufmode.c b/lib/fbufmode.c index c775fc2e7..2c3319f19 100644 --- a/lib/fbufmode.c +++ b/lib/fbufmode.c @@ -29,7 +29,7 @@ fbufmode (FILE *fp) /* Most systems provide FILE as a struct and the necessary bitmask in , because they need it for implementing getc() and putc() as fast macros. */ -#if defined _IO_ferror_unlocked /* GNU libc, BeOS */ +#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ # if HAVE___FLBF /* glibc >= 2.2 */ if (__flbf (fp)) return _IOLBF; diff --git a/lib/fpurge.c b/lib/fpurge.c index 05b58f2a7..f9409e523 100644 --- a/lib/fpurge.c +++ b/lib/fpurge.c @@ -59,7 +59,7 @@ fpurge (FILE *fp) /* Most systems provide FILE as a struct and the necessary bitmask in , because they need it for implementing getc() and putc() as fast macros. */ -# if defined _IO_ferror_unlocked /* GNU libc, BeOS */ +# if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ fp->_IO_read_end = fp->_IO_read_ptr; fp->_IO_write_ptr = fp->_IO_write_base; /* Avoid memory leak when there is an active ungetc buffer. */ diff --git a/lib/freadable.c b/lib/freadable.c index 9ab3c10cd..e2088c2ea 100644 --- a/lib/freadable.c +++ b/lib/freadable.c @@ -25,7 +25,7 @@ freadable (FILE *fp) /* Most systems provide FILE as a struct and the necessary bitmask in , because they need it for implementing getc() and putc() as fast macros. */ -#if defined _IO_ferror_unlocked /* GNU libc, BeOS */ +#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ return (fp->_flags & _IO_NO_READS) == 0; #elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */ return (fp->_flags & (__SRW | __SRD)) != 0; diff --git a/lib/freadahead.c b/lib/freadahead.c index 1a8adabef..85d482de9 100644 --- a/lib/freadahead.c +++ b/lib/freadahead.c @@ -22,7 +22,7 @@ size_t freadahead (FILE *fp) { -#if defined _IO_ferror_unlocked /* GNU libc, BeOS */ +#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ if (fp->_IO_write_ptr > fp->_IO_write_base) return 0; return (fp->_IO_read_end - fp->_IO_read_ptr) diff --git a/lib/freading.c b/lib/freading.c index 8540668f1..ca518b12d 100644 --- a/lib/freading.c +++ b/lib/freading.c @@ -29,7 +29,7 @@ freading (FILE *fp) /* Most systems provide FILE as a struct and the necessary bitmask in , because they need it for implementing getc() and putc() as fast macros. */ -#if defined _IO_ferror_unlocked /* GNU libc, BeOS */ +#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ return ((fp->_flags & _IO_NO_WRITES) != 0 || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0 && fp->_IO_read_base != NULL)); diff --git a/lib/freadptr.c b/lib/freadptr.c index bcfab5723..ec483237b 100644 --- a/lib/freadptr.c +++ b/lib/freadptr.c @@ -27,7 +27,7 @@ freadptr (FILE *fp, size_t *sizep) size_t size; /* Keep this code in sync with freadahead! */ -#if defined _IO_ferror_unlocked /* GNU libc, BeOS */ +#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ if (fp->_IO_write_ptr > fp->_IO_write_base) return NULL; size = fp->_IO_read_end - fp->_IO_read_ptr; diff --git a/lib/freadseek.c b/lib/freadseek.c index bb6a7ad79..99ac211cf 100644 --- a/lib/freadseek.c +++ b/lib/freadseek.c @@ -32,7 +32,7 @@ static inline void freadptrinc (FILE *fp, size_t increment) { /* Keep this code in sync with freadptr! */ -#if defined _IO_ferror_unlocked /* GNU libc, BeOS */ +#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ fp->_IO_read_ptr += increment; #elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */ fp->_p += increment; diff --git a/lib/fseeko.c b/lib/fseeko.c index e764cacf8..008118861 100644 --- a/lib/fseeko.c +++ b/lib/fseeko.c @@ -39,7 +39,7 @@ rpl_fseeko (FILE *fp, off_t offset, int whence) #endif /* These tests are based on fpurge.c. */ -#if defined _IO_ferror_unlocked /* GNU libc, BeOS */ +#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ if (fp->_IO_read_end == fp->_IO_read_ptr && fp->_IO_write_ptr == fp->_IO_write_base && fp->_IO_save_base == NULL) diff --git a/lib/fseterr.c b/lib/fseterr.c index 72560169e..a36ed7553 100644 --- a/lib/fseterr.c +++ b/lib/fseterr.c @@ -27,7 +27,7 @@ fseterr (FILE *fp) /* Most systems provide FILE as a struct and the necessary bitmask in , because they need it for implementing getc() and putc() as fast macros. */ -#if defined _IO_ferror_unlocked /* GNU libc, BeOS */ +#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ fp->_flags |= _IO_ERR_SEEN; #elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */ fp->_flags |= __SERR; diff --git a/lib/fwritable.c b/lib/fwritable.c index f821cfbd2..598c2754a 100644 --- a/lib/fwritable.c +++ b/lib/fwritable.c @@ -25,7 +25,7 @@ fwritable (FILE *fp) /* Most systems provide FILE as a struct and the necessary bitmask in , because they need it for implementing getc() and putc() as fast macros. */ -#if defined _IO_ferror_unlocked /* GNU libc, BeOS */ +#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ return (fp->_flags & _IO_NO_WRITES) == 0; #elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */ return (fp->_flags & (__SRW | __SWR)) != 0; diff --git a/lib/fwriting.c b/lib/fwriting.c index 2ad0d6c29..7d4e01f7c 100644 --- a/lib/fwriting.c +++ b/lib/fwriting.c @@ -25,7 +25,7 @@ fwriting (FILE *fp) /* Most systems provide FILE as a struct and the necessary bitmask in , because they need it for implementing getc() and putc() as fast macros. */ -#if defined _IO_ferror_unlocked /* GNU libc, BeOS */ +#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ return (fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) != 0; #elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */ return (fp->_flags & __SWR) != 0; -- 2.11.0