Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e3fa4c0

Browse files
author
Nikita Glukhov
committed
Remove old jsonb macros
1 parent 960afef commit e3fa4c0

File tree

2 files changed

+5
-44
lines changed

2 files changed

+5
-44
lines changed

src/include/utils/json_generic.h

+5-23
Original file line numberDiff line numberDiff line change
@@ -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)

src/include/utils/jsonb.h

-21
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,6 @@ typedef enum
6868
#define JGINFLAG_HASHED 0x10 /* OR'd into flag if value was hashed */
6969
#define JGIN_MAXLENGTH 125 /* max length of text part before hashing */
7070

71-
/* Convenience macros */
72-
#define DatumGetJsonbP(d) ((Jsonb *) PG_DETOAST_DATUM(d))
73-
#define DatumGetJsonbPCopy(d) ((Jsonb *) PG_DETOAST_DATUM_COPY(d))
74-
#define JsonbPGetDatum(p) PointerGetDatum(p)
75-
#define PG_GETARG_JSONB_P(x) DatumGetJsonbP(PG_GETARG_DATUM(x))
76-
#define PG_GETARG_JSONB_P_COPY(x) DatumGetJsonbPCopy(PG_GETARG_DATUM(x))
77-
#define PG_RETURN_JSONB_P(x) PG_RETURN_DATUM(JsonbPGetDatum(x))
78-
79-
#define JsonbRoot(jsonb) (&(jsonb)->root)
80-
#define JsonbGetSize(jsonb) VARSIZE(jsonb)
81-
8271
typedef struct JsonbPair JsonbPair;
8372
typedef struct JsonbValue JsonbValue;
8473

@@ -223,16 +212,6 @@ typedef struct
223212
JsonbContainer root;
224213
} Jsonb;
225214

226-
#ifdef JSONB_UTIL_C
227-
/* convenience macros for accessing the root container in a Jsonb datum */
228-
#define JB_HEADER(jbp_) (((JsonbContainer *) VARDATA(jbp_))->header)
229-
#define JB_ROOT_COUNT(jbp_) (*(uint32 *) VARDATA(jbp_) & JB_CMASK)
230-
#define JB_ROOT_IS_SCALAR(jbp_) ((*(uint32 *) VARDATA(jbp_) & JB_FSCALAR) != 0)
231-
#define JB_ROOT_IS_OBJECT(jbp_) ((*(uint32 *) VARDATA(jbp_) & JB_FOBJECT) != 0)
232-
#define JB_ROOT_IS_ARRAY(jbp_) ((*(uint32 *) VARDATA(jbp_) & JB_FARRAY) != 0)
233-
#endif
234-
235-
236215
typedef enum jbvType
237216
{
238217
/* Scalar types */

0 commit comments

Comments
 (0)