Skip to content

Commit 8e3c8b3

Browse files
author
Nikita Glukhov
committed
Remove unused json functions
1 parent 1808ec2 commit 8e3c8b3

File tree

6 files changed

+213
-3359
lines changed

6 files changed

+213
-3359
lines changed

src/backend/tsearch/to_tsany.c

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -360,13 +360,7 @@ jsonb_to_tsvector(PG_FUNCTION_ARGS)
360360
* Worker function for json(_string)_to_tsvector(_byid)
361361
*/
362362
static TSVector
363-
json_to_tsvector_worker(Oid cfgId,
364-
#ifndef JSON_GENERIC
365-
text *json,
366-
#else
367-
Jsonb *json,
368-
#endif
369-
uint32 flags)
363+
json_to_tsvector_worker(Oid cfgId, Jsonb *json, uint32 flags)
370364
{
371365
TSVectorBuildState state;
372366
ParsedText prs;
@@ -376,11 +370,7 @@ json_to_tsvector_worker(Oid cfgId,
376370
state.prs = &prs;
377371
state.cfgId = cfgId;
378372

379-
#ifndef JSON_GENERIC
380-
iterate_json_values(json, flags, &state, add_to_tsvector);
381-
#else
382373
iterate_jsonb_values(json, flags, &state, add_to_tsvector);
383-
#endif
384374

385375
return make_tsvector(&prs);
386376
}
@@ -389,41 +379,25 @@ Datum
389379
json_string_to_tsvector_byid(PG_FUNCTION_ARGS)
390380
{
391381
Oid cfgId = PG_GETARG_OID(0);
392-
#ifndef JSON_GENERIC
393-
text *json = PG_GETARG_TEXT_P(1);
394-
#else
395382
Jsonb *json = DatumGetJsontP(PG_GETARG_DATUM(1));
396-
#endif
397383
TSVector result;
398384

399385
result = json_to_tsvector_worker(cfgId, json, jtiString);
400-
#ifndef JSON_GENERIC
401-
PG_FREE_IF_COPY(json, 1);
402-
#else
403386
PG_FREE_IF_COPY_JSONB(json, 1);
404-
#endif
405387

406388
PG_RETURN_TSVECTOR(result);
407389
}
408390

409391
Datum
410392
json_string_to_tsvector(PG_FUNCTION_ARGS)
411393
{
412-
#ifndef JSON_GENERIC
413-
text *json = PG_GETARG_TEXT_P(0);
414-
#else
415394
Jsonb *json = DatumGetJsontP(PG_GETARG_DATUM(0));
416-
#endif
417395
Oid cfgId;
418396
TSVector result;
419397

420398
cfgId = getTSCurrentConfig(true);
421399
result = json_to_tsvector_worker(cfgId, json, jtiString);
422-
#ifndef JSON_GENERIC
423-
PG_FREE_IF_COPY(json, 0);
424-
#else
425400
PG_FREE_IF_COPY_JSONB(json, 0);
426-
#endif
427401

428402
PG_RETURN_TSVECTOR(result);
429403
}
@@ -432,21 +406,13 @@ Datum
432406
json_to_tsvector_byid(PG_FUNCTION_ARGS)
433407
{
434408
Oid cfgId = PG_GETARG_OID(0);
435-
#ifndef JSON_GENERIC
436-
text *json = PG_GETARG_TEXT_P(1);
437-
#else
438409
Jsonb *json = DatumGetJsontP(PG_GETARG_DATUM(1));
439-
#endif
440410
Jsonb *jbFlags = PG_GETARG_JSONB_P(2);
441411
TSVector result;
442412
uint32 flags = parse_jsonb_index_flags(jbFlags);
443413

444414
result = json_to_tsvector_worker(cfgId, json, flags);
445-
#ifndef JSON_GENERIC
446-
PG_FREE_IF_COPY(json, 1);
447-
#else
448415
PG_FREE_IF_COPY_JSONB(json, 1);
449-
#endif
450416
PG_FREE_IF_COPY_JSONB(jbFlags, 2);
451417

452418
PG_RETURN_TSVECTOR(result);
@@ -455,23 +421,15 @@ json_to_tsvector_byid(PG_FUNCTION_ARGS)
455421
Datum
456422
json_to_tsvector(PG_FUNCTION_ARGS)
457423
{
458-
#ifndef JSON_GENERIC
459-
text *json = PG_GETARG_TEXT_P(0);
460-
#else
461424
Jsonb *json = DatumGetJsontP(PG_GETARG_DATUM(0));
462-
#endif
463425
Jsonb *jbFlags = PG_GETARG_JSONB_P(1);
464426
Oid cfgId;
465427
TSVector result;
466428
uint32 flags = parse_jsonb_index_flags(jbFlags);
467429

468430
cfgId = getTSCurrentConfig(true);
469431
result = json_to_tsvector_worker(cfgId, json, flags);
470-
#ifndef JSON_GENERIC
471-
PG_FREE_IF_COPY(json, 0);
472-
#else
473432
PG_FREE_IF_COPY_JSONB(json, 0);
474-
#endif
475433
PG_FREE_IF_COPY_JSONB(jbFlags, 1);
476434

477435
PG_RETURN_TSVECTOR(result);

src/backend/tsearch/wparser.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -455,11 +455,7 @@ Datum
455455
ts_headline_json_byid_opt(PG_FUNCTION_ARGS)
456456
{
457457
Oid tsconfig = PG_GETARG_OID(0);
458-
#ifndef JSON_GENERIC
459-
text *json = PG_GETARG_TEXT_P(1);
460-
#else
461458
Jsonb *json = DatumGetJsontP(PG_GETARG_DATUM(1));
462-
#endif
463459
TSQuery query = PG_GETARG_TSQUERY(2);
464460
text *opt = (PG_NARGS() > 3 && PG_GETARG_POINTER(3)) ? PG_GETARG_TEXT_P(3) : NULL;
465461
text *out;
@@ -486,10 +482,6 @@ ts_headline_json_byid_opt(PG_FUNCTION_ARGS)
486482
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
487483
errmsg("text search parser does not support headline creation")));
488484

489-
#ifndef JSON_GENERIC
490-
out = transform_json_string_values(json, state, action);
491-
PG_FREE_IF_COPY(json, 1);
492-
#else
493485
{
494486
Jsonb *jsonb = transform_jsonb_string_values(json, state, action, true);
495487
char *str = JsonToCString(&jsonb->root);
@@ -500,7 +492,6 @@ ts_headline_json_byid_opt(PG_FUNCTION_ARGS)
500492

501493
PG_FREE_IF_COPY_JSONB(json, 1);
502494
}
503-
#endif
504495

505496
PG_FREE_IF_COPY(query, 2);
506497
if (opt)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy