@@ -126,8 +126,6 @@ typedef struct JsonLikeRegexContext
126
126
int cflags ;
127
127
} JsonLikeRegexContext ;
128
128
129
- #define EmptyJsonLikeRegexContext {NULL, 0}
130
-
131
129
/* Result of jsonpath predicate evaluation */
132
130
typedef enum JsonPathBool
133
131
{
@@ -155,8 +153,6 @@ typedef struct JsonValueList
155
153
List * list ;
156
154
} JsonValueList ;
157
155
158
- #define EmptyJsonValueList {NULL, NIL}
159
-
160
156
typedef struct JsonValueListIterator
161
157
{
162
158
JsonbValue * value ;
@@ -325,7 +321,7 @@ jsonb_path_match(PG_FUNCTION_ARGS)
325
321
Jsonb * jb = PG_GETARG_JSONB_P (0 );
326
322
JsonPath * jp = PG_GETARG_JSONPATH_P (1 );
327
323
JsonbValue * jbv ;
328
- JsonValueList found = EmptyJsonValueList ;
324
+ JsonValueList found = { 0 } ;
329
325
Jsonb * vars = NULL ;
330
326
bool silent = true;
331
327
@@ -383,7 +379,7 @@ jsonb_path_query(PG_FUNCTION_ARGS)
383
379
MemoryContext oldcontext ;
384
380
Jsonb * vars ;
385
381
bool silent ;
386
- JsonValueList found = EmptyJsonValueList ;
382
+ JsonValueList found = { 0 } ;
387
383
388
384
funcctx = SRF_FIRSTCALL_INIT ();
389
385
oldcontext = MemoryContextSwitchTo (funcctx -> multi_call_memory_ctx );
@@ -424,7 +420,7 @@ jsonb_path_query_array(FunctionCallInfo fcinfo)
424
420
{
425
421
Jsonb * jb = PG_GETARG_JSONB_P (0 );
426
422
JsonPath * jp = PG_GETARG_JSONPATH_P (1 );
427
- JsonValueList found = EmptyJsonValueList ;
423
+ JsonValueList found = { 0 } ;
428
424
Jsonb * vars = PG_GETARG_JSONB_P (2 );
429
425
bool silent = PG_GETARG_BOOL (3 );
430
426
@@ -443,7 +439,7 @@ jsonb_path_query_first(FunctionCallInfo fcinfo)
443
439
{
444
440
Jsonb * jb = PG_GETARG_JSONB_P (0 );
445
441
JsonPath * jp = PG_GETARG_JSONPATH_P (1 );
446
- JsonValueList found = EmptyJsonValueList ;
442
+ JsonValueList found = { 0 } ;
447
443
Jsonb * vars = PG_GETARG_JSONB_P (2 );
448
444
bool silent = PG_GETARG_BOOL (3 );
449
445
@@ -514,7 +510,7 @@ executeJsonPath(JsonPath *path, Jsonb *vars, Jsonb *json, bool throwErrors,
514
510
* In strict mode we must get a complete list of values to check that
515
511
* there are no errors at all.
516
512
*/
517
- JsonValueList vals = EmptyJsonValueList ;
513
+ JsonValueList vals = { 0 } ;
518
514
519
515
res = executeItem (& cxt , & jsp , & jbv , & vals );
520
516
@@ -1138,7 +1134,7 @@ executeItemOptUnwrapResult(JsonPathExecContext *cxt, JsonPathItem *jsp,
1138
1134
{
1139
1135
if (unwrap && jspAutoUnwrap (cxt ))
1140
1136
{
1141
- JsonValueList seq = EmptyJsonValueList ;
1137
+ JsonValueList seq = { 0 } ;
1142
1138
JsonValueListIterator it ;
1143
1139
JsonPathExecResult res = executeItem (cxt , jsp , jb , & seq );
1144
1140
JsonbValue * item ;
@@ -1266,7 +1262,7 @@ executeBoolItem(JsonPathExecContext *cxt, JsonPathItem *jsp,
1266
1262
* regexes, but we use Postgres regexes here. 'flags' is a
1267
1263
* string literal converted to integer flags at compile-time.
1268
1264
*/
1269
- JsonLikeRegexContext lrcxt = EmptyJsonLikeRegexContext ;
1265
+ JsonLikeRegexContext lrcxt = { 0 } ;
1270
1266
1271
1267
jspInitByBuffer (& larg , jsp -> base ,
1272
1268
jsp -> content .like_regex .expr );
@@ -1284,7 +1280,7 @@ executeBoolItem(JsonPathExecContext *cxt, JsonPathItem *jsp,
1284
1280
* In strict mode we must get a complete list of values to
1285
1281
* check that there are no errors at all.
1286
1282
*/
1287
- JsonValueList vals = EmptyJsonValueList ;
1283
+ JsonValueList vals = { 0 } ;
1288
1284
JsonPathExecResult res =
1289
1285
executeItemOptUnwrapResultNoThrow (cxt , & larg , jb ,
1290
1286
false, & vals );
@@ -1436,8 +1432,8 @@ executePredicate(JsonPathExecContext *cxt, JsonPathItem *pred,
1436
1432
{
1437
1433
JsonPathExecResult res ;
1438
1434
JsonValueListIterator lseqit ;
1439
- JsonValueList lseq = EmptyJsonValueList ;
1440
- JsonValueList rseq = EmptyJsonValueList ;
1435
+ JsonValueList lseq = { 0 } ;
1436
+ JsonValueList rseq = { 0 } ;
1441
1437
JsonbValue * lval ;
1442
1438
bool error = false;
1443
1439
bool found = false;
@@ -1515,8 +1511,8 @@ executeBinaryArithmExpr(JsonPathExecContext *cxt, JsonPathItem *jsp,
1515
1511
{
1516
1512
JsonPathExecResult jper ;
1517
1513
JsonPathItem elem ;
1518
- JsonValueList lseq = EmptyJsonValueList ;
1519
- JsonValueList rseq = EmptyJsonValueList ;
1514
+ JsonValueList lseq = { 0 } ;
1515
+ JsonValueList rseq = { 0 } ;
1520
1516
JsonbValue * lval ;
1521
1517
JsonbValue * rval ;
1522
1518
Numeric res ;
@@ -1590,7 +1586,7 @@ executeUnaryArithmExpr(JsonPathExecContext *cxt, JsonPathItem *jsp,
1590
1586
JsonPathExecResult jper ;
1591
1587
JsonPathExecResult jper2 ;
1592
1588
JsonPathItem elem ;
1593
- JsonValueList seq = EmptyJsonValueList ;
1589
+ JsonValueList seq = { 0 } ;
1594
1590
JsonValueListIterator it ;
1595
1591
JsonbValue * val ;
1596
1592
bool hasNext ;
@@ -2128,7 +2124,7 @@ getArrayIndex(JsonPathExecContext *cxt, JsonPathItem *jsp, JsonbValue *jb,
2128
2124
int32 * index )
2129
2125
{
2130
2126
JsonbValue * jbv ;
2131
- JsonValueList found = EmptyJsonValueList ;
2127
+ JsonValueList found = { 0 } ;
2132
2128
JsonPathExecResult res = executeItem (cxt , jsp , jb , & found );
2133
2129
Datum numeric_index ;
2134
2130
bool have_error = false;
0 commit comments