From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Teodor Sigaev <teodor(at)sigaev(dot)ru> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: apparent tsearch breakage on 64-bit machines |
Date: | 2007-09-08 03:34:32 |
Message-ID: | 4972.1189222472@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Oleg Bartunov | 2007-09-08 06:19:38 | Re: integrated tsearch doesn't work with non utf8 database |
Previous Message | Tom Lane | 2007-09-08 02:31:07 | apparent tsearch breakage on 64-bit machines |