Re: confusing typedefs in jsonfuncs.c - Mailing list pgsql-hackers

From Tom Lane
Subject Re: confusing typedefs in jsonfuncs.c
Date
Msg-id 555.1374197684@sss.pgh.pa.us
Whole thread Raw
In response to confusing typedefs in jsonfuncs.c  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: confusing typedefs in jsonfuncs.c
List pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> The new jsonfuncs.c has some confusing typedef scheme.  For example, it
> has a bunch of definitions like this:

> typedef struct getState
> {
>     ...
> } getState, *GetState;

> So GetState is a pointer to getState.  I have never seen that kind of
> convention before.

Yeah, this is randomly different from everywhere else in PG.  The more
usual convention if you want typedefs for both the struct and the
pointer type is that the pointer type is FooBar and the struct type is
FooBarData.  This way seems seriously typo-prone.

> I think a more typical PostgreSQL code convention is to use capitalized
> camelcase for structs, and use explicit pointers for pointers.  I have
> attached a patch that cleans this up, in my opinion.

That way is fine with me too.

If you commit this, please hit 9.3 as well, so that we don't have
back-patching issues.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: confusing typedefs in jsonfuncs.c
Next
From: Noah Misch
Date:
Subject: Re: Proposal/design feedback needed: WITHIN GROUP (sql standard ordered set aggregate functions)