Add tentative support for Linux libc5.
authorBruno Haible <bruno@clisp.org>
Thu, 17 Apr 2008 00:01:23 +0000 (02:01 +0200)
committerBruno Haible <bruno@clisp.org>
Thu, 17 Apr 2008 00:01:23 +0000 (02:01 +0200)
12 files changed:
ChangeLog
lib/fbufmode.c
lib/fpurge.c
lib/freadable.c
lib/freadahead.c
lib/freading.c
lib/freadptr.c
lib/freadseek.c
lib/fseeko.c
lib/fseterr.c
lib/fwritable.c
lib/fwriting.c

index a4d19aacf75a165e07076cfd8c5b68f280303182..8f8a6f20bf9d493d2283abc17aca5fe09759c907 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2008-04-16  Bruno Haible  <bruno@clisp.org>
+
+       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 <alguibert+bts@free.fr>.
+
 2008-04-15  Bruno Haible  <bruno@clisp.org>
 
        * modules/mathl (configure.ac): Define module indicator.
index c775fc2e701d5aeafeddfa31ce9c58c5584fd2e2..2c3319f19ada5602a0f3be1325cabd09fbeead89 100644 (file)
@@ -29,7 +29,7 @@ fbufmode (FILE *fp)
   /* Most systems provide FILE as a struct and the necessary bitmask in
      <stdio.h>, 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;
index 05b58f2a706cf1ee8fab14ad4b0636ddb0ed8edc..f9409e5236a92f29551c5650f1dff10c8e632b92 100644 (file)
@@ -59,7 +59,7 @@ fpurge (FILE *fp)
   /* Most systems provide FILE as a struct and the necessary bitmask in
      <stdio.h>, 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.  */
index 9ab3c10cd1716f23ae5cd2755c24211d8e5a8b6b..e2088c2ea3ff15168a565dbbd839ae84417bbd50 100644 (file)
@@ -25,7 +25,7 @@ freadable (FILE *fp)
   /* Most systems provide FILE as a struct and the necessary bitmask in
      <stdio.h>, 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;
index 1a8adabefdb783af9d24ddbb0783fc2970ccb05a..85d482de99c755910122f7d2db6f04cbccbcf286 100644 (file)
@@ -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)
index 8540668f11ddbe765c50bf1c79557c742b7da919..ca518b12d56e8839064e97724c59a4cb562b5611 100644 (file)
@@ -29,7 +29,7 @@ freading (FILE *fp)
   /* Most systems provide FILE as a struct and the necessary bitmask in
      <stdio.h>, 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));
index bcfab57231f9b1ba4f7f7b66f094c5031d8fa732..ec483237b76ee03618f05874e132d11026adc8c7 100644 (file)
@@ -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;
index bb6a7ad797a3de3feb83b493dc5d402cc1b4aaa0..99ac211cfcfa8f8868521ce207c4160b6ddf8d36 100644 (file)
@@ -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;
index e764cacf87b422be767e54dd6c3fa3bb2b52e673..008118861b2f0040a6ae63f39a66e801f46b3fd1 100644 (file)
@@ -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)
index 72560169ed4b2cf098b591c0b25893c9fbc84a46..a36ed75538032349cb571039254fec38b2adf38b 100644 (file)
@@ -27,7 +27,7 @@ fseterr (FILE *fp)
   /* Most systems provide FILE as a struct and the necessary bitmask in
      <stdio.h>, 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;
index f821cfbd29a9a567acfdb482ea8ce0405d49fe0c..598c2754aeb9b9e62f9fdc00839fb9cf0992a560 100644 (file)
@@ -25,7 +25,7 @@ fwritable (FILE *fp)
   /* Most systems provide FILE as a struct and the necessary bitmask in
      <stdio.h>, 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;
index 2ad0d6c2951bd60b9a6259ca24ad5de8ae20839b..7d4e01f7c0ca3581d63c907b356db2add46da118 100644 (file)
@@ -25,7 +25,7 @@ fwriting (FILE *fp)
   /* Most systems provide FILE as a struct and the necessary bitmask in
      <stdio.h>, 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;