Re: resetStringInfo

From: Neil Conway <neilc(at)samurai(dot)com>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: resetStringInfo
Date: 2007-03-03 19:43:26
Message-ID: 1172951006.6571.68.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

On Sat, 2007-03-03 at 15:04 -0300, Alvaro Herrera wrote:
> 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.

I'm not opposed to this idea in general, but I didn't bother doing it
for StringInfo as part of this patch. Besides it being more work :), I
also wonder if it's a net win to make the change for structs that are
directly accessed by code that lives outside the PG tree (e.g.
StringInfo).

As for making it a coding guideline, I think it would be a good idea to
codify some of the more common rules and idioms in the Postgres source
tree. Most of these sorts of issues are flagged during code review, but
it might save some time in the long run to enumerate some code style
suggestions on the wiki or somewhere similar.

-Neil

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2007-03-03 19:52:48 Re: lo_truncate
Previous Message Bruce Momjian 2007-03-03 19:41:38 Re: xpath_array with namespaces support