mirror of
https://github.com/postgres/postgres.git
synced 2025-12-31 00:03:29 -05:00
Change some Datum to void * for opaque pass-through pointer
Here, Datum was used to pass around an opaque pointer between a group of functions. But one might as well use void * for that; the use of Datum doesn't achieve anything here and is just distracting. Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://www.postgresql.org/message-id/flat/1c5d23cb-288b-4154-b1cd-191fe2301707%40eisentraut.org
This commit is contained in:
parent
9adf32da6b
commit
b7057e4346
@ -489,7 +489,7 @@ add_to_tsvector(void *_state, char *elem_value, int elem_len)
|
||||
* and different variants are ORed together.
|
||||
*/
|
||||
static void
|
||||
pushval_morph(Datum opaque, TSQueryParserState state, char *strval, int lenval, int16 weight, bool prefix)
|
||||
pushval_morph(void *opaque, TSQueryParserState state, char *strval, int lenval, int16 weight, bool prefix)
|
||||
{
|
||||
int32 count = 0;
|
||||
ParsedText prs;
|
||||
@ -498,7 +498,7 @@ pushval_morph(Datum opaque, TSQueryParserState state, char *strval, int lenval,
|
||||
cntvar = 0,
|
||||
cntpos = 0,
|
||||
cnt = 0;
|
||||
MorphOpaque *data = (MorphOpaque *) DatumGetPointer(opaque);
|
||||
MorphOpaque *data = opaque;
|
||||
|
||||
prs.lenwords = 4;
|
||||
prs.curwords = 0;
|
||||
@ -594,7 +594,7 @@ to_tsquery_byid(PG_FUNCTION_ARGS)
|
||||
|
||||
query = parse_tsquery(text_to_cstring(in),
|
||||
pushval_morph,
|
||||
PointerGetDatum(&data),
|
||||
&data,
|
||||
0,
|
||||
NULL);
|
||||
|
||||
@ -631,7 +631,7 @@ plainto_tsquery_byid(PG_FUNCTION_ARGS)
|
||||
|
||||
query = parse_tsquery(text_to_cstring(in),
|
||||
pushval_morph,
|
||||
PointerGetDatum(&data),
|
||||
&data,
|
||||
P_TSQ_PLAIN,
|
||||
NULL);
|
||||
|
||||
@ -669,7 +669,7 @@ phraseto_tsquery_byid(PG_FUNCTION_ARGS)
|
||||
|
||||
query = parse_tsquery(text_to_cstring(in),
|
||||
pushval_morph,
|
||||
PointerGetDatum(&data),
|
||||
&data,
|
||||
P_TSQ_PLAIN,
|
||||
NULL);
|
||||
|
||||
@ -707,7 +707,7 @@ websearch_to_tsquery_byid(PG_FUNCTION_ARGS)
|
||||
|
||||
query = parse_tsquery(text_to_cstring(in),
|
||||
pushval_morph,
|
||||
PointerGetDatum(&data),
|
||||
&data,
|
||||
P_TSQ_WEB,
|
||||
NULL);
|
||||
|
||||
|
||||
@ -671,7 +671,7 @@ cleanOpStack(TSQueryParserState state,
|
||||
static void
|
||||
makepol(TSQueryParserState state,
|
||||
PushFunction pushval,
|
||||
Datum opaque)
|
||||
void *opaque)
|
||||
{
|
||||
int8 operator = 0;
|
||||
ts_tokentype type;
|
||||
@ -816,7 +816,7 @@ findoprnd(QueryItem *ptr, int size, bool *needcleanup)
|
||||
TSQuery
|
||||
parse_tsquery(char *buf,
|
||||
PushFunction pushval,
|
||||
Datum opaque,
|
||||
void *opaque,
|
||||
int flags,
|
||||
Node *escontext)
|
||||
{
|
||||
@ -939,7 +939,7 @@ parse_tsquery(char *buf,
|
||||
}
|
||||
|
||||
static void
|
||||
pushval_asis(Datum opaque, TSQueryParserState state, char *strval, int lenval,
|
||||
pushval_asis(void *opaque, TSQueryParserState state, char *strval, int lenval,
|
||||
int16 weight, bool prefix)
|
||||
{
|
||||
pushValue(state, strval, lenval, weight, prefix);
|
||||
@ -956,7 +956,7 @@ tsqueryin(PG_FUNCTION_ARGS)
|
||||
|
||||
PG_RETURN_TSQUERY(parse_tsquery(in,
|
||||
pushval_asis,
|
||||
PointerGetDatum(NULL),
|
||||
NULL,
|
||||
0,
|
||||
escontext));
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ extern void close_tsvector_parser(TSVectorParseState state);
|
||||
struct TSQueryParserStateData; /* private in backend/utils/adt/tsquery.c */
|
||||
typedef struct TSQueryParserStateData *TSQueryParserState;
|
||||
|
||||
typedef void (*PushFunction) (Datum opaque, TSQueryParserState state,
|
||||
typedef void (*PushFunction) (void *opaque, TSQueryParserState state,
|
||||
char *token, int tokenlen,
|
||||
int16 tokenweights, /* bitmap as described in
|
||||
* QueryOperand struct */
|
||||
@ -66,7 +66,7 @@ typedef void (*PushFunction) (Datum opaque, TSQueryParserState state,
|
||||
|
||||
extern TSQuery parse_tsquery(char *buf,
|
||||
PushFunction pushval,
|
||||
Datum opaque,
|
||||
void *opaque,
|
||||
int flags,
|
||||
Node *escontext);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user