tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: fun (not so much) with funopen



On Sat, Mar 17, 2012 at 01:12:26AM +0000, Christos Zoulas wrote:
> In article <20120316223532.GA2639%britannica.bec.de@localhost>,
> Joerg Sonnenberger  <joerg%britannica.bec.de@localhost> wrote:
> >On Sat, Mar 17, 2012 at 02:14:22AM +0900, Takehiko NOZAKI wrote:
> >> POSIX2008 require open_w?memstream(3), but our stdio doesn't have
> >> chance to override FILE fflush handle.
> >> so it is hard to implement it. (and our fmemopen(3) implementation
> >> have bug related about this).
> >
> >I don't see how this relates. The only requirement form POSIX seems to
> >be that the write handler for open_w?memstream has update the buffer
> >pointer to the highest position used. It doesn't specify anything else
> >regarding to internal buffering.
> 
> I think he means in fmemopen:
> 
>     When a stream that has been opened for writing is flushed (fflush(3))
>     or closed (fclose(3)), a null byte is written at the end of the
>     buffer if there is space. The caller should ensure that an extra
>     byte is available in the buffer (and that size counts that byte)
>     to allow for this.

Sure, but doing that in the write callback should be good enough.

Joerg


Home | Main Index | Thread Index | Old Index