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

Commitc1b6a48

Browse files
author
Nikita Glukhov
committed
Extract JsonValueFromCString()
1 parent5c4d00b commitc1b6a48

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

‎src/backend/utils/adt/jsonb.c

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -221,15 +221,8 @@ jsonb_typeof(PG_FUNCTION_ARGS)
221221
PG_RETURN_TEXT_P(cstring_to_text(result));
222222
}
223223

224-
/*
225-
* jsonb_from_cstring
226-
*
227-
* Turns json string into a jsonb Datum.
228-
*
229-
* Uses the json parser (with hooks) to construct a jsonb.
230-
*/
231-
staticinlineDatum
232-
jsonb_from_cstring(char*json,intlen)
224+
staticJsonbValue*
225+
JsonValueFromCString(char*json,intlen)
233226
{
234227
JsonLexContext*lex;
235228
JsonbInStatestate;
@@ -251,9 +244,21 @@ jsonb_from_cstring(char *json, int len)
251244
pg_parse_json(lex,&sem);
252245

253246
/* after parsing, the item member has the composed jsonb structure */
254-
PG_RETURN_JSONB(JsonbValueToJsonb(state.res));
247+
returnstate.res;
255248
}
256249

250+
/*
251+
* jsonb_from_cstring
252+
*
253+
* Turns json string into a jsonb Datum.
254+
*
255+
* Uses the json parser (with hooks) to construct a jsonb.
256+
*/
257+
staticinlineDatum
258+
jsonb_from_cstring(char*json,intlen)
259+
{
260+
PG_RETURN_JSONB(JsonbValueToJsonb(JsonValueFromCString(json,len)));
261+
}
257262

258263
staticvoid
259264
jsonb_in_object_start(void*pstate)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp