mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-12 18:34:36 +08:00
Change void* opaque argument to Datum type, add argument's
name to PushFunction type definition. Per suggestion by Tome Lane <tgl@sss.pgh.pa.us>
This commit is contained in:
parent
83d0b9f3ca
commit
d982daae0b
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/tsearch/to_tsany.c,v 1.2 2007/09/07 15:09:55 teodor Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/tsearch/to_tsany.c,v 1.3 2007/09/10 12:36:40 teodor Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -235,7 +235,7 @@ to_tsvector(PG_FUNCTION_ARGS)
|
||||
* and different variants are ORred together.
|
||||
*/
|
||||
static void
|
||||
pushval_morph(void *opaque, TSQueryParserState state, char *strval, int lenval, int2 weight)
|
||||
pushval_morph(Datum opaque, TSQueryParserState state, char *strval, int lenval, int2 weight)
|
||||
{
|
||||
int4 count = 0;
|
||||
ParsedText prs;
|
||||
@ -244,7 +244,7 @@ pushval_morph(void *opaque, TSQueryParserState state, char *strval, int lenval,
|
||||
cntvar = 0,
|
||||
cntpos = 0,
|
||||
cnt = 0;
|
||||
Oid cfg_id = (Oid) opaque; /* the input is actually an Oid, not a pointer */
|
||||
Oid cfg_id = DatumGetObjectId(opaque); /* the input is actually an Oid, not a pointer */
|
||||
|
||||
prs.lenwords = 4;
|
||||
prs.curwords = 0;
|
||||
@ -303,7 +303,7 @@ to_tsquery_byid(PG_FUNCTION_ARGS)
|
||||
QueryItem *res;
|
||||
int4 len;
|
||||
|
||||
query = parse_tsquery(TextPGetCString(in), pushval_morph, (void *) cfgid, false);
|
||||
query = parse_tsquery(TextPGetCString(in), pushval_morph, ObjectIdGetDatum(cfgid), false);
|
||||
|
||||
if (query->size == 0)
|
||||
PG_RETURN_TSQUERY(query);
|
||||
@ -341,7 +341,7 @@ plainto_tsquery_byid(PG_FUNCTION_ARGS)
|
||||
QueryItem *res;
|
||||
int4 len;
|
||||
|
||||
query = parse_tsquery(TextPGetCString(in), pushval_morph, (void *)cfgid, true);
|
||||
query = parse_tsquery(TextPGetCString(in), pushval_morph, ObjectIdGetDatum(cfgid), true);
|
||||
|
||||
if (query->size == 0)
|
||||
PG_RETURN_TSQUERY(query);
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/tsquery.c,v 1.5 2007/09/07 16:03:40 teodor Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/tsquery.c,v 1.6 2007/09/10 12:36:40 teodor Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -314,7 +314,7 @@ pushStop(TSQueryParserState state)
|
||||
static void
|
||||
makepol(TSQueryParserState state,
|
||||
PushFunction pushval,
|
||||
void *opaque)
|
||||
Datum opaque)
|
||||
{
|
||||
int8 operator = 0;
|
||||
ts_tokentype type;
|
||||
@ -460,7 +460,7 @@ findoprnd(QueryItem *ptr, int size)
|
||||
TSQuery
|
||||
parse_tsquery(char *buf,
|
||||
PushFunction pushval,
|
||||
void *opaque,
|
||||
Datum opaque,
|
||||
bool isplain)
|
||||
{
|
||||
struct TSQueryParserStateData state;
|
||||
@ -543,7 +543,7 @@ parse_tsquery(char *buf,
|
||||
}
|
||||
|
||||
static void
|
||||
pushval_asis(void *opaque, TSQueryParserState state, char *strval, int lenval,
|
||||
pushval_asis(Datum opaque, TSQueryParserState state, char *strval, int lenval,
|
||||
int16 weight)
|
||||
{
|
||||
pushValue(state, strval, lenval, weight);
|
||||
@ -559,7 +559,7 @@ tsqueryin(PG_FUNCTION_ARGS)
|
||||
|
||||
pg_verifymbstr(in, strlen(in), false);
|
||||
|
||||
PG_RETURN_TSQUERY(parse_tsquery(in, pushval_asis, NULL, false));
|
||||
PG_RETURN_TSQUERY(parse_tsquery(in, pushval_asis, PointerGetDatum(NULL), false));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -5,7 +5,7 @@
|
||||
*
|
||||
* Copyright (c) 1998-2007, PostgreSQL Global Development Group
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/tsearch/ts_utils.h,v 1.3 2007/09/07 15:09:56 teodor Exp $
|
||||
* $PostgreSQL: pgsql/src/include/tsearch/ts_utils.h,v 1.4 2007/09/10 12:36:41 teodor Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -38,11 +38,13 @@ extern void close_tsvector_parser(TSVectorParseState state);
|
||||
struct TSQueryParserStateData; /* private in backend/utils/adt/tsquery.c */
|
||||
typedef struct TSQueryParserStateData *TSQueryParserState;
|
||||
|
||||
typedef void (*PushFunction)(void *opaque, TSQueryParserState state, char *, int, int2);
|
||||
typedef void (*PushFunction)(Datum opaque, TSQueryParserState state,
|
||||
char *token, int tokenlen,
|
||||
int2 tokenweights /* bitmap as described in QueryOperand struct */ );
|
||||
|
||||
extern TSQuery parse_tsquery(char *buf,
|
||||
PushFunction pushval,
|
||||
void *opaque, bool isplain);
|
||||
Datum opaque, bool isplain);
|
||||
|
||||
/* Functions for use by PushFunction implementations */
|
||||
extern void pushValue(TSQueryParserState state,
|
||||
|
Loading…
Reference in New Issue
Block a user