diff options
| author | Peter Eisentraut | 2022-09-12 17:57:07 +0000 |
|---|---|---|
| committer | Peter Eisentraut | 2022-09-12 17:57:07 +0000 |
| commit | e8d78581bb864369035c736a82ecfb57482a1a09 (patch) | |
| tree | b6881a0046c905ad671e0b43d60a42a119f4a3d4 /src/include/tsearch | |
| parent | 595836e99bf1ee6d43405b885fb69bb8c6d3ee23 (diff) | |
Revert "Convert *GetDatum() and DatumGet*() macros to inline functions"
This reverts commit 595836e99bf1ee6d43405b885fb69bb8c6d3ee23.
It has problems when USE_FLOAT8_BYVAL is off.
Diffstat (limited to 'src/include/tsearch')
| -rw-r--r-- | src/include/tsearch/ts_type.h | 46 | ||||
| -rw-r--r-- | src/include/tsearch/ts_utils.h | 14 |
2 files changed, 10 insertions, 50 deletions
diff --git a/src/include/tsearch/ts_type.h b/src/include/tsearch/ts_type.h index f1ec84702dc..689b2d1cfb6 100644 --- a/src/include/tsearch/ts_type.h +++ b/src/include/tsearch/ts_type.h @@ -111,27 +111,12 @@ typedef TSVectorData *TSVector; #define POSDATAPTR(x,e) (_POSVECPTR(x,e)->pos) /* - * fmgr interface functions + * fmgr interface macros */ -static inline TSVector -DatumGetTSVector(Datum X) -{ - return (TSVector) PG_DETOAST_DATUM(X); -} - -static inline TSVector -DatumGetTSVectorCopy(Datum X) -{ - return (TSVector) PG_DETOAST_DATUM_COPY(X); -} - -static inline Datum -TSVectorGetDatum(const TSVectorData *X) -{ - return PointerGetDatum(X); -} - +#define DatumGetTSVector(X) ((TSVector) PG_DETOAST_DATUM(X)) +#define DatumGetTSVectorCopy(X) ((TSVector) PG_DETOAST_DATUM_COPY(X)) +#define TSVectorGetDatum(X) PointerGetDatum(X) #define PG_GETARG_TSVECTOR(n) DatumGetTSVector(PG_GETARG_DATUM(n)) #define PG_GETARG_TSVECTOR_COPY(n) DatumGetTSVectorCopy(PG_GETARG_DATUM(n)) #define PG_RETURN_TSVECTOR(x) return TSVectorGetDatum(x) @@ -242,29 +227,14 @@ typedef TSQueryData *TSQuery; #define GETOPERAND(x) ( (char*)GETQUERY(x) + ((TSQuery)(x))->size * sizeof(QueryItem) ) /* - * fmgr interface functions + * fmgr interface macros * Note, TSQuery type marked as plain storage, so it can't be toasted * but PG_DETOAST_DATUM_COPY is used for simplicity */ -static inline TSQuery -DatumGetTSQuery(Datum X) -{ - return (TSQuery) DatumGetPointer(X); -} - -static inline TSQuery -DatumGetTSQueryCopy(Datum X) -{ - return (TSQuery) PG_DETOAST_DATUM_COPY(X); -} - -static inline Datum -TSQueryGetDatum(const TSQueryData *X) -{ - return PointerGetDatum(X); -} - +#define DatumGetTSQuery(X) ((TSQuery) DatumGetPointer(X)) +#define DatumGetTSQueryCopy(X) ((TSQuery) PG_DETOAST_DATUM_COPY(X)) +#define TSQueryGetDatum(X) PointerGetDatum(X) #define PG_GETARG_TSQUERY(n) DatumGetTSQuery(PG_GETARG_DATUM(n)) #define PG_GETARG_TSQUERY_COPY(n) DatumGetTSQueryCopy(PG_GETARG_DATUM(n)) #define PG_RETURN_TSQUERY(x) return TSQueryGetDatum(x) diff --git a/src/include/tsearch/ts_utils.h b/src/include/tsearch/ts_utils.h index 26cc415aa8a..c36c711dae0 100644 --- a/src/include/tsearch/ts_utils.h +++ b/src/include/tsearch/ts_utils.h @@ -243,18 +243,8 @@ typedef uint64 TSQuerySign; #define TSQS_SIGLEN (sizeof(TSQuerySign)*BITS_PER_BYTE) -static inline Datum -TSQuerySignGetDatum(TSQuerySign X) -{ - return Int64GetDatum((int64) X); -} - -static inline TSQuerySign -DatumGetTSQuerySign(Datum X) -{ - return (TSQuerySign) DatumGetInt64(X); -} - +#define TSQuerySignGetDatum(X) Int64GetDatum((int64) (X)) +#define DatumGetTSQuerySign(X) ((TSQuerySign) DatumGetInt64(X)) #define PG_RETURN_TSQUERYSIGN(X) return TSQuerySignGetDatum(X) #define PG_GETARG_TSQUERYSIGN(n) DatumGetTSQuerySign(PG_GETARG_DATUM(n)) |
