@@ -163,18 +163,20 @@ JsontPGetDatum(Json *json)
163
163
#define PG_GETARG_JSONB_P (n )PG_GETARG_JSONX_TMP(n, alloca(sizeof(Json)))/* FIXME conditional alloca() */
164
164
#define PG_GETARG_JSONT_P (n )DatumGetJsontP(PG_GETARG_DATUM(n))
165
165
166
- #define PG_FREE_IF_COPY_JSONB (json ,n ) \
167
- do { \
168
- if (!VARATT_IS_EXTERNAL_EXPANDED(PG_GETARG_POINTER(n))) \
169
- JsonFree(json); \
170
- else \
171
- Assert(DatumGetEOHP(PG_GETARG_DATUM(n)) == &(json)->obj.eoh); \
172
- } while (0)
173
-
174
166
#undef PG_GETARG_JSONB_P_COPY
175
167
#define PG_GETARG_JSONB_P_COPY (x )DatumGetJsonxPCopy(PG_GETARG_DATUM(x))
176
168
#define PG_GETARG_JSONT_P_COPY (x )DatumGetJsontPCopy(PG_GETARG_DATUM(x))
177
169
170
+ #define JsonFreeIfCopy (json ,datum ) \
171
+ do { \
172
+ if (!VARATT_IS_EXTERNAL_EXPANDED(DatumGetPointer(datum))) \
173
+ JsonFree(json); \
174
+ else \
175
+ Assert(DatumGetEOHP(datum) == &(json)->obj.eoh); \
176
+ } while (0)
177
+
178
+ #define PG_FREE_IF_COPY_JSONB (json ,n ) \
179
+ JsonFreeIfCopy(json, PG_GETARG_DATUM(n))
178
180
179
181
#define JsonRoot (json )(&(json)->root)
180
182
#define JsonGetSize (json )(JsonRoot(json)->len)