[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Thu, 31 Mar 2005 19:00:01 -0800
Oops, I wasn't aware of the static duration of the buffers. I thought
they all just leaked. Stupid me... I'm sorry. I'll read more carefully
before posting the next time.
On Fri, 01 Apr 2005 10:00:41 +0900
Shigio Yamaguchi <address@hidden> wrote:
> I have some questions. (Please don't think that I oppose you.)
> > They return strbuf_value, and don't close it. At least some of them seem
> > to be intentional, but even if that's the case, it's certainly bad practice.
> > (Might it be because these codes were copied from Perl and not yet adapted
> > to C?)
> Why do you think it is bad practice?
> > Since the return values for most of these are immediately flushed to files,
> > why don't we pass a (custom) stream to it? Later on, if and when the
> > string is needed, we can implement a "stream" object backed by an on-memory
> > buffer (or simply read out the string from the stream).
> What and how does it improve?
I thought of giving the functions a substitute of STRBUF that writes
out to file immediately as a straightforward solution to the "leak,"
but using static works just as fine. Since we have the latter working,
there's no reason to switch.