@@ -84,33 +84,22 @@ typedef struct Json
8484#define JsonFlattenToJsonbDatum (json ) \
8585 PointerGetDatum(JsonFlatten(json, JsonbEncode, &jsonbContainerOps))
8686
87- #undef JsonbPGetDatum
8887#define JsonbPGetDatum (json ) JsonFlattenToJsonbDatum(json)
8988
90- #undef DatumGetJsonbP
9189#define DatumGetJsonbP (datum ) DatumGetJson(datum, &jsonbContainerOps, NULL)
9290#define DatumGetJsontP (datum ) DatumGetJson(datum, &jsontContainerOps, NULL)
9391
94- #undef DatumGetJsonbPCopy
9592#define DatumGetJsonbPCopy (datum ) DatumGetJsonbP(PointerGetDatum(PG_DETOAST_DATUM_COPY(datum)))
9693#define DatumGetJsontPCopy (datum ) DatumGetJsontP(PointerGetDatum(PG_DETOAST_DATUM_COPY(datum)))
9794
98- #undef PG_RETURN_JSONB_P
9995#define PG_RETURN_JSONB_P (x ) PG_RETURN_DATUM(JsonbPGetDatum(x))
100-
101- #undef PG_GETARG_JSONB_P
10296#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
10797#define PG_GETARG_JSONB_P_COPY (x ) DatumGetJsonbPCopy(PG_GETARG_DATUM(x))
10898
99+ #define PG_FREE_IF_COPY_JSONB (json , n ) JsonFree(json)
109100
110101#define JsonRoot (json ) (&(json)->root)
111102#define JsonGetSize (json ) (JsonRoot(json)->len)
112- #undef JsonbRoot
113- #undef JsonbGetSize
114103#define JsonbRoot (json ) JsonRoot(json)
115104#define JsonbGetSize (json ) JsonGetSize(json)
116105
@@ -126,24 +115,17 @@ typedef struct Json
126115#define JsonbIteratorInit JsonIteratorInit
127116#define JsonbIteratorNext JsonIteratorNext
128117
129- #ifdef JSONB_UTIL_C
130- #define JsonbValueToJsonb JsonValueToJsonb
131- #else
132- #define Jsonb Json
118+ #define JsonbValueToJsonb JsonValueToJson
133119
120+ #ifndef JSONB_UTIL_C
121+ #define Jsonb Json
134122#define JsonbContainer JsonContainer
123+ #endif
135124
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
142125#define JB_ROOT_COUNT (json ) JsonContainerSize(JsonRoot(json))
143126#define JB_ROOT_IS_SCALAR (json ) JsonContainerIsScalar(JsonRoot(json))
144127#define JB_ROOT_IS_OBJECT (json ) JsonContainerIsObject(JsonRoot(json))
145128#define JB_ROOT_IS_ARRAY (json ) JsonContainerIsArray(JsonRoot(json))
146- #endif
147129
148130#define JsonOp (op , jscontainer ) \
149131 (*(jscontainer)->ops->op)
0 commit comments