Re: apparent tsearch breakage on 64-bit machines - Mailing list pgsql-hackers

From Tom Lane
Subject Re: apparent tsearch breakage on 64-bit machines
Date
Msg-id 4972.1189222472@sss.pgh.pa.us
Whole thread Raw
In response to apparent tsearch breakage on 64-bit machines  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
I wrote:
> Whether the code is actually safe or not, these [warnings] are not acceptable.

On looking closer, it seems the intent is to pass an argument of
unspecified type through parse_tsquery to a PushFunction:

typedef void (*PushFunction)(void *opaque, TSQueryParserState state, char *, int, int2);

extern TSQuery parse_tsquery(char *buf,          PushFunction pushval,          void *opaque, bool isplain);

That's fine, but not in a way that throws compiler warnings.  There is a
standard solution for this task within PG: the arguments should be
declared as Datum not void*.  Use the DatumGetFoo/FooGetDatum macros to
coerce back and forth.

Also, the declaration of typedef PushFunction really ought to provide
names for all the arguments, for documentation purposes.  (Dare I
suggest a comment block specifying the API?)
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: apparent tsearch breakage on 64-bit machines
Next
From: Oleg Bartunov
Date:
Subject: Re: integrated tsearch doesn't work with non utf8 database