+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-24 Bruno Haible <bruno@clisp.org>
getlocalename_l-unsafe: Disable unwanted compiler optimization.
/* 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
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);