File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -163,18 +163,20 @@ JsontPGetDatum(Json *json)
163163#define PG_GETARG_JSONB_P (n ) PG_GETARG_JSONX_TMP(n, alloca(sizeof(Json))) /* FIXME conditional alloca() */
164164#define PG_GETARG_JSONT_P (n ) DatumGetJsontP(PG_GETARG_DATUM(n))
165165
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-
174166#undef PG_GETARG_JSONB_P_COPY
175167#define PG_GETARG_JSONB_P_COPY (x ) DatumGetJsonxPCopy(PG_GETARG_DATUM(x))
176168#define PG_GETARG_JSONT_P_COPY (x ) DatumGetJsontPCopy(PG_GETARG_DATUM(x))
177169
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))
178180
179181#define JsonRoot (json ) (&(json)->root)
180182#define JsonGetSize (json ) (JsonRoot(json)->len)
You can’t perform that action at this time.
0 commit comments