[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2] ios: call `fflush' on output streams
|
From: |
Jose E. Marchesi |
|
Subject: |
Re: [PATCH v2] ios: call `fflush' on output streams |
|
Date: |
Fri, 03 Feb 2023 01:37:40 +0100 |
|
User-agent: |
Gnus/5.13 (Gnus v5.13) |
> 2023-02-03 Mohammad-Reza Nabipoor <mnabipoor@gnu.org>
>
> * libpoke/ios-dev-stream.c: Include `<assert.h>'.
> (ios_dev_stream_flush): Call `fflush' when user calls `flush'
> on output streams.
> ---
>
> Hi Jose.
>
> Agreed :)
Thanks.
OK for master!
>
>
> ChangeLog | 6 ++++++
> libpoke/ios-dev-stream.c | 8 +++++++-
> 2 files changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/ChangeLog b/ChangeLog
> index becafbc7..0e782345 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,9 @@
> +2023-02-03 Mohammad-Reza Nabipoor <mnabipoor@gnu.org>
> +
> + * libpoke/ios-dev-stream.c: Include `<assert.h>'.
> + (ios_dev_stream_flush): Call `fflush' when user calls `flush'
> + on output streams.
> +
> 2023-02-03 Jose E. Marchesi <jemarch@gnu.org>
>
> * libpoke/pkl-rt.pk (_pkl_64x64_128): New function.
> diff --git a/libpoke/ios-dev-stream.c b/libpoke/ios-dev-stream.c
> index 952af51e..573d6124 100644
> --- a/libpoke/ios-dev-stream.c
> +++ b/libpoke/ios-dev-stream.c
> @@ -20,6 +20,7 @@
> #include <stdlib.h>
> #include <unistd.h>
>
> +#include <assert.h>
> #include <stdio.h>
> #include <string.h>
>
> @@ -249,12 +250,17 @@ static int
> ios_dev_stream_flush (void *iod, ios_dev_off offset)
> {
> struct ios_dev_stream *sio = iod;
> +
> if (sio->flags & IOS_F_READ
> && offset > ios_buffer_get_begin_offset (sio->buffer)
> && offset <= ios_buffer_get_end_offset (sio->buffer))
> return ios_buffer_forget_till (sio->buffer, offset);
> else
> - return IOS_OK;
> + {
> + assert (sio->flags & IOS_F_WRITE);
> + fflush (sio->file);
> + }
> + return IOS_OK;
> }
>
> struct ios_dev_if ios_dev_stream =