@@ -84,33 +84,22 @@ typedef struct Json
84
84
#define JsonFlattenToJsonbDatum (json ) \
85
85
PointerGetDatum(JsonFlatten(json, JsonbEncode, &jsonbContainerOps))
86
86
87
- #undef JsonbPGetDatum
88
87
#define JsonbPGetDatum (json ) JsonFlattenToJsonbDatum(json)
89
88
90
- #undef DatumGetJsonbP
91
89
#define DatumGetJsonbP (datum ) DatumGetJson(datum, &jsonbContainerOps, NULL)
92
90
#define DatumGetJsontP (datum ) DatumGetJson(datum, &jsontContainerOps, NULL)
93
91
94
- #undef DatumGetJsonbPCopy
95
92
#define DatumGetJsonbPCopy (datum ) DatumGetJsonbP(PointerGetDatum(PG_DETOAST_DATUM_COPY(datum)))
96
93
#define DatumGetJsontPCopy (datum ) DatumGetJsontP(PointerGetDatum(PG_DETOAST_DATUM_COPY(datum)))
97
94
98
- #undef PG_RETURN_JSONB_P
99
95
#define PG_RETURN_JSONB_P (x ) PG_RETURN_DATUM(JsonbPGetDatum(x))
100
-
101
- #undef PG_GETARG_JSONB_P
102
96
#define PG_GETARG_JSONB_P (n ) DatumGetJson(PG_GETARG_DATUM(n), &jsonbContainerOps, alloca(sizeof(Json))) /* FIXME conditional alloca() */
103
-
104
- #define PG_FREE_IF_COPY_JSONB (json , n ) JsonFree(json)
105
-
106
- #undef PG_GETARG_JSONB_P_COPY
107
97
#define PG_GETARG_JSONB_P_COPY (x ) DatumGetJsonbPCopy(PG_GETARG_DATUM(x))
108
98
99
+ #define PG_FREE_IF_COPY_JSONB (json , n ) JsonFree(json)
109
100
110
101
#define JsonRoot (json ) (&(json)->root)
111
102
#define JsonGetSize (json ) (JsonRoot(json)->len)
112
- #undef JsonbRoot
113
- #undef JsonbGetSize
114
103
#define JsonbRoot (json ) JsonRoot(json)
115
104
#define JsonbGetSize (json ) JsonGetSize(json)
116
105
@@ -126,24 +115,17 @@ typedef struct Json
126
115
#define JsonbIteratorInit JsonIteratorInit
127
116
#define JsonbIteratorNext JsonIteratorNext
128
117
129
- #ifdef JSONB_UTIL_C
130
- #define JsonbValueToJsonb JsonValueToJsonb
131
- #else
132
- #define Jsonb Json
118
+ #define JsonbValueToJsonb JsonValueToJson
133
119
120
+ #ifndef JSONB_UTIL_C
121
+ #define Jsonb Json
134
122
#define JsonbContainer JsonContainer
123
+ #endif
135
124
136
- #define JsonbValueToJsonb JsonValueToJson
137
-
138
- #undef JB_ROOT_COUNT
139
- #undef JB_ROOT_IS_SCALAR
140
- #undef JB_ROOT_IS_OBJECT
141
- #undef JB_ROOT_IS_ARRAY
142
125
#define JB_ROOT_COUNT (json ) JsonContainerSize(JsonRoot(json))
143
126
#define JB_ROOT_IS_SCALAR (json ) JsonContainerIsScalar(JsonRoot(json))
144
127
#define JB_ROOT_IS_OBJECT (json ) JsonContainerIsObject(JsonRoot(json))
145
128
#define JB_ROOT_IS_ARRAY (json ) JsonContainerIsArray(JsonRoot(json))
146
- #endif
147
129
148
130
#define JsonOp (op , jscontainer ) \
149
131
(*(jscontainer)->ops->op)
0 commit comments