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

Commitff41a5d

Browse files
committed
Clean up new JSON API typedefs
The new JSON API uses a bit of an unusual typedef scheme, where forexample OkeysState is a pointer to okeysState. And that's not appliedconsistently either. Change that to the more usual PostgreSQL stylewhere struct typedefs are upper case, and use pointers explicitly.
1 parent6737aa7 commitff41a5d

File tree

3 files changed

+100
-102
lines changed

3 files changed

+100
-102
lines changed

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

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ typedef enum/* contexts of JSON parser */
5151
staticinlinevoidjson_lex(JsonLexContext*lex);
5252
staticinlinevoidjson_lex_string(JsonLexContext*lex);
5353
staticinlinevoidjson_lex_number(JsonLexContext*lex,char*s);
54-
staticinlinevoidparse_scalar(JsonLexContext*lex,JsonSemActionsem);
55-
staticvoidparse_object_field(JsonLexContext*lex,JsonSemActionsem);
56-
staticvoidparse_object(JsonLexContext*lex,JsonSemActionsem);
57-
staticvoidparse_array_element(JsonLexContext*lex,JsonSemActionsem);
58-
staticvoidparse_array(JsonLexContext*lex,JsonSemActionsem);
54+
staticinlinevoidparse_scalar(JsonLexContext*lex,JsonSemAction*sem);
55+
staticvoidparse_object_field(JsonLexContext*lex,JsonSemAction*sem);
56+
staticvoidparse_object(JsonLexContext*lex,JsonSemAction*sem);
57+
staticvoidparse_array_element(JsonLexContext*lex,JsonSemAction*sem);
58+
staticvoidparse_array(JsonLexContext*lex,JsonSemAction*sem);
5959
staticvoidreport_parse_error(JsonParseContextctx,JsonLexContext*lex);
6060
staticvoidreport_invalid_token(JsonLexContext*lex);
6161
staticintreport_json_context(JsonLexContext*lex);
@@ -70,12 +70,11 @@ static void array_to_json_internal(Datum array, StringInfo result,
7070
booluse_line_feeds);
7171

7272
/* the null action object used for pure validation */
73-
staticjsonSemActionnullSemAction=
73+
staticJsonSemActionnullSemAction=
7474
{
7575
NULL,NULL,NULL,NULL,NULL,
7676
NULL,NULL,NULL,NULL,NULL
7777
};
78-
staticJsonSemActionNullSemAction=&nullSemAction;
7978

8079
/* Recursive Descent parser support routines */
8180

@@ -170,7 +169,7 @@ json_in(PG_FUNCTION_ARGS)
170169

171170
/* validate it */
172171
lex=makeJsonLexContext(result, false);
173-
pg_parse_json(lex,NullSemAction);
172+
pg_parse_json(lex,&nullSemAction);
174173

175174
/* Internal representation is the same as text, for now */
176175
PG_RETURN_TEXT_P(result);
@@ -222,7 +221,7 @@ json_recv(PG_FUNCTION_ARGS)
222221

223222
/* Validate it. */
224223
lex=makeJsonLexContext(result, false);
225-
pg_parse_json(lex,NullSemAction);
224+
pg_parse_json(lex,&nullSemAction);
226225

227226
PG_RETURN_TEXT_P(result);
228227
}
@@ -260,7 +259,7 @@ makeJsonLexContext(text *json, bool need_escapes)
260259
* pointer to a state object to be passed to those routines.
261260
*/
262261
void
263-
pg_parse_json(JsonLexContext*lex,JsonSemActionsem)
262+
pg_parse_json(JsonLexContext*lex,JsonSemAction*sem)
264263
{
265264
JsonTokenTypetok;
266265

@@ -296,7 +295,7 @@ pg_parse_json(JsonLexContext *lex, JsonSemAction sem)
296295
* - object field
297296
*/
298297
staticinlinevoid
299-
parse_scalar(JsonLexContext*lex,JsonSemActionsem)
298+
parse_scalar(JsonLexContext*lex,JsonSemAction*sem)
300299
{
301300
char*val=NULL;
302301
json_scalar_actionsfunc=sem->scalar;
@@ -332,7 +331,7 @@ parse_scalar(JsonLexContext *lex, JsonSemAction sem)
332331
}
333332

334333
staticvoid
335-
parse_object_field(JsonLexContext*lex,JsonSemActionsem)
334+
parse_object_field(JsonLexContext*lex,JsonSemAction*sem)
336335
{
337336
/*
338337
* an object field is "fieldname" : value where value can be a scalar,
@@ -380,7 +379,7 @@ parse_object_field(JsonLexContext *lex, JsonSemAction sem)
380379
}
381380

382381
staticvoid
383-
parse_object(JsonLexContext*lex,JsonSemActionsem)
382+
parse_object(JsonLexContext*lex,JsonSemAction*sem)
384383
{
385384
/*
386385
* an object is a possibly empty sequence of object fields, separated by
@@ -428,7 +427,7 @@ parse_object(JsonLexContext *lex, JsonSemAction sem)
428427
}
429428

430429
staticvoid
431-
parse_array_element(JsonLexContext*lex,JsonSemActionsem)
430+
parse_array_element(JsonLexContext*lex,JsonSemAction*sem)
432431
{
433432
json_aelem_actionastart=sem->array_element_start;
434433
json_aelem_actionaend=sem->array_element_end;
@@ -459,7 +458,7 @@ parse_array_element(JsonLexContext *lex, JsonSemAction sem)
459458
}
460459

461460
staticvoid
462-
parse_array(JsonLexContext*lex,JsonSemActionsem)
461+
parse_array(JsonLexContext*lex,JsonSemAction*sem)
463462
{
464463
/*
465464
* an array is a possibly empty sequence of array elements, separated by

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp