aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/jsonfuncs.c
diff options
context:
space:
mode:
authorNoah Misch <noah@leadboat.com>2015-10-11 23:53:35 -0400
committerNoah Misch <noah@leadboat.com>2015-10-11 23:53:35 -0400
commit7732d49ca211571552bf82b5207deed95c0cc09c (patch)
tree6076ea33201132e5b850f5a4ae4cc51f7430bc8e /src/backend/utils/adt/jsonfuncs.c
parentf20b26960ae62a3ffd12782eea09e0e9c23a2ac1 (diff)
downloadpostgresql-7732d49ca211571552bf82b5207deed95c0cc09c.tar.gz
postgresql-7732d49ca211571552bf82b5207deed95c0cc09c.zip
Use JsonbIteratorToken consistently in automatic variable declarations.
Many functions stored JsonbIteratorToken values in variables of other integer types. Also, standardize order relative to other declarations. Expect compilers to generate the same code before and after this change.
Diffstat (limited to 'src/backend/utils/adt/jsonfuncs.c')
-rw-r--r--src/backend/utils/adt/jsonfuncs.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/backend/utils/adt/jsonfuncs.c b/src/backend/utils/adt/jsonfuncs.c
index f33864e619d..222acd7afb7 100644
--- a/src/backend/utils/adt/jsonfuncs.c
+++ b/src/backend/utils/adt/jsonfuncs.c
@@ -288,7 +288,7 @@ jsonb_object_keys(PG_FUNCTION_ARGS)
bool skipNested = false;
JsonbIterator *it;
JsonbValue v;
- int r;
+ JsonbIteratorToken r;
if (JB_ROOT_IS_SCALAR(jb))
ereport(ERROR,
@@ -1283,7 +1283,7 @@ get_jsonb_path_all(FunctionCallInfo fcinfo, bool as_text)
if (jbvp->type == jbvBinary)
{
JsonbIterator *it = JsonbIteratorInit((JsonbContainer *) jbvp->val.binary.data);
- int r;
+ JsonbIteratorToken r;
r = JsonbIteratorNext(&it, &tv, true);
container = (JsonbContainer *) jbvp->val.binary.data;
@@ -1456,7 +1456,7 @@ each_worker_jsonb(FunctionCallInfo fcinfo, const char *funcname, bool as_text)
bool skipNested = false;
JsonbIterator *it;
JsonbValue v;
- int r;
+ JsonbIteratorToken r;
if (!JB_ROOT_IS_OBJECT(jb))
ereport(ERROR,
@@ -1775,7 +1775,7 @@ elements_worker_jsonb(FunctionCallInfo fcinfo, const char *funcname,
bool skipNested = false;
JsonbIterator *it;
JsonbValue v;
- int r;
+ JsonbIteratorToken r;
if (JB_ROOT_IS_SCALAR(jb))
ereport(ERROR,
@@ -2792,7 +2792,7 @@ populate_recordset_worker(FunctionCallInfo fcinfo, const char *funcname,
JsonbIterator *it;
JsonbValue v;
bool skipNested = false;
- int r;
+ JsonbIteratorToken r;
Assert(jtype == JSONBOID);
@@ -3230,9 +3230,9 @@ jsonb_strip_nulls(PG_FUNCTION_ARGS)
JsonbIterator *it;
JsonbParseState *parseState = NULL;
JsonbValue *res = NULL;
- int type;
JsonbValue v,
k;
+ JsonbIteratorToken type;
bool last_was_key = false;
if (JB_ROOT_IS_SCALAR(jb))
@@ -3290,8 +3290,8 @@ addJsonbToParseState(JsonbParseState **jbps, Jsonb *jb)
{
JsonbIterator *it;
JsonbValue *o = &(*jbps)->contVal;
- int type;
JsonbValue v;
+ JsonbIteratorToken type;
it = JsonbIteratorInit(&jb->root);
@@ -3398,10 +3398,10 @@ jsonb_delete(PG_FUNCTION_ARGS)
int keylen = VARSIZE_ANY_EXHDR(key);
JsonbParseState *state = NULL;
JsonbIterator *it;
- uint32 r;
JsonbValue v,
*res = NULL;
bool skipNested = false;
+ JsonbIteratorToken r;
if (JB_ROOT_IS_SCALAR(in))
ereport(ERROR,
@@ -3450,11 +3450,11 @@ jsonb_delete_idx(PG_FUNCTION_ARGS)
int idx = PG_GETARG_INT32(1);
JsonbParseState *state = NULL;
JsonbIterator *it;
- uint32 r,
- i = 0,
+ uint32 i = 0,
n;
JsonbValue v,
*res = NULL;
+ JsonbIteratorToken r;
if (JB_ROOT_IS_SCALAR(in))
ereport(ERROR,
@@ -3606,13 +3606,13 @@ static JsonbValue *
IteratorConcat(JsonbIterator **it1, JsonbIterator **it2,
JsonbParseState **state)
{
- uint32 r1,
- r2,
- rk1,
- rk2;
JsonbValue v1,
v2,
*res = NULL;
+ JsonbIteratorToken r1,
+ r2,
+ rk1,
+ rk2;
r1 = rk1 = JsonbIteratorNext(it1, &v1, false);
r2 = rk2 = JsonbIteratorNext(it2, &v2, false);
@@ -3721,8 +3721,8 @@ setPath(JsonbIterator **it, Datum *path_elems,
JsonbParseState **st, int level, Jsonb *newval, bool create)
{
JsonbValue v;
+ JsonbIteratorToken r;
JsonbValue *res = NULL;
- int r;
check_stack_depth();
@@ -3793,7 +3793,7 @@ setPathObject(JsonbIterator **it, Datum *path_elems, bool *path_nulls,
for (i = 0; i < npairs; i++)
{
- int r = JsonbIteratorNext(it, &k, true);
+ JsonbIteratorToken r = JsonbIteratorNext(it, &k, true);
Assert(r == WJB_KEY);
@@ -3914,7 +3914,7 @@ setPathArray(JsonbIterator **it, Datum *path_elems, bool *path_nulls,
/* iterate over the array elements */
for (i = 0; i < nelems; i++)
{
- int r;
+ JsonbIteratorToken r;
if (i == idx && level < path_len)
{