Neil Conway wrote:
> On Sat, 2007-03-03 at 11:23 -0500, Bruce Momjian wrote:
> > Are there any places in our code where we could use it?
>
> I manually grep'ed around and found a few places where resetStringInfo
> can be used, but I probably didn't find them all: it's quite hard to
> find all the places in which "StringInfo->len = 0" is assigned to, given
> that the StringInfo might have any variable name, and variables like
> "len" and "buf" are very common for other purposes.
I think this is the reason why struct members are prefixed with some
short form of the struct name; for example struct timeval has tv_sec and
tv_usec. This is used in a lot of places in our code. Maybe it would
be a good idea to make it a coding guideline. For example, I'd rename
StringInfo members as si_len, si_buf, si_data, which would make this job
quite a lot easier.
(Yes, the patch would be big, but it's easy to do, if a bit tedious
because you just rename the struct and the obvious places, and then let
the compiler catch the rest.)
--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support