From 4a1b37a5717ddccd31c3516cfb7dba0b9eab2252 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 24 Apr 2025 20:18:59 +0200 Subject: [PATCH] fbufmode: Don't require peeking into the FILE structure on recent Haiku. Suggested by Augustin Cavalier in . * lib/fbufmode.c (fbufmode): On Haiku >= hrev58760, use the same implementation as on musl libc. --- ChangeLog | 8 ++++++++ lib/fbufmode.c | 8 ++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 018e9f8e6c..05044ceb78 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2025-04-24 Bruno Haible + + fbufmode: Don't require peeking into the FILE structure on recent Haiku. + Suggested by Augustin Cavalier + in . + * lib/fbufmode.c (fbufmode): On Haiku >= hrev58760, use the same + implementation as on musl libc. + 2025-04-24 Bruno Haible getlocalename_l-unsafe: Disable unwanted compiler optimization. diff --git a/lib/fbufmode.c b/lib/fbufmode.c index 440f019ed1..416a7a4cd0 100644 --- a/lib/fbufmode.c +++ b/lib/fbufmode.c @@ -33,12 +33,12 @@ 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_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); -- 2.39.5