Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0bef23f

Browse files
author
Nikita Glukhov
committed
Remove unused json functions
1 parent7237e09 commit0bef23f

File tree

6 files changed

+208
-3356
lines changed

6 files changed

+208
-3356
lines changed

‎src/backend/tsearch/to_tsany.c

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -350,13 +350,7 @@ jsonb_to_tsvector(PG_FUNCTION_ARGS)
350350
* Worker function for json(_string)_to_tsvector(_byid)
351351
*/
352352
staticTSVector
353-
json_to_tsvector_worker(OidcfgId,
354-
#ifndefJSON_GENERIC
355-
text*json,
356-
#else
357-
Jsonb*json,
358-
#endif
359-
uint32flags)
353+
json_to_tsvector_worker(OidcfgId,Jsonb*json,uint32flags)
360354
{
361355
TSVectorBuildStatestate;
362356
ParsedTextprs;
@@ -366,11 +360,7 @@ json_to_tsvector_worker(Oid cfgId,
366360
state.prs=&prs;
367361
state.cfgId=cfgId;
368362

369-
#ifndefJSON_GENERIC
370-
iterate_json_values(json,flags,&state,add_to_tsvector);
371-
#else
372363
iterate_jsonb_values(json,flags,&state,add_to_tsvector);
373-
#endif
374364

375365
returnmake_tsvector(&prs);
376366
}
@@ -379,41 +369,25 @@ Datum
379369
json_string_to_tsvector_byid(PG_FUNCTION_ARGS)
380370
{
381371
OidcfgId=PG_GETARG_OID(0);
382-
#ifndefJSON_GENERIC
383-
text*json=PG_GETARG_TEXT_P(1);
384-
#else
385372
Jsonb*json=DatumGetJsontP(PG_GETARG_DATUM(1));
386-
#endif
387373
TSVectorresult;
388374

389375
result=json_to_tsvector_worker(cfgId,json,jtiString);
390-
#ifndefJSON_GENERIC
391-
PG_FREE_IF_COPY(json,1);
392-
#else
393376
PG_FREE_IF_COPY_JSONB(json,1);
394-
#endif
395377

396378
PG_RETURN_TSVECTOR(result);
397379
}
398380

399381
Datum
400382
json_string_to_tsvector(PG_FUNCTION_ARGS)
401383
{
402-
#ifndefJSON_GENERIC
403-
text*json=PG_GETARG_TEXT_P(0);
404-
#else
405384
Jsonb*json=DatumGetJsontP(PG_GETARG_DATUM(0));
406-
#endif
407385
OidcfgId;
408386
TSVectorresult;
409387

410388
cfgId=getTSCurrentConfig(true);
411389
result=json_to_tsvector_worker(cfgId,json,jtiString);
412-
#ifndefJSON_GENERIC
413-
PG_FREE_IF_COPY(json,0);
414-
#else
415390
PG_FREE_IF_COPY_JSONB(json,0);
416-
#endif
417391

418392
PG_RETURN_TSVECTOR(result);
419393
}
@@ -422,21 +396,13 @@ Datum
422396
json_to_tsvector_byid(PG_FUNCTION_ARGS)
423397
{
424398
OidcfgId=PG_GETARG_OID(0);
425-
#ifndefJSON_GENERIC
426-
text*json=PG_GETARG_TEXT_P(1);
427-
#else
428399
Jsonb*json=DatumGetJsontP(PG_GETARG_DATUM(1));
429-
#endif
430400
Jsonb*jbFlags=PG_GETARG_JSONB_P(2);
431401
TSVectorresult;
432402
uint32flags=parse_jsonb_index_flags(jbFlags);
433403

434404
result=json_to_tsvector_worker(cfgId,json,flags);
435-
#ifndefJSON_GENERIC
436-
PG_FREE_IF_COPY(json,1);
437-
#else
438405
PG_FREE_IF_COPY_JSONB(json,1);
439-
#endif
440406
PG_FREE_IF_COPY_JSONB(jbFlags,2);
441407

442408
PG_RETURN_TSVECTOR(result);
@@ -445,23 +411,15 @@ json_to_tsvector_byid(PG_FUNCTION_ARGS)
445411
Datum
446412
json_to_tsvector(PG_FUNCTION_ARGS)
447413
{
448-
#ifndefJSON_GENERIC
449-
text*json=PG_GETARG_TEXT_P(0);
450-
#else
451414
Jsonb*json=DatumGetJsontP(PG_GETARG_DATUM(0));
452-
#endif
453415
Jsonb*jbFlags=PG_GETARG_JSONB_P(1);
454416
OidcfgId;
455417
TSVectorresult;
456418
uint32flags=parse_jsonb_index_flags(jbFlags);
457419

458420
cfgId=getTSCurrentConfig(true);
459421
result=json_to_tsvector_worker(cfgId,json,flags);
460-
#ifndefJSON_GENERIC
461-
PG_FREE_IF_COPY(json,0);
462-
#else
463422
PG_FREE_IF_COPY_JSONB(json,0);
464-
#endif
465423
PG_FREE_IF_COPY_JSONB(jbFlags,1);
466424

467425
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
Oidtsconfig=PG_GETARG_OID(0);
458-
#ifndefJSON_GENERIC
459-
text*json=PG_GETARG_TEXT_P(1);
460-
#else
461458
Jsonb*json=DatumGetJsontP(PG_GETARG_DATUM(1));
462-
#endif
463459
TSQueryquery=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-
#ifndefJSON_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)

[8]ページ先頭

©2009-2025 Movatter.jp