]> Savannah Git Hosting - gnulib.git/commitdiff
fbufmode: Don't require peeking into the FILE structure on recent Haiku.
authorBruno Haible <bruno@clisp.org>
Thu, 24 Apr 2025 18:18:59 +0000 (20:18 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 3 May 2025 14:06:56 +0000 (16:06 +0200)
Suggested by Augustin Cavalier <waddlesplash@gmail.com>
in <https://dev.haiku-os.org/ticket/19479#comment:15>.

* lib/fbufmode.c (fbufmode): On Haiku >= hrev58760, use the same
implementation as on musl libc.

ChangeLog
lib/fbufmode.c

index 0220d602399577ce10078ccca99df9bf1a8e3ae8..19f3b0c31dc8411c749914b6668465ad007197b1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2025-04-24  Bruno Haible  <bruno@clisp.org>
+
+       fbufmode: Don't require peeking into the FILE structure on recent Haiku.
+       Suggested by Augustin Cavalier <waddlesplash@gmail.com>
+       in <https://dev.haiku-os.org/ticket/19479#comment:15>.
+       * lib/fbufmode.c (fbufmode): On Haiku >= hrev58760, use the same
+       implementation as on musl libc.
+
 2025-04-23  Collin Funk  <collin.funk1@gmail.com>
 
        tsearch tests: Disable tfind signature check on Cygwin.
index 440f019ed15d41125553cbb03d0c401345ecf359..416a7a4cd09fc40864a12e630cab912a82b7293a 100644 (file)
@@ -33,12 +33,12 @@ 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_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
+#if (defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1) && !(defined __HAIKU__ && HAVE___FLBF && HAVE___FBUFSIZE)
+  /* GNU libc, BeOS, Haiku < hrev58760, Linux libc5 */
 # if !defined __HAIKU__
 #  define fp_ fp
 # endif
-  /* GNU libc, BeOS, Haiku, Linux libc5 */
-# if HAVE___FLBF                    /* glibc >= 2.2, Haiku >= hrev58760 */
+# if HAVE___FLBF                    /* glibc >= 2.2 */
   if (__flbf (fp))
     return _IOLBF;
 # else
@@ -93,7 +93,7 @@ fbufmode (FILE *fp)
   if (fp->__linebuf)
     return _IOLBF;
   return (fp->__bufsize > 0 ? _IOFBF : _IONBF);
-#elif HAVE___FLBF && HAVE___FBUFSIZE /* musl libc */
+#elif HAVE___FLBF && HAVE___FBUFSIZE /* musl libc, Haiku >= hrev58760 */
   if (__flbf (fp))
     return _IOLBF;
   return (__fbufsize (fp) > 0 ? _IOFBF : _IONBF);