[ping][PATCH 0/3] Guarantee first pushback in ungetc and ungetwc
Siddhesh Poyarekar
siddhesh@sourceware.org
Mon Nov 18 15:02:43 GMT 2024
Ping!
On 2024-11-08 12:14, Siddhesh Poyarekar wrote:
> The C standard requires the first pushback after read operations to
> succeed for ungetc and ungetwc. Use a single-char buffer in the FILE
> struct to guarantee this, so that the calls are not subject to a malloc
> failure.
>
> Tested on x86_64.
>
> Siddhesh Poyarekar (3):
> libio: make _IO_least_marker static
> ungetc: Guarantee single char pushback
> ungetwc: Guarantee single char pushback
>
> libio/Makefile | 1 +
> libio/bits/types/struct_FILE.h | 3 +-
> libio/fileops.c | 21 +++-----
> libio/genops.c | 35 ++++++------
> libio/libio.h | 1 +
> libio/tst-ungetwc-nomem.c | 94 +++++++++++++++++++++++++++++++++
> libio/wfileops.c | 28 +++-------
> libio/wgenops.c | 29 +++++-----
> stdio-common/Makefile | 1 +
> stdio-common/tst-ungetc-nomem.c | 94 +++++++++++++++++++++++++++++++++
> 10 files changed, 240 insertions(+), 67 deletions(-)
> create mode 100644 libio/tst-ungetwc-nomem.c
> create mode 100644 stdio-common/tst-ungetc-nomem.c
>
More information about the Libc-alpha
mailing list