diff options
Diffstat (limited to 'gl/fflush.c')
| -rw-r--r-- | gl/fflush.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/gl/fflush.c b/gl/fflush.c index 36cc14d1..d8619082 100644 --- a/gl/fflush.c +++ b/gl/fflush.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* fflush.c -- allow flushing input streams | 1 | /* fflush.c -- allow flushing input streams |
| 2 | Copyright (C) 2007-2024 Free Software Foundation, Inc. | 2 | Copyright (C) 2007-2025 Free Software Foundation, Inc. |
| 3 | 3 | ||
| 4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
| 5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
| @@ -33,12 +33,15 @@ | |||
| 33 | 33 | ||
| 34 | #if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 | 34 | #if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 |
| 35 | /* GNU libc, BeOS, Haiku, Linux libc5 */ | 35 | /* GNU libc, BeOS, Haiku, Linux libc5 */ |
| 36 | # if !defined __HAIKU__ | ||
| 37 | # define fp_ fp | ||
| 38 | # endif | ||
| 36 | 39 | ||
| 37 | /* Clear the stream's ungetc buffer, preserving the value of ftello (fp). */ | 40 | /* Clear the stream's ungetc buffer, preserving the value of ftello (fp). */ |
| 38 | static void | 41 | static void |
| 39 | clear_ungetc_buffer_preserving_position (FILE *fp) | 42 | clear_ungetc_buffer_preserving_position (FILE *fp) |
| 40 | { | 43 | { |
| 41 | if (fp->_flags & _IO_IN_BACKUP) | 44 | if (fp_->_flags & _IO_IN_BACKUP) |
| 42 | /* _IO_free_backup_area is a bit complicated. Simply call fseek. */ | 45 | /* _IO_free_backup_area is a bit complicated. Simply call fseek. */ |
| 43 | fseeko (fp, 0, SEEK_CUR); | 46 | fseeko (fp, 0, SEEK_CUR); |
| 44 | } | 47 | } |
| @@ -50,7 +53,7 @@ static void | |||
| 50 | clear_ungetc_buffer (FILE *fp) | 53 | clear_ungetc_buffer (FILE *fp) |
| 51 | { | 54 | { |
| 52 | # if defined __sferror || defined __DragonFly__ || defined __ANDROID__ | 55 | # if defined __sferror || defined __DragonFly__ || defined __ANDROID__ |
| 53 | /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ | 56 | /* FreeBSD, NetBSD, OpenBSD <= 7.7, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ |
| 54 | if (HASUB (fp)) | 57 | if (HASUB (fp)) |
| 55 | { | 58 | { |
| 56 | fp_->_p += fp_->_r; | 59 | fp_->_p += fp_->_r; |
| @@ -75,7 +78,7 @@ clear_ungetc_buffer (FILE *fp) | |||
| 75 | /* GNU libc, BeOS, Haiku, Linux libc5 */ | 78 | /* GNU libc, BeOS, Haiku, Linux libc5 */ |
| 76 | 79 | ||
| 77 | # if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT | 80 | # if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT |
| 78 | /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ | 81 | /* FreeBSD, NetBSD, OpenBSD <= 7.7, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ |
| 79 | 82 | ||
| 80 | static int | 83 | static int |
| 81 | disable_seek_optimization (FILE *fp) | 84 | disable_seek_optimization (FILE *fp) |
| @@ -98,7 +101,7 @@ update_fpos_cache (_GL_ATTRIBUTE_MAYBE_UNUSED FILE *fp, | |||
| 98 | _GL_ATTRIBUTE_MAYBE_UNUSED off_t pos) | 101 | _GL_ATTRIBUTE_MAYBE_UNUSED off_t pos) |
| 99 | { | 102 | { |
| 100 | # if defined __sferror || defined __DragonFly__ || defined __ANDROID__ | 103 | # if defined __sferror || defined __DragonFly__ || defined __ANDROID__ |
| 101 | /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ | 104 | /* FreeBSD, NetBSD, OpenBSD <= 7.7, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ |
| 102 | # if defined __CYGWIN__ || defined __ANDROID__ | 105 | # if defined __CYGWIN__ || defined __ANDROID__ |
| 103 | /* fp_->_offset is typed as an integer. */ | 106 | /* fp_->_offset is typed as an integer. */ |
| 104 | fp_->_offset = pos; | 107 | fp_->_offset = pos; |
| @@ -203,7 +206,7 @@ rpl_fflush (FILE *stream) | |||
| 203 | } | 206 | } |
| 204 | 207 | ||
| 205 | # if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT | 208 | # if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT |
| 206 | /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ | 209 | /* FreeBSD, NetBSD, OpenBSD <= 7.7, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ |
| 207 | 210 | ||
| 208 | { | 211 | { |
| 209 | /* Disable seek optimization for the next fseeko call. This tells the | 212 | /* Disable seek optimization for the next fseeko call. This tells the |
