diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2022-09-12 17:35:55 +0200 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2022-09-12 17:36:26 +0200 |
commit | 595836e99bf1ee6d43405b885fb69bb8c6d3ee23 (patch) | |
tree | 9af38bcdaab9e75913c66b29f30caf1f9f4e5409 /src/include/access/gin.h | |
parent | 8cb2a22bbb2cf4212482ac15021ceaa2e9c52209 (diff) | |
download | postgresql-595836e99bf1ee6d43405b885fb69bb8c6d3ee23.tar.gz |
Convert *GetDatum() and DatumGet*() macros to inline functions
The previous macro implementations just cast the argument to a target
type but did not check whether the input type was appropriate. The
function implementation can do better type checking of the input type.
Reviewed-by: Aleksander Alekseev <aleksander@timescale.com>
Discussion: https://www.postgresql.org/message-id/flat/8528fb7e-0aa2-6b54-85fb-0c0886dbd6ed%40enterprisedb.com
Diffstat (limited to 'src/include/access/gin.h')
-rw-r--r-- | src/include/access/gin.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/include/access/gin.h b/src/include/access/gin.h index aacc665fdc..fff861e219 100644 --- a/src/include/access/gin.h +++ b/src/include/access/gin.h @@ -62,8 +62,18 @@ typedef char GinTernaryValue; #define GIN_MAYBE 2 /* don't know if item is present / don't know * if matches */ -#define DatumGetGinTernaryValue(X) ((GinTernaryValue)(X)) -#define GinTernaryValueGetDatum(X) ((Datum)(X)) +static inline GinTernaryValue +DatumGetGinTernaryValue(Datum X) +{ + return (GinTernaryValue) X; +} + +static inline Datum +GinTernaryValueGetDatum(GinTernaryValue X) +{ + return (Datum) X; +} + #define PG_RETURN_GIN_TERNARY_VALUE(x) return GinTernaryValueGetDatum(x) /* GUC parameters */ |