Re: [HACKERS] Re: [COMMITTERS] 'pgsql/src/backend/lib stringinfo.c' - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] Re: [COMMITTERS] 'pgsql/src/backend/lib stringinfo.c'
Date
Msg-id 3428.910625247@sss.pgh.pa.us
Whole thread Raw
In response to Re: [COMMITTERS] 'pgsql/src/backend/lib stringinfo.c'  (Bruce Momjian <maillist@candle.pha.pa.us>)
Responses Re: [HACKERS] Re: [COMMITTERS] 'pgsql/src/backend/lib stringinfo.c'
List pgsql-hackers
Bruce Momjian <maillist@candle.pha.pa.us> writes:
> Does [stringinfo.c] remove the need for vsnprintf?

Not directly --- the functions it currently provides only know how to
append given strings onto a StringInfo object.  There's no formatting
control.

I'm sure we could program around vsnprintf if we were determined
enough, but there isn't any other equally clean way to do what's
needed in tracing.  Probably better to spend our effort on providing
a reliable emulation of it for platforms that haven't got it.
(BTW, I have no reason to think that the emulation we have is broken;
I was just objecting to starting to depend on it only a week or so
before a major release.)

Actually, what would be *really* whizzy is some way of sprintf'ing
into a StringInfo, with the ability to auto-expand the StringInfo as
needed.  But that requires hooking into the low-level guts of printf,
and AFAIK there's no portable way to do it short of providing your
own complete printf implementation.  Not worth it.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Goran Thyni
Date:
Subject: Overruns (was: 'pgsql/src/backend/lib stringinfo.c')
Next
From: Goran Thyni
Date:
Subject: Re: [HACKERS] Re: [COMMITTERS] 'pgsql/src/backend/lib stringinfo.c'