Skip to content

Commit 072686d

Browse files
author
Nikita Glukhov
committed
Hide JsonbIterator struct definition
1 parent 78f905a commit 072686d

File tree

2 files changed

+31
-29
lines changed

2 files changed

+31
-29
lines changed

src/backend/utils/adt/jsonb_util.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,36 @@ struct JsonbParseState
4545
struct JsonbParseState *next;
4646
};
4747

48+
struct JsonbIterator
49+
{
50+
/* Container being iterated */
51+
JsonbContainer *container;
52+
uint32 nElems; /* Number of elements in children array (will
53+
* be nPairs for objects) */
54+
bool isScalar; /* Pseudo-array scalar value? */
55+
JEntry *children; /* JEntrys for child nodes */
56+
/* Data proper. This points to the beginning of the variable-length data */
57+
char *dataProper;
58+
59+
/* Current item in buffer (up to nElems) */
60+
int curIndex;
61+
62+
/* Data offset corresponding to current item */
63+
uint32 curDataOffset;
64+
65+
/*
66+
* If the container is an object, we want to return keys and values
67+
* alternately; so curDataOffset points to the current key, and
68+
* curValueOffset points to the current value.
69+
*/
70+
uint32 curValueOffset;
71+
72+
/* Private state */
73+
JsonbIterState state;
74+
75+
struct JsonbIterator *parent;
76+
};
77+
4878
static void fillJsonbValue(JsonbContainer *container, int index,
4979
char *base_addr, uint32 offset,
5080
JsonbValue *result);

src/include/utils/jsonb.h

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -339,35 +339,7 @@ typedef enum
339339
JBI_OBJECT_VALUE
340340
} JsonbIterState;
341341

342-
typedef struct JsonbIterator
343-
{
344-
/* Container being iterated */
345-
JsonbContainer *container;
346-
uint32 nElems; /* Number of elements in children array (will
347-
* be nPairs for objects) */
348-
bool isScalar; /* Pseudo-array scalar value? */
349-
JEntry *children; /* JEntrys for child nodes */
350-
/* Data proper. This points to the beginning of the variable-length data */
351-
char *dataProper;
352-
353-
/* Current item in buffer (up to nElems) */
354-
int curIndex;
355-
356-
/* Data offset corresponding to current item */
357-
uint32 curDataOffset;
358-
359-
/*
360-
* If the container is an object, we want to return keys and values
361-
* alternately; so curDataOffset points to the current key, and
362-
* curValueOffset points to the current value.
363-
*/
364-
uint32 curValueOffset;
365-
366-
/* Private state */
367-
JsonbIterState state;
368-
369-
struct JsonbIterator *parent;
370-
} JsonbIterator;
342+
typedef struct JsonbIterator JsonbIterator;
371343

372344

373345
/* Support functions */

0 commit comments

Comments
 (0)