Skip to content

Commit 846a38a

Browse files
author
Nikita Glukhov
committed
Hide JsonbIterator struct definition
1 parent 779bb19 commit 846a38a

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
@@ -41,6 +41,36 @@ struct JsonbParseState
4141
struct JsonbParseState *next;
4242
};
4343

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

src/include/utils/jsonb.h

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -316,35 +316,7 @@ typedef enum
316316
JBI_OBJECT_VALUE
317317
} JsonbIterState;
318318

319-
typedef struct JsonbIterator
320-
{
321-
/* Container being iterated */
322-
JsonbContainer *container;
323-
uint32 nElems; /* Number of elements in children array (will
324-
* be nPairs for objects) */
325-
bool isScalar; /* Pseudo-array scalar value? */
326-
JEntry *children; /* JEntrys for child nodes */
327-
/* Data proper. This points to the beginning of the variable-length data */
328-
char *dataProper;
329-
330-
/* Current item in buffer (up to nElems) */
331-
int curIndex;
332-
333-
/* Data offset corresponding to current item */
334-
uint32 curDataOffset;
335-
336-
/*
337-
* If the container is an object, we want to return keys and values
338-
* alternately; so curDataOffset points to the current key, and
339-
* curValueOffset points to the current value.
340-
*/
341-
uint32 curValueOffset;
342-
343-
/* Private state */
344-
JsonbIterState state;
345-
346-
struct JsonbIterator *parent;
347-
} JsonbIterator;
319+
typedef struct JsonbIterator JsonbIterator;
348320

349321

350322
/* Support functions */

0 commit comments

Comments
 (0)