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

Commit7732d49

Browse files
committed
Use JsonbIteratorToken consistently in automatic variable declarations.
Many functions stored JsonbIteratorToken values in variables of otherinteger types. Also, standardize order relative to other declarations.Expect compilers to generate the same code before and after this change.
1 parentf20b269 commit7732d49

File tree

5 files changed

+30
-29
lines changed

5 files changed

+30
-29
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,8 +455,8 @@ JsonbToCStringWorker(StringInfo out, JsonbContainer *in, int estimated_len, bool
455455
{
456456
boolfirst= true;
457457
JsonbIterator*it;
458-
JsonbIteratorTokentype=WJB_DONE;
459458
JsonbValuev;
459+
JsonbIteratorTokentype=WJB_DONE;
460460
intlevel=0;
461461
boolredo_switch= false;
462462

@@ -899,7 +899,6 @@ datum_to_jsonb(Datum val, bool is_null, JsonbInState *result,
899899
caseJSONBTYPE_JSONB:
900900
{
901901
Jsonb*jsonb=DatumGetJsonb(val);
902-
JsonbIteratorTokentype;
903902
JsonbIterator*it;
904903

905904
it=JsonbIteratorInit(&jsonb->root);
@@ -913,6 +912,8 @@ datum_to_jsonb(Datum val, bool is_null, JsonbInState *result,
913912
}
914913
else
915914
{
915+
JsonbIteratorTokentype;
916+
916917
while ((type=JsonbIteratorNext(&it,&jb, false))
917918
!=WJB_DONE)
918919
{

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ gin_extract_jsonb(PG_FUNCTION_ARGS)
7070
inttotal=2*JB_ROOT_COUNT(jb);
7171
JsonbIterator*it;
7272
JsonbValuev;
73-
inti=0,
74-
r;
73+
JsonbIteratorTokenr;
74+
inti=0;
7575
Datum*entries;
7676

7777
/* If the root level is empty, we certainly have no keys */
@@ -333,10 +333,10 @@ gin_extract_jsonb_path(PG_FUNCTION_ARGS)
333333
inttotal=2*JB_ROOT_COUNT(jb);
334334
JsonbIterator*it;
335335
JsonbValuev;
336+
JsonbIteratorTokenr;
336337
PathHashStacktail;
337338
PathHashStack*stack;
338-
inti=0,
339-
r;
339+
inti=0;
340340
Datum*entries;
341341

342342
/* If the root level is empty, we certainly have no keys */
@@ -429,7 +429,7 @@ gin_extract_jsonb_path(PG_FUNCTION_ARGS)
429429
stack=parent;
430430
break;
431431
default:
432-
elog(ERROR,"invalid JsonbIteratorNext rc: %d",r);
432+
elog(ERROR,"invalid JsonbIteratorNext rc: %d",(int)r);
433433
}
434434
}
435435

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,8 @@ jsonb_hash(PG_FUNCTION_ARGS)
254254
{
255255
Jsonb*jb=PG_GETARG_JSONB(0);
256256
JsonbIterator*it;
257-
int32r;
258257
JsonbValuev;
258+
JsonbIteratorTokenr;
259259
uint32hash=0;
260260

261261
if (JB_ROOT_COUNT(jb)==0)
@@ -283,7 +283,7 @@ jsonb_hash(PG_FUNCTION_ARGS)
283283
caseWJB_END_OBJECT:
284284
break;
285285
default:
286-
elog(ERROR,"invalid JsonbIteratorNext rc: %d",r);
286+
elog(ERROR,"invalid JsonbIteratorNext rc: %d",(int)r);
287287
}
288288
}
289289

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ compareJsonbContainers(JsonbContainer *a, JsonbContainer *b)
187187
{
188188
JsonbValueva,
189189
vb;
190-
intra,
190+
JsonbIteratorTokenra,
191191
rb;
192192

193193
ra=JsonbIteratorNext(&ita,&va, false);
@@ -961,10 +961,10 @@ freeAndGetParent(JsonbIterator *it)
961961
bool
962962
JsonbDeepContains(JsonbIterator**val,JsonbIterator**mContained)
963963
{
964-
uint32rval,
965-
rcont;
966964
JsonbValuevval,
967965
vcontained;
966+
JsonbIteratorTokenrval,
967+
rcont;
968968

969969
/*
970970
* Guard against stack overflow due to overly complex Jsonb.

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

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ jsonb_object_keys(PG_FUNCTION_ARGS)
288288
boolskipNested= false;
289289
JsonbIterator*it;
290290
JsonbValuev;
291-
intr;
291+
JsonbIteratorTokenr;
292292

293293
if (JB_ROOT_IS_SCALAR(jb))
294294
ereport(ERROR,
@@ -1283,7 +1283,7 @@ get_jsonb_path_all(FunctionCallInfo fcinfo, bool as_text)
12831283
if (jbvp->type==jbvBinary)
12841284
{
12851285
JsonbIterator*it=JsonbIteratorInit((JsonbContainer*)jbvp->val.binary.data);
1286-
intr;
1286+
JsonbIteratorTokenr;
12871287

12881288
r=JsonbIteratorNext(&it,&tv, true);
12891289
container= (JsonbContainer*)jbvp->val.binary.data;
@@ -1456,7 +1456,7 @@ each_worker_jsonb(FunctionCallInfo fcinfo, const char *funcname, bool as_text)
14561456
boolskipNested= false;
14571457
JsonbIterator*it;
14581458
JsonbValuev;
1459-
intr;
1459+
JsonbIteratorTokenr;
14601460

14611461
if (!JB_ROOT_IS_OBJECT(jb))
14621462
ereport(ERROR,
@@ -1775,7 +1775,7 @@ elements_worker_jsonb(FunctionCallInfo fcinfo, const char *funcname,
17751775
boolskipNested= false;
17761776
JsonbIterator*it;
17771777
JsonbValuev;
1778-
intr;
1778+
JsonbIteratorTokenr;
17791779

17801780
if (JB_ROOT_IS_SCALAR(jb))
17811781
ereport(ERROR,
@@ -2792,7 +2792,7 @@ populate_recordset_worker(FunctionCallInfo fcinfo, const char *funcname,
27922792
JsonbIterator*it;
27932793
JsonbValuev;
27942794
boolskipNested= false;
2795-
intr;
2795+
JsonbIteratorTokenr;
27962796

27972797
Assert(jtype==JSONBOID);
27982798

@@ -3230,9 +3230,9 @@ jsonb_strip_nulls(PG_FUNCTION_ARGS)
32303230
JsonbIterator*it;
32313231
JsonbParseState*parseState=NULL;
32323232
JsonbValue*res=NULL;
3233-
inttype;
32343233
JsonbValuev,
32353234
k;
3235+
JsonbIteratorTokentype;
32363236
boollast_was_key= false;
32373237

32383238
if (JB_ROOT_IS_SCALAR(jb))
@@ -3290,8 +3290,8 @@ addJsonbToParseState(JsonbParseState **jbps, Jsonb *jb)
32903290
{
32913291
JsonbIterator*it;
32923292
JsonbValue*o=&(*jbps)->contVal;
3293-
inttype;
32943293
JsonbValuev;
3294+
JsonbIteratorTokentype;
32953295

32963296
it=JsonbIteratorInit(&jb->root);
32973297

@@ -3398,10 +3398,10 @@ jsonb_delete(PG_FUNCTION_ARGS)
33983398
intkeylen=VARSIZE_ANY_EXHDR(key);
33993399
JsonbParseState*state=NULL;
34003400
JsonbIterator*it;
3401-
uint32r;
34023401
JsonbValuev,
34033402
*res=NULL;
34043403
boolskipNested= false;
3404+
JsonbIteratorTokenr;
34053405

34063406
if (JB_ROOT_IS_SCALAR(in))
34073407
ereport(ERROR,
@@ -3450,11 +3450,11 @@ jsonb_delete_idx(PG_FUNCTION_ARGS)
34503450
intidx=PG_GETARG_INT32(1);
34513451
JsonbParseState*state=NULL;
34523452
JsonbIterator*it;
3453-
uint32r,
3454-
i=0,
3453+
uint32i=0,
34553454
n;
34563455
JsonbValuev,
34573456
*res=NULL;
3457+
JsonbIteratorTokenr;
34583458

34593459
if (JB_ROOT_IS_SCALAR(in))
34603460
ereport(ERROR,
@@ -3606,13 +3606,13 @@ static JsonbValue *
36063606
IteratorConcat(JsonbIterator**it1,JsonbIterator**it2,
36073607
JsonbParseState**state)
36083608
{
3609-
uint32r1,
3610-
r2,
3611-
rk1,
3612-
rk2;
36133609
JsonbValuev1,
36143610
v2,
36153611
*res=NULL;
3612+
JsonbIteratorTokenr1,
3613+
r2,
3614+
rk1,
3615+
rk2;
36163616

36173617
r1=rk1=JsonbIteratorNext(it1,&v1, false);
36183618
r2=rk2=JsonbIteratorNext(it2,&v2, false);
@@ -3721,8 +3721,8 @@ setPath(JsonbIterator **it, Datum *path_elems,
37213721
JsonbParseState**st,intlevel,Jsonb*newval,boolcreate)
37223722
{
37233723
JsonbValuev;
3724+
JsonbIteratorTokenr;
37243725
JsonbValue*res=NULL;
3725-
intr;
37263726

37273727
check_stack_depth();
37283728

@@ -3793,7 +3793,7 @@ setPathObject(JsonbIterator **it, Datum *path_elems, bool *path_nulls,
37933793

37943794
for (i=0;i<npairs;i++)
37953795
{
3796-
intr=JsonbIteratorNext(it,&k, true);
3796+
JsonbIteratorTokenr=JsonbIteratorNext(it,&k, true);
37973797

37983798
Assert(r==WJB_KEY);
37993799

@@ -3914,7 +3914,7 @@ setPathArray(JsonbIterator **it, Datum *path_elems, bool *path_nulls,
39143914
/* iterate over the array elements */
39153915
for (i=0;i<nelems;i++)
39163916
{
3917-
intr;
3917+
JsonbIteratorTokenr;
39183918

39193919
if (i==idx&&level<path_len)
39203920
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp