summaryrefslogtreecommitdiff
path: root/src/backend/tsearch/wparser.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2017-05-16 20:36:35 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2017-05-16 20:36:35 -0400
commitc079673dcb7f210617c9fc1470e6bf166d8a2971 (patch)
treecd8a2c6834da8d1157f11a38cb6272dc48e42dd1 /src/backend/tsearch/wparser.c
parentddd243584a0f353bbaba260d976cc41b251bbf21 (diff)
Preventive maintenance in advance of pgindent run.
Reformat various places in which pgindent will make a mess, and fix a few small violations of coding style that I happened to notice while perusing the diffs from a pgindent dry run. There is one actual bug fix here: the need-to-enlarge-the-buffer code path in icu_convert_case was obviously broken. Perhaps it's unreachable in our usage? Or maybe this is just sadly undertested.
Diffstat (limited to 'src/backend/tsearch/wparser.c')
-rw-r--r--src/backend/tsearch/wparser.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/backend/tsearch/wparser.c b/src/backend/tsearch/wparser.c
index c19937d644a..9739558e424 100644
--- a/src/backend/tsearch/wparser.c
+++ b/src/backend/tsearch/wparser.c
@@ -303,6 +303,7 @@ ts_parse_byname(PG_FUNCTION_ARGS)
Datum
ts_headline_byid_opt(PG_FUNCTION_ARGS)
{
+ Oid tsconfig = PG_GETARG_OID(0);
text *in = PG_GETARG_TEXT_PP(1);
TSQuery query = PG_GETARG_TSQUERY(2);
text *opt = (PG_NARGS() > 3 && PG_GETARG_POINTER(3)) ? PG_GETARG_TEXT_PP(3) : NULL;
@@ -312,7 +313,7 @@ ts_headline_byid_opt(PG_FUNCTION_ARGS)
TSConfigCacheEntry *cfg;
TSParserCacheEntry *prsobj;
- cfg = lookup_ts_config_cache(PG_GETARG_OID(0));
+ cfg = lookup_ts_config_cache(tsconfig);
prsobj = lookup_ts_parser_cache(cfg->prsId);
if (!OidIsValid(prsobj->headlineOid))
@@ -381,11 +382,12 @@ ts_headline_opt(PG_FUNCTION_ARGS)
Datum
ts_headline_jsonb_byid_opt(PG_FUNCTION_ARGS)
{
- Jsonb *out, *jb = PG_GETARG_JSONB(1);
+ Oid tsconfig = PG_GETARG_OID(0);
+ Jsonb *jb = PG_GETARG_JSONB(1);
TSQuery query = PG_GETARG_TSQUERY(2);
text *opt = (PG_NARGS() > 3 && PG_GETARG_POINTER(3)) ? PG_GETARG_TEXT_P(3) : NULL;
+ Jsonb *out;
JsonTransformStringValuesAction action = (JsonTransformStringValuesAction) headline_json_value;
-
HeadlineParsedText prs;
HeadlineJsonState *state = palloc0(sizeof(HeadlineJsonState));
@@ -394,7 +396,7 @@ ts_headline_jsonb_byid_opt(PG_FUNCTION_ARGS)
prs.words = (HeadlineWordEntry *) palloc(sizeof(HeadlineWordEntry) * prs.lenwords);
state->prs = &prs;
- state->cfg = lookup_ts_config_cache(PG_GETARG_OID(0));
+ state->cfg = lookup_ts_config_cache(tsconfig);
state->prsobj = lookup_ts_parser_cache(state->cfg->prsId);
state->query = query;
if (opt)
@@ -456,6 +458,7 @@ ts_headline_jsonb_opt(PG_FUNCTION_ARGS)
Datum
ts_headline_json_byid_opt(PG_FUNCTION_ARGS)
{
+ Oid tsconfig = PG_GETARG_OID(0);
text *json = PG_GETARG_TEXT_P(1);
TSQuery query = PG_GETARG_TSQUERY(2);
text *opt = (PG_NARGS() > 3 && PG_GETARG_POINTER(3)) ? PG_GETARG_TEXT_P(3) : NULL;
@@ -470,7 +473,7 @@ ts_headline_json_byid_opt(PG_FUNCTION_ARGS)
prs.words = (HeadlineWordEntry *) palloc(sizeof(HeadlineWordEntry) * prs.lenwords);
state->prs = &prs;
- state->cfg = lookup_ts_config_cache(PG_GETARG_OID(0));
+ state->cfg = lookup_ts_config_cache(tsconfig);
state->prsobj = lookup_ts_parser_cache(state->cfg->prsId);
state->query = query;
if (opt)