Revert "Convert *GetDatum() and DatumGet*() macros to inline functions"
authorPeter Eisentraut <peter@eisentraut.org>
Mon, 12 Sep 2022 17:57:07 +0000 (19:57 +0200)
committerPeter Eisentraut <peter@eisentraut.org>
Mon, 12 Sep 2022 17:57:07 +0000 (19:57 +0200)
This reverts commit 595836e99bf1ee6d43405b885fb69bb8c6d3ee23.

It has problems when USE_FLOAT8_BYVAL is off.

27 files changed:
contrib/intarray/_int_gist.c
doc/src/sgml/xfunc.sgml
src/backend/access/gist/gistutil.c
src/backend/tsearch/ts_parse.c
src/backend/utils/mb/mbutils.c
src/include/access/gin.h
src/include/funcapi.h
src/include/postgres.h
src/include/tsearch/ts_type.h
src/include/tsearch/ts_utils.h
src/include/utils/cash.h
src/include/utils/date.h
src/include/utils/expandeddatum.h
src/include/utils/expandedrecord.h
src/include/utils/geo_decls.h
src/include/utils/inet.h
src/include/utils/jsonb.h
src/include/utils/jsonpath.h
src/include/utils/multirangetypes.h
src/include/utils/numeric.h
src/include/utils/pg_lsn.h
src/include/utils/rangetypes.h
src/include/utils/timestamp.h
src/include/utils/uuid.h
src/include/utils/varbit.h
src/include/utils/xid8.h
src/include/utils/xml.h

index 6378aa74b079fcd68ec0563260f74a66dc4368a8..f1817a6cce3b637762a3836fea75084062000001 100644 (file)
@@ -51,7 +51,7 @@ g_int_consistent(PG_FUNCTION_ARGS)
 
    /* Oid      subtype = PG_GETARG_OID(3); */
    bool       *recheck = (bool *) PG_GETARG_POINTER(4);
-   bool        retval = false; /* silence compiler warning */
+   bool        retval;
 
    /* this is exact except for RTSameStrategyNumber */
    *recheck = (strategy == RTSameStrategyNumber);
index cf5810b3c160244ceb2400ab683325f146bc36a3..b8cefb9c2ca739bc28413baa76f7860cda12d822 100644 (file)
@@ -2763,7 +2763,7 @@ c_overpaid(PG_FUNCTION_ARGS)
      is  null.   <function>GetAttributeByName</function> returns a <type>Datum</type>
      value that you can convert to the proper data type by using the
      appropriate <function>DatumGet<replaceable>XXX</replaceable>()</function>
-     function.  Note that the return value is meaningless if the null flag is
+     macro.  Note that the return value is meaningless if the null flag is
      set; always check the null flag before trying to do anything with the
      result.
     </para>
index 1532462317b590fdb02a9ed73366c429b788a000..d4bf0c7563de8617e05b8c37f9f4cea8ff427d0d 100644 (file)
@@ -280,7 +280,7 @@ gistMakeUnionKey(GISTSTATE *giststate, int attno,
 bool
 gistKeyIsEQ(GISTSTATE *giststate, int attno, Datum a, Datum b)
 {
-   bool        result = false; /* silence compiler warning */
+   bool        result;
 
    FunctionCall3Coll(&giststate->equalFn[attno],
                      giststate->supportCollation[attno],
index 92de1f7141a5330bf86dbd22333191e77705357e..27b2cca2dfb07e62de3ae7f7e10e3a4a62bca9da 100644 (file)
@@ -354,7 +354,7 @@ void
 parsetext(Oid cfgId, ParsedText *prs, char *buf, int buflen)
 {
    int         type,
-               lenlemm = 0;    /* silence compiler warning */
+               lenlemm;
    char       *lemm = NULL;
    LexizeData  ldata;
    TSLexeme   *norms;
@@ -529,7 +529,7 @@ void
 hlparsetext(Oid cfgId, HeadlineParsedText *prs, TSQuery query, char *buf, int buflen)
 {
    int         type,
-               lenlemm = 0;    /* silence compiler warning */
+               lenlemm;
    char       *lemm = NULL;
    LexizeData  ldata;
    TSLexeme   *norms;
index 474ab476f5fbe5cdadcaa0bccd2cf7245cd8b330..0543c574c67eb721fd65e8b9a07d83b035d7548d 100644 (file)
@@ -409,8 +409,8 @@ pg_do_encoding_conversion(unsigned char *src, int len,
    (void) OidFunctionCall6(proc,
                            Int32GetDatum(src_encoding),
                            Int32GetDatum(dest_encoding),
-                           CStringGetDatum((char *) src),
-                           CStringGetDatum((char *) result),
+                           CStringGetDatum(src),
+                           CStringGetDatum(result),
                            Int32GetDatum(len),
                            BoolGetDatum(false));
 
@@ -485,8 +485,8 @@ pg_do_encoding_conversion_buf(Oid proc,
    result = OidFunctionCall6(proc,
                              Int32GetDatum(src_encoding),
                              Int32GetDatum(dest_encoding),
-                             CStringGetDatum((char *) src),
-                             CStringGetDatum((char *) dest),
+                             CStringGetDatum(src),
+                             CStringGetDatum(dest),
                              Int32GetDatum(srclen),
                              BoolGetDatum(noError));
    return DatumGetInt32(result);
@@ -910,8 +910,8 @@ pg_unicode_to_server(pg_wchar c, unsigned char *s)
    FunctionCall6(Utf8ToServerConvProc,
                  Int32GetDatum(PG_UTF8),
                  Int32GetDatum(server_encoding),
-                 CStringGetDatum((char *) c_as_utf8),
-                 CStringGetDatum((char *) s),
+                 CStringGetDatum(c_as_utf8),
+                 CStringGetDatum(s),
                  Int32GetDatum(c_as_utf8_len),
                  BoolGetDatum(false));
 }
index fff861e2192cca4355cdbbbe7e41b4804d58aaa4..aacc665fdc8280a64b509977e15caf6031857d79 100644 (file)
@@ -62,18 +62,8 @@ typedef char GinTernaryValue;
 #define GIN_MAYBE      2       /* don't know if item is present / don't know
                                 * if matches */
 
-static inline GinTernaryValue
-DatumGetGinTernaryValue(Datum X)
-{
-   return (GinTernaryValue) X;
-}
-
-static inline Datum
-GinTernaryValueGetDatum(GinTernaryValue X)
-{
-   return (Datum) X;
-}
-
+#define DatumGetGinTernaryValue(X) ((GinTernaryValue)(X))
+#define GinTernaryValueGetDatum(X) ((Datum)(X))
 #define PG_RETURN_GIN_TERNARY_VALUE(x) return GinTernaryValueGetDatum(x)
 
 /* GUC parameters */
index 8c2521a59192e96759558b55b6e6f9e7d362de57..dc3d819a1c7eca066511205ed94f4aa845010b42 100644 (file)
@@ -204,7 +204,7 @@ extern TupleDesc build_function_result_tupdesc_t(HeapTuple procTuple);
  * Datum HeapTupleHeaderGetDatum(HeapTupleHeader tuple) - convert a
  *     HeapTupleHeader to a Datum.
  *
- * Inline declarations:
+ * Macro declarations:
  * HeapTupleGetDatum(HeapTuple tuple) - convert a HeapTuple to a Datum.
  *
  * Obsolete routines and macros:
@@ -217,6 +217,10 @@ extern TupleDesc build_function_result_tupdesc_t(HeapTuple procTuple);
  *----------
  */
 
+#define HeapTupleGetDatum(tuple)       HeapTupleHeaderGetDatum((tuple)->t_data)
+/* obsolete version of above */
+#define TupleGetDatum(_slot, _tuple)   HeapTupleGetDatum(_tuple)
+
 extern TupleDesc RelationNameGetTupleDesc(const char *relname);
 extern TupleDesc TypeGetTupleDesc(Oid typeoid, List *colaliases);
 
@@ -226,14 +230,6 @@ extern AttInMetadata *TupleDescGetAttInMetadata(TupleDesc tupdesc);
 extern HeapTuple BuildTupleFromCStrings(AttInMetadata *attinmeta, char **values);
 extern Datum HeapTupleHeaderGetDatum(HeapTupleHeader tuple);
 
-static inline Datum
-HeapTupleGetDatum(const HeapTupleData *tuple)
-{
-   return HeapTupleHeaderGetDatum(tuple->t_data);
-}
-/* obsolete version of above */
-#define TupleGetDatum(_slot, _tuple)   HeapTupleGetDatum(_tuple)
-
 
 /*----------
  *     Support for Set Returning Functions (SRFs)
index 45c9f6563c652cc37383f32b912c17b006859969..13903fa022adaffd797330f8eb87d91892a1419a 100644 (file)
@@ -24,7 +24,7 @@
  *   section   description
  *   -------   ------------------------------------------------
  *     1)      variable-length datatypes (TOAST support)
- *     2)      Datum type + support functions
+ *     2)      Datum type + support macros
  *     3)      miscellaneous
  *
  *  NOTES
@@ -395,7 +395,7 @@ typedef struct
 
 
 /* ----------------------------------------------------------------
- *             Section 2:  Datum type + support functions
+ *             Section 2:  Datum type + support macros
  * ----------------------------------------------------------------
  */
 
@@ -405,7 +405,7 @@ typedef struct
  *
  * sizeof(Datum) == sizeof(void *) == 4 or 8
  *
- * The functions below and the analogous functions for other types should be used to
+ * The macros below and the analogous macros for other types should be used to
  * convert between a Datum and the appropriate C type.
  */
 
@@ -434,11 +434,8 @@ typedef struct NullableDatum
  *
  * Note: any nonzero value will be considered true.
  */
-static inline bool
-DatumGetBool(Datum X)
-{
-   return (X != 0);
-}
+
+#define DatumGetBool(X) ((bool) ((X) != 0))
 
 /*
  * BoolGetDatum
@@ -446,231 +443,162 @@ DatumGetBool(Datum X)
  *
  * Note: any nonzero value will be considered true.
  */
-static inline Datum
-BoolGetDatum(bool X)
-{
-   return (Datum) (X ? 1 : 0);
-}
+
+#define BoolGetDatum(X) ((Datum) ((X) ? 1 : 0))
 
 /*
  * DatumGetChar
  *     Returns character value of a datum.
  */
-static inline char
-DatumGetChar(Datum X)
-{
-   return (char) X;
-}
+
+#define DatumGetChar(X) ((char) (X))
 
 /*
  * CharGetDatum
  *     Returns datum representation for a character.
  */
-static inline Datum
-CharGetDatum(char X)
-{
-   return (Datum) X;
-}
+
+#define CharGetDatum(X) ((Datum) (X))
 
 /*
  * Int8GetDatum
  *     Returns datum representation for an 8-bit integer.
  */
-static inline Datum
-Int8GetDatum(int8 X)
-{
-   return (Datum) X;
-}
+
+#define Int8GetDatum(X) ((Datum) (X))
 
 /*
  * DatumGetUInt8
  *     Returns 8-bit unsigned integer value of a datum.
  */
-static inline uint8
-DatumGetUInt8(Datum X)
-{
-   return (uint8) X;
-}
+
+#define DatumGetUInt8(X) ((uint8) (X))
 
 /*
  * UInt8GetDatum
  *     Returns datum representation for an 8-bit unsigned integer.
  */
-static inline Datum
-UInt8GetDatum(uint8 X)
-{
-   return (Datum) X;
-}
+
+#define UInt8GetDatum(X) ((Datum) (X))
 
 /*
  * DatumGetInt16
  *     Returns 16-bit integer value of a datum.
  */
-static inline int16
-DatumGetInt16(Datum X)
-{
-   return (int16) X;
-}
+
+#define DatumGetInt16(X) ((int16) (X))
 
 /*
  * Int16GetDatum
  *     Returns datum representation for a 16-bit integer.
  */
-static inline Datum
-Int16GetDatum(int16 X)
-{
-   return (Datum) X;
-}
+
+#define Int16GetDatum(X) ((Datum) (X))
 
 /*
  * DatumGetUInt16
  *     Returns 16-bit unsigned integer value of a datum.
  */
-static inline uint16
-DatumGetUInt16(Datum X)
-{
-   return (uint16) X;
-}
+
+#define DatumGetUInt16(X) ((uint16) (X))
 
 /*
  * UInt16GetDatum
  *     Returns datum representation for a 16-bit unsigned integer.
  */
-static inline Datum
-UInt16GetDatum(uint16 X)
-{
-   return (Datum) X;
-}
+
+#define UInt16GetDatum(X) ((Datum) (X))
 
 /*
  * DatumGetInt32
  *     Returns 32-bit integer value of a datum.
  */
-static inline int32
-DatumGetInt32(Datum X)
-{
-   return (int32) X;
-}
+
+#define DatumGetInt32(X) ((int32) (X))
 
 /*
  * Int32GetDatum
  *     Returns datum representation for a 32-bit integer.
  */
-static inline Datum
-Int32GetDatum(int32 X)
-{
-   return (Datum) X;
-}
+
+#define Int32GetDatum(X) ((Datum) (X))
 
 /*
  * DatumGetUInt32
  *     Returns 32-bit unsigned integer value of a datum.
  */
-static inline uint32
-DatumGetUInt32(Datum X)
-{
-   return (uint32) X;
-}
+
+#define DatumGetUInt32(X) ((uint32) (X))
 
 /*
  * UInt32GetDatum
  *     Returns datum representation for a 32-bit unsigned integer.
  */
-static inline Datum
-UInt32GetDatum(uint32 X)
-{
-   return (Datum) X;
-}
+
+#define UInt32GetDatum(X) ((Datum) (X))
 
 /*
  * DatumGetObjectId
  *     Returns object identifier value of a datum.
  */
-static inline Oid
-DatumGetObjectId(Datum X)
-{
-   return (Oid) X;
-}
+
+#define DatumGetObjectId(X) ((Oid) (X))
 
 /*
  * ObjectIdGetDatum
  *     Returns datum representation for an object identifier.
  */
-static inline Datum
-ObjectIdGetDatum(Oid X)
-{
-   return (Datum) X;
-}
+
+#define ObjectIdGetDatum(X) ((Datum) (X))
 
 /*
  * DatumGetTransactionId
  *     Returns transaction identifier value of a datum.
  */
-static inline TransactionId
-DatumGetTransactionId(Datum X)
-{
-   return (TransactionId) X;
-}
+
+#define DatumGetTransactionId(X) ((TransactionId) (X))
 
 /*
  * TransactionIdGetDatum
  *     Returns datum representation for a transaction identifier.
  */
-static inline Datum
-TransactionIdGetDatum(TransactionId X)
-{
-   return (Datum) X;
-}
+
+#define TransactionIdGetDatum(X) ((Datum) (X))
 
 /*
  * MultiXactIdGetDatum
  *     Returns datum representation for a multixact identifier.
  */
-static inline Datum
-MultiXactIdGetDatum(MultiXactId X)
-{
-   return (Datum) X;
-}
+
+#define MultiXactIdGetDatum(X) ((Datum) (X))
 
 /*
  * DatumGetCommandId
  *     Returns command identifier value of a datum.
  */
-static inline CommandId
-DatumGetCommandId(Datum X)
-{
-   return (CommandId) X;
-}
+
+#define DatumGetCommandId(X) ((CommandId) (X))
 
 /*
  * CommandIdGetDatum
  *     Returns datum representation for a command identifier.
  */
-static inline Datum
-CommandIdGetDatum(CommandId X)
-{
-   return (Datum) X;
-}
+
+#define CommandIdGetDatum(X) ((Datum) (X))
 
 /*
  * DatumGetPointer
  *     Returns pointer value of a datum.
  */
-static inline Pointer
-DatumGetPointer(Datum X)
-{
-   return (Pointer) X;
-}
+
+#define DatumGetPointer(X) ((Pointer) (X))
 
 /*
  * PointerGetDatum
  *     Returns datum representation for a pointer.
  */
-static inline Datum
-PointerGetDatum(const void *X)
-{
-   return (Datum) X;
-}
+
+#define PointerGetDatum(X) ((Datum) (X))
 
 /*
  * DatumGetCString
@@ -679,11 +607,8 @@ PointerGetDatum(const void *X)
  * Note: C string is not a full-fledged Postgres type at present,
  * but type input functions use this conversion for their inputs.
  */
-static inline char *
-DatumGetCString(Datum X)
-{
-   return (char *) DatumGetPointer(X);
-}
+
+#define DatumGetCString(X) ((char *) DatumGetPointer(X))
 
 /*
  * CStringGetDatum
@@ -694,21 +619,15 @@ DatumGetCString(Datum X)
  * Note: CString is pass-by-reference; caller must ensure the pointed-to
  * value has adequate lifetime.
  */
-static inline Datum
-CStringGetDatum(const char *X)
-{
-   return PointerGetDatum(X);
-}
+
+#define CStringGetDatum(X) PointerGetDatum(X)
 
 /*
  * DatumGetName
  *     Returns name value of a datum.
  */
-static inline Name
-DatumGetName(Datum X)
-{
-   return (Name) DatumGetPointer(X);
-}
+
+#define DatumGetName(X) ((Name) DatumGetPointer(X))
 
 /*
  * NameGetDatum
@@ -717,27 +636,21 @@ DatumGetName(Datum X)
  * Note: Name is pass-by-reference; caller must ensure the pointed-to
  * value has adequate lifetime.
  */
-static inline Datum
-NameGetDatum(const NameData *X)
-{
-   return CStringGetDatum(NameStr(*X));
-}
+
+#define NameGetDatum(X) CStringGetDatum(NameStr(*(X)))
 
 /*
  * DatumGetInt64
  *     Returns 64-bit integer value of a datum.
  *
- * Note: this function hides whether int64 is pass by value or by reference.
+ * Note: this macro hides whether int64 is pass by value or by reference.
  */
-static inline int64
-DatumGetInt64(Datum X)
-{
+
 #ifdef USE_FLOAT8_BYVAL
-   return (int64) X;
+#define DatumGetInt64(X) ((int64) (X))
 #else
-   return *((int64 *) DatumGetPointer(X));
+#define DatumGetInt64(X) (* ((int64 *) DatumGetPointer(X)))
 #endif
-}
 
 /*
  * Int64GetDatum
@@ -746,32 +659,25 @@ DatumGetInt64(Datum X)
  * Note: if int64 is pass by reference, this function returns a reference
  * to palloc'd space.
  */
+
 #ifdef USE_FLOAT8_BYVAL
-static inline Datum
-Int64GetDatum(int64 X)
-{
-   return (Datum) X;
-}
+#define Int64GetDatum(X) ((Datum) (X))
 #else
 extern Datum Int64GetDatum(int64 X);
 #endif
 
-
 /*
  * DatumGetUInt64
  *     Returns 64-bit unsigned integer value of a datum.
  *
- * Note: this function hides whether int64 is pass by value or by reference.
+ * Note: this macro hides whether int64 is pass by value or by reference.
  */
-static inline uint64
-DatumGetUInt64(Datum X)
-{
+
 #ifdef USE_FLOAT8_BYVAL
-   return (uint64) X;
+#define DatumGetUInt64(X) ((uint64) (X))
 #else
-   return *((uint64 *) DatumGetPointer(X));
+#define DatumGetUInt64(X) (* ((uint64 *) DatumGetPointer(X)))
 #endif
-}
 
 /*
  * UInt64GetDatum
@@ -780,15 +686,12 @@ DatumGetUInt64(Datum X)
  * Note: if int64 is pass by reference, this function returns a reference
  * to palloc'd space.
  */
-static inline Datum
-UInt64GetDatum(uint64 X)
-{
+
 #ifdef USE_FLOAT8_BYVAL
-   return (Datum) X;
+#define UInt64GetDatum(X) ((Datum) (X))
 #else
-   return Int64GetDatum((int64) X);
+#define UInt64GetDatum(X) Int64GetDatum((int64) (X))
 #endif
-}
 
 /*
  * Float <-> Datum conversions
@@ -836,12 +739,13 @@ Float4GetDatum(float4 X)
  * DatumGetFloat8
  *     Returns 8-byte floating point value of a datum.
  *
- * Note: this function hides whether float8 is pass by value or by reference.
+ * Note: this macro hides whether float8 is pass by value or by reference.
  */
+
+#ifdef USE_FLOAT8_BYVAL
 static inline float8
 DatumGetFloat8(Datum X)
 {
-#ifdef USE_FLOAT8_BYVAL
    union
    {
        int64       value;
@@ -850,10 +754,10 @@ DatumGetFloat8(Datum X)
 
    myunion.value = DatumGetInt64(X);
    return myunion.retval;
+}
 #else
-   return *((float8 *) DatumGetPointer(X));
+#define DatumGetFloat8(X) (* ((float8 *) DatumGetPointer(X)))
 #endif
-}
 
 /*
  * Float8GetDatum
@@ -862,6 +766,7 @@ DatumGetFloat8(Datum X)
  * Note: if float8 is pass by reference, this function returns a reference
  * to palloc'd space.
  */
+
 #ifdef USE_FLOAT8_BYVAL
 static inline Datum
 Float8GetDatum(float8 X)
@@ -884,34 +789,22 @@ extern Datum Float8GetDatum(float8 X);
  * Int64GetDatumFast
  * Float8GetDatumFast
  *
- * These functions are intended to allow writing code that does not depend on
+ * These macros are intended to allow writing code that does not depend on
  * whether int64 and float8 are pass-by-reference types, while not
  * sacrificing performance when they are.  The argument must be a variable
  * that will exist and have the same value for as long as the Datum is needed.
  * In the pass-by-ref case, the address of the variable is taken to use as
  * the Datum.  In the pass-by-val case, these will be the same as the non-Fast
- * functions.
+ * macros.
  */
 
-static inline Datum
-Int64GetDatumFast(int64 X)
-{
-#ifdef USE_FLOAT8_BYVAL
-   return Int64GetDatum(X);
-#else
-   return PointerGetDatum(&X);
-#endif
-}
-
-static inline Datum
-Float8GetDatumFast(float8 X)
-{
 #ifdef USE_FLOAT8_BYVAL
-   return Float8GetDatum(X);
+#define Int64GetDatumFast(X)  Int64GetDatum(X)
+#define Float8GetDatumFast(X) Float8GetDatum(X)
 #else
-   return PointerGetDatum(&X);
+#define Int64GetDatumFast(X)  PointerGetDatum(&(X))
+#define Float8GetDatumFast(X) PointerGetDatum(&(X))
 #endif
-}
 
 
 /* ----------------------------------------------------------------
index f1ec84702dcc0495823fa422b4da65c3ea8f6de3..689b2d1cfb62edee1ed4bee38dd7f29248f5deb3 100644 (file)
@@ -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)
index 26cc415aa8a80fb6f8e8144718151d176436fab6..c36c711dae0d1a03823f8ec4e138912493f5f3c6 100644 (file)
@@ -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))
 
index 55d45fadd4815415f8bb5289d82776026df901b4..2e332d83b1c73d58e30182fb37ea57bf87e37264 100644 (file)
 typedef int64 Cash;
 
 /* Cash is pass-by-reference if and only if int64 is */
-static inline Cash
-DatumGetCash(Datum X)
-{
-   return DatumGetInt64(X);
-}
-
-static inline Datum
-CashGetDatum(Cash X)
-{
-   return Int64GetDatum(X);
-}
-
+#define DatumGetCash(X)        ((Cash) DatumGetInt64(X))
+#define CashGetDatum(X)        Int64GetDatum(X)
 #define PG_GETARG_CASH(n)  DatumGetCash(PG_GETARG_DATUM(n))
 #define PG_RETURN_CASH(x)  return CashGetDatum(x)
 
index 0bbe88912853d6c6b48cd2dc6de8fb602cd9886d..3991da41f0feec865690750fd1e74282d5f9b381 100644 (file)
@@ -45,46 +45,18 @@ typedef struct
 #define MAX_TIME_PRECISION 6
 
 /*
- * Functions for fmgr-callable functions.
+ * Macros for fmgr-callable functions.
  *
  * For TimeADT, we make use of the same support routines as for int64.
  * Therefore TimeADT is pass-by-reference if and only if int64 is!
  */
-static inline DateADT
-DatumGetDateADT(Datum X)
-{
-   return (DateADT) DatumGetInt32(X);
-}
-
-static inline TimeADT
-DatumGetTimeADT(Datum X)
-{
-   return (TimeADT) DatumGetInt64(X);
-}
-
-static inline TimeTzADT *
-DatumGetTimeTzADTP(Datum X)
-{
-   return (TimeTzADT *) DatumGetPointer(X);
-}
+#define DatumGetDateADT(X)   ((DateADT) DatumGetInt32(X))
+#define DatumGetTimeADT(X)   ((TimeADT) DatumGetInt64(X))
+#define DatumGetTimeTzADTP(X) ((TimeTzADT *) DatumGetPointer(X))
 
-static inline Datum
-DateADTGetDatum(DateADT X)
-{
-   return Int32GetDatum(X);
-}
-
-static inline Datum
-TimeADTGetDatum(TimeADT X)
-{
-   return Int64GetDatum(X);
-}
-
-static inline Datum
-TimeTzADTPGetDatum(const TimeTzADT *X)
-{
-   return PointerGetDatum(X);
-}
+#define DateADTGetDatum(X)   Int32GetDatum(X)
+#define TimeADTGetDatum(X)   Int64GetDatum(X)
+#define TimeTzADTPGetDatum(X) PointerGetDatum(X)
 
 #define PG_GETARG_DATEADT(n)    DatumGetDateADT(PG_GETARG_DATUM(n))
 #define PG_GETARG_TIMEADT(n)    DatumGetTimeADT(PG_GETARG_DATUM(n))
index c4818eb0541767909937a5948ad5718eccf4d71d..ffdb0c45bdf244dce6769b3b8350415557e8cf2d 100644 (file)
@@ -133,17 +133,8 @@ struct ExpandedObjectHeader
  * (More of these might be worth inlining later.)
  */
 
-static inline Datum
-EOHPGetRWDatum(const struct ExpandedObjectHeader *eohptr)
-{
-   return PointerGetDatum(eohptr->eoh_rw_ptr);
-}
-
-static inline Datum
-EOHPGetRODatum(const struct ExpandedObjectHeader *eohptr)
-{
-   return PointerGetDatum(eohptr->eoh_ro_ptr);
-}
+#define EOHPGetRWDatum(eohptr) PointerGetDatum((eohptr)->eoh_rw_ptr)
+#define EOHPGetRODatum(eohptr) PointerGetDatum((eohptr)->eoh_ro_ptr)
 
 /* Does the Datum represent a writable expanded object? */
 #define DatumIsReadWriteExpandedObject(d, isnull, typlen) \
index aaf5b6bfd1b44e51478a9c680a7d1d5368be113c..be60e2ce530f2ef55af4d812168c46163f290193 100644 (file)
@@ -138,20 +138,10 @@ typedef struct ExpandedRecordHeader
    MemoryContextCallback er_mcb;
 } ExpandedRecordHeader;
 
-/* fmgr functions and macros for expanded record objects */
-static inline Datum
-ExpandedRecordGetDatum(const ExpandedRecordHeader *erh)
-{
-   return EOHPGetRWDatum(&erh->hdr);
-}
-
-static inline Datum
-ExpandedRecordGetRODatum(const ExpandedRecordHeader *erh)
-{
-   return EOHPGetRODatum(&erh->hdr);
-}
-
+/* fmgr macros for expanded record objects */
 #define PG_GETARG_EXPANDED_RECORD(n)  DatumGetExpandedRecord(PG_GETARG_DATUM(n))
+#define ExpandedRecordGetDatum(erh)   EOHPGetRWDatum(&(erh)->hdr)
+#define ExpandedRecordGetRODatum(erh) EOHPGetRODatum(&(erh)->hdr)
 #define PG_RETURN_EXPANDED_RECORD(x)  PG_RETURN_DATUM(ExpandedRecordGetDatum(x))
 
 /* assorted other macros */
index 05726778adb4c9d7302855064f3c08648c47cebf..719030777e4bb87e4e7ded82d9acb270eb2d0ea2 100644 (file)
@@ -166,112 +166,48 @@ typedef struct
 } CIRCLE;
 
 /*
- * fmgr interface functions
+ * fmgr interface macros
  *
  * Path and Polygon are toastable varlena types, the others are just
  * fixed-size pass-by-reference types.
  */
 
-static inline Point *
-DatumGetPointP(Datum X)
-{
-   return (Point *) DatumGetPointer(X);
-}
-static inline Datum
-PointPGetDatum(const Point *X)
-{
-   return PointerGetDatum(X);
-}
+#define DatumGetPointP(X)   ((Point *) DatumGetPointer(X))
+#define PointPGetDatum(X)   PointerGetDatum(X)
 #define PG_GETARG_POINT_P(n) DatumGetPointP(PG_GETARG_DATUM(n))
 #define PG_RETURN_POINT_P(x) return PointPGetDatum(x)
 
-static inline LSEG *
-DatumGetLsegP(Datum X)
-{
-   return (LSEG *) DatumGetPointer(X);
-}
-static inline Datum
-LsegPGetDatum(const LSEG *X)
-{
-   return PointerGetDatum(X);
-}
+#define DatumGetLsegP(X)   ((LSEG *) DatumGetPointer(X))
+#define LsegPGetDatum(X)   PointerGetDatum(X)
 #define PG_GETARG_LSEG_P(n) DatumGetLsegP(PG_GETARG_DATUM(n))
 #define PG_RETURN_LSEG_P(x) return LsegPGetDatum(x)
 
-static inline PATH *
-DatumGetPathP(Datum X)
-{
-   return (PATH *) PG_DETOAST_DATUM(X);
-}
-static inline PATH *
-DatumGetPathPCopy(Datum X)
-{
-   return (PATH *) PG_DETOAST_DATUM_COPY(X);
-}
-static inline Datum
-PathPGetDatum(const PATH *X)
-{
-   return PointerGetDatum(X);
-}
+#define DatumGetPathP(X)        ((PATH *) PG_DETOAST_DATUM(X))
+#define DatumGetPathPCopy(X)    ((PATH *) PG_DETOAST_DATUM_COPY(X))
+#define PathPGetDatum(X)        PointerGetDatum(X)
 #define PG_GETARG_PATH_P(n)         DatumGetPathP(PG_GETARG_DATUM(n))
 #define PG_GETARG_PATH_P_COPY(n) DatumGetPathPCopy(PG_GETARG_DATUM(n))
 #define PG_RETURN_PATH_P(x)         return PathPGetDatum(x)
 
-static inline LINE *
-DatumGetLineP(Datum X)
-{
-   return (LINE *) DatumGetPointer(X);
-}
-static inline Datum
-LinePGetDatum(const LINE *X)
-{
-   return PointerGetDatum(X);
-}
+#define DatumGetLineP(X)   ((LINE *) DatumGetPointer(X))
+#define LinePGetDatum(X)   PointerGetDatum(X)
 #define PG_GETARG_LINE_P(n) DatumGetLineP(PG_GETARG_DATUM(n))
 #define PG_RETURN_LINE_P(x) return LinePGetDatum(x)
 
-static inline BOX *
-DatumGetBoxP(Datum X)
-{
-   return (BOX *) DatumGetPointer(X);
-}
-static inline Datum
-BoxPGetDatum(const BOX *X)
-{
-   return PointerGetDatum(X);
-}
+#define DatumGetBoxP(X)    ((BOX *) DatumGetPointer(X))
+#define BoxPGetDatum(X)    PointerGetDatum(X)
 #define PG_GETARG_BOX_P(n) DatumGetBoxP(PG_GETARG_DATUM(n))
 #define PG_RETURN_BOX_P(x) return BoxPGetDatum(x)
 
-static inline POLYGON *
-DatumGetPolygonP(Datum X)
-{
-   return (POLYGON *) PG_DETOAST_DATUM(X);
-}
-static inline POLYGON *
-DatumGetPolygonPCopy(Datum X)
-{
-   return (POLYGON *) PG_DETOAST_DATUM_COPY(X);
-}
-static inline Datum
-PolygonPGetDatum(const POLYGON *X)
-{
-   return PointerGetDatum(X);
-}
+#define DatumGetPolygonP(X)            ((POLYGON *) PG_DETOAST_DATUM(X))
+#define DatumGetPolygonPCopy(X)        ((POLYGON *) PG_DETOAST_DATUM_COPY(X))
+#define PolygonPGetDatum(X)            PointerGetDatum(X)
 #define PG_GETARG_POLYGON_P(n)     DatumGetPolygonP(PG_GETARG_DATUM(n))
 #define PG_GETARG_POLYGON_P_COPY(n) DatumGetPolygonPCopy(PG_GETARG_DATUM(n))
 #define PG_RETURN_POLYGON_P(x)     return PolygonPGetDatum(x)
 
-static inline CIRCLE *
-DatumGetCircleP(Datum X)
-{
-   return (CIRCLE *) DatumGetPointer(X);
-}
-static inline Datum
-CirclePGetDatum(const CIRCLE *X)
-{
-   return PointerGetDatum(X);
-}
+#define DatumGetCircleP(X)   ((CIRCLE *) DatumGetPointer(X))
+#define CirclePGetDatum(X)   PointerGetDatum(X)
 #define PG_GETARG_CIRCLE_P(n) DatumGetCircleP(PG_GETARG_DATUM(n))
 #define PG_RETURN_CIRCLE_P(x) return CirclePGetDatum(x)
 
index 5438cfaba540ce6f69de44343ba62fe7ff7eb635..b1ec9723dfbab5a1f2a072404dff6f8c175784cb 100644 (file)
@@ -119,58 +119,23 @@ typedef struct macaddr8
 /*
  * fmgr interface macros
  */
-static inline inet *
-DatumGetInetPP(Datum X)
-{
-   return (inet *) PG_DETOAST_DATUM_PACKED(X);
-}
-
-static inline Datum
-InetPGetDatum(const inet *X)
-{
-   return PointerGetDatum(X);
-}
-
+#define DatumGetInetPP(X)  ((inet *) PG_DETOAST_DATUM_PACKED(X))
+#define InetPGetDatum(X)   PointerGetDatum(X)
 #define PG_GETARG_INET_PP(n) DatumGetInetPP(PG_GETARG_DATUM(n))
 #define PG_RETURN_INET_P(x) return InetPGetDatum(x)
-
 /* obsolescent variants */
-static inline inet *
-DatumGetInetP(Datum X)
-{
-   return (inet *) PG_DETOAST_DATUM(X);
-}
+#define DatumGetInetP(X)   ((inet *) PG_DETOAST_DATUM(X))
 #define PG_GETARG_INET_P(n) DatumGetInetP(PG_GETARG_DATUM(n))
 
 /* macaddr is a fixed-length pass-by-reference datatype */
-static inline macaddr *
-DatumGetMacaddrP(Datum X)
-{
-   return (macaddr *) DatumGetPointer(X);
-}
-
-static inline Datum
-MacaddrPGetDatum(const macaddr *X)
-{
-   return PointerGetDatum(X);
-}
-
+#define DatumGetMacaddrP(X)    ((macaddr *) DatumGetPointer(X))
+#define MacaddrPGetDatum(X)    PointerGetDatum(X)
 #define PG_GETARG_MACADDR_P(n) DatumGetMacaddrP(PG_GETARG_DATUM(n))
 #define PG_RETURN_MACADDR_P(x) return MacaddrPGetDatum(x)
 
 /* macaddr8 is a fixed-length pass-by-reference datatype */
-static inline macaddr8 *
-DatumGetMacaddr8P(Datum X)
-{
-   return (macaddr8 *) DatumGetPointer(X);
-}
-
-static inline Datum
-Macaddr8PGetDatum(const macaddr8 *X)
-{
-   return PointerGetDatum(X);
-}
-
+#define DatumGetMacaddr8P(X)   ((macaddr8 *) DatumGetPointer(X))
+#define Macaddr8PGetDatum(X)   PointerGetDatum(X)
 #define PG_GETARG_MACADDR8_P(n) DatumGetMacaddr8P(PG_GETARG_DATUM(n))
 #define PG_RETURN_MACADDR8_P(x) return Macaddr8PGetDatum(x)
 
index bdd1c9c75d8e0e9da1b07da3f1720e2cc7f28d77..4cbe6edf2182453b14baf7f6c27baf128a01f466 100644 (file)
@@ -67,6 +67,14 @@ typedef enum
 #define JGINFLAG_HASHED 0x10   /* OR'd into flag if value was hashed */
 #define JGIN_MAXLENGTH 125     /* max length of text part before hashing */
 
+/* Convenience macros */
+#define DatumGetJsonbP(d)  ((Jsonb *) PG_DETOAST_DATUM(d))
+#define DatumGetJsonbPCopy(d)  ((Jsonb *) PG_DETOAST_DATUM_COPY(d))
+#define JsonbPGetDatum(p)  PointerGetDatum(p)
+#define PG_GETARG_JSONB_P(x)   DatumGetJsonbP(PG_GETARG_DATUM(x))
+#define PG_GETARG_JSONB_P_COPY(x)  DatumGetJsonbPCopy(PG_GETARG_DATUM(x))
+#define PG_RETURN_JSONB_P(x)   PG_RETURN_POINTER(x)
+
 typedef struct JsonbPair JsonbPair;
 typedef struct JsonbValue JsonbValue;
 
@@ -367,29 +375,6 @@ typedef struct JsonbIterator
 } JsonbIterator;
 
 
-/* Convenience macros */
-static inline Jsonb *
-DatumGetJsonbP(Datum d)
-{
-   return (Jsonb *) PG_DETOAST_DATUM(d);
-}
-
-static inline Jsonb *
-DatumGetJsonbPCopy(Datum d)
-{
-   return (Jsonb *) PG_DETOAST_DATUM_COPY(d);
-}
-
-static inline Datum
-JsonbPGetDatum(const Jsonb *p)
-{
-   return PointerGetDatum(p);
-}
-
-#define PG_GETARG_JSONB_P(x)   DatumGetJsonbP(PG_GETARG_DATUM(x))
-#define PG_GETARG_JSONB_P_COPY(x)  DatumGetJsonbPCopy(PG_GETARG_DATUM(x))
-#define PG_RETURN_JSONB_P(x)   PG_RETURN_POINTER(x)
-
 /* Support functions */
 extern uint32 getJsonbOffset(const JsonbContainer *jc, int index);
 extern uint32 getJsonbLength(const JsonbContainer *jc, int index);
index 13f60cdc09b1ac4377beea10879144d2c598e0ae..cd0b5d5b61cd69d0f8cb4b701dcdc0f13fcb0543 100644 (file)
@@ -29,18 +29,8 @@ typedef struct
 #define JSONPATH_LAX       (0x80000000)
 #define JSONPATH_HDRSZ     (offsetof(JsonPath, data))
 
-static inline JsonPath *
-DatumGetJsonPathP(Datum d)
-{
-   return (JsonPath *) PG_DETOAST_DATUM(d);
-}
-
-static inline JsonPath *
-DatumGetJsonPathPCopy(Datum d)
-{
-   return (JsonPath *) PG_DETOAST_DATUM_COPY(d);
-}
-
+#define DatumGetJsonPathP(d)           ((JsonPath *) DatumGetPointer(PG_DETOAST_DATUM(d)))
+#define DatumGetJsonPathPCopy(d)       ((JsonPath *) DatumGetPointer(PG_DETOAST_DATUM_COPY(d)))
 #define PG_GETARG_JSONPATH_P(x)            DatumGetJsonPathP(PG_GETARG_DATUM(x))
 #define PG_GETARG_JSONPATH_P_COPY(x)   DatumGetJsonPathPCopy(PG_GETARG_DATUM(x))
 #define PG_RETURN_JSONPATH_P(p)            PG_RETURN_POINTER(p)
index 23bce0005ffb98180b7ea18e552ad69c262b5953..915330f990bb8845e91b8e52387692f45835e0bf 100644 (file)
@@ -42,26 +42,11 @@ typedef struct
 #define MultirangeIsEmpty(mr)  ((mr)->rangeCount == 0)
 
 /*
- * fmgr functions for multirange type objects
+ * fmgr macros for multirange type objects
  */
-static inline MultirangeType *
-DatumGetMultirangeTypeP(Datum X)
-{
-   return (MultirangeType *) PG_DETOAST_DATUM(X);
-}
-
-static inline MultirangeType *
-DatumGetMultirangeTypePCopy(Datum X)
-{
-   return (MultirangeType *) PG_DETOAST_DATUM_COPY(X);
-}
-
-static inline Datum
-MultirangeTypePGetDatum(const MultirangeType *X)
-{
-   return PointerGetDatum(X);
-}
-
+#define DatumGetMultirangeTypeP(X)     ((MultirangeType *) PG_DETOAST_DATUM(X))
+#define DatumGetMultirangeTypePCopy(X) ((MultirangeType *) PG_DETOAST_DATUM_COPY(X))
+#define MultirangeTypePGetDatum(X)     PointerGetDatum(X)
 #define PG_GETARG_MULTIRANGE_P(n)      DatumGetMultirangeTypeP(PG_GETARG_DATUM(n))
 #define PG_GETARG_MULTIRANGE_P_COPY(n) DatumGetMultirangeTypePCopy(PG_GETARG_DATUM(n))
 #define PG_RETURN_MULTIRANGE_P(x)      return MultirangeTypePGetDatum(x)
index 88c62c5348bc22bc9e314114f5402ab2e2120666..3caa74dfe7a09ba71d84fafd960e3967fed1a1e8 100644 (file)
@@ -56,24 +56,9 @@ typedef struct NumericData *Numeric;
  * fmgr interface macros
  */
 
-static inline Numeric
-DatumGetNumeric(Datum X)
-{
-   return (Numeric) PG_DETOAST_DATUM(X);
-}
-
-static inline Numeric
-DatumGetNumericCopy(Datum X)
-{
-   return (Numeric) PG_DETOAST_DATUM_COPY(X);
-}
-
-static inline Datum
-NumericGetDatum(Numeric X)
-{
-   return PointerGetDatum(X);
-}
-
+#define DatumGetNumeric(X)       ((Numeric) PG_DETOAST_DATUM(X))
+#define DatumGetNumericCopy(X)   ((Numeric) PG_DETOAST_DATUM_COPY(X))
+#define NumericGetDatum(X)       PointerGetDatum(X)
 #define PG_GETARG_NUMERIC(n)     DatumGetNumeric(PG_GETARG_DATUM(n))
 #define PG_GETARG_NUMERIC_COPY(n) DatumGetNumericCopy(PG_GETARG_DATUM(n))
 #define PG_RETURN_NUMERIC(x)     return NumericGetDatum(x)
index 5313afbfe2ecaefc42e26cbe05f319aca0fe8085..7b708f10736909dfdbcbe93af73ca65048440bb5 100644 (file)
 #include "access/xlogdefs.h"
 #include "fmgr.h"
 
-static inline XLogRecPtr
-DatumGetLSN(Datum X)
-{
-   return (XLogRecPtr) DatumGetInt64(X);
-}
-
-static inline Datum
-LSNGetDatum(XLogRecPtr X)
-{
-   return Int64GetDatum((int64) X);
-}
+#define DatumGetLSN(X) ((XLogRecPtr) DatumGetInt64(X))
+#define LSNGetDatum(X) (Int64GetDatum((int64) (X)))
 
 #define PG_GETARG_LSN(n)    DatumGetLSN(PG_GETARG_DATUM(n))
 #define PG_RETURN_LSN(x)    return LSNGetDatum(x)
index 661e4892ecec1bf7f9ee99746f0e114681b92643..993fad4fc2a2828d1d4f18bfa10f79919dcccd71 100644 (file)
@@ -68,26 +68,11 @@ typedef struct
 } RangeBound;
 
 /*
- * fmgr functions for range type objects
+ * fmgr macros for range type objects
  */
-static inline RangeType *
-DatumGetRangeTypeP(Datum X)
-{
-   return (RangeType *) PG_DETOAST_DATUM(X);
-}
-
-static inline RangeType *
-DatumGetRangeTypePCopy(Datum X)
-{
-   return (RangeType *) PG_DETOAST_DATUM_COPY(X);
-}
-
-static inline Datum
-RangeTypePGetDatum(const RangeType *X)
-{
-   return PointerGetDatum(X);
-}
-
+#define DatumGetRangeTypeP(X)      ((RangeType *) PG_DETOAST_DATUM(X))
+#define DatumGetRangeTypePCopy(X)  ((RangeType *) PG_DETOAST_DATUM_COPY(X))
+#define RangeTypePGetDatum(X)      PointerGetDatum(X)
 #define PG_GETARG_RANGE_P(n)       DatumGetRangeTypeP(PG_GETARG_DATUM(n))
 #define PG_GETARG_RANGE_P_COPY(n)  DatumGetRangeTypePCopy(PG_GETARG_DATUM(n))
 #define PG_RETURN_RANGE_P(x)       return RangeTypePGetDatum(x)
index 3602638bdc507a2dc299717f09552b55c624e49e..edf3a9731866af02cf1f4073e79dec8486f977d7 100644 (file)
 
 
 /*
- * Functions for fmgr-callable functions.
+ * Macros for fmgr-callable functions.
  *
  * For Timestamp, we make use of the same support routines as for int64.
  * Therefore Timestamp is pass-by-reference if and only if int64 is!
  */
-static inline Timestamp
-DatumGetTimestamp(Datum X)
-{
-   return (Timestamp) DatumGetInt64(X);
-}
-
-static inline TimestampTz
-DatumGetTimestampTz(Datum X)
-{
-   return (TimestampTz) DatumGetInt64(X);
-}
-
-static inline Interval *
-DatumGetIntervalP(Datum X)
-{
-   return (Interval *) DatumGetPointer(X);
-}
-
-static inline Datum
-TimestampGetDatum(Timestamp X)
-{
-   return Int64GetDatum(X);
-}
-
-static inline Datum
-TimestampTzGetDatum(TimestampTz X)
-{
-   return Int64GetDatum(X);
-}
-
-static inline Datum
-IntervalPGetDatum(const Interval *X)
-{
-   return PointerGetDatum(X);
-}
+#define DatumGetTimestamp(X)  ((Timestamp) DatumGetInt64(X))
+#define DatumGetTimestampTz(X) ((TimestampTz) DatumGetInt64(X))
+#define DatumGetIntervalP(X)  ((Interval *) DatumGetPointer(X))
+
+#define TimestampGetDatum(X) Int64GetDatum(X)
+#define TimestampTzGetDatum(X) Int64GetDatum(X)
+#define IntervalPGetDatum(X) PointerGetDatum(X)
 
 #define PG_GETARG_TIMESTAMP(n) DatumGetTimestamp(PG_GETARG_DATUM(n))
 #define PG_GETARG_TIMESTAMPTZ(n) DatumGetTimestampTz(PG_GETARG_DATUM(n))
index 69f4332d0fbd2cd892c5f64ee545d0c9c3a3a70a..0029da4e7f6c81c5cced4673c80450345579f457 100644 (file)
@@ -23,20 +23,9 @@ typedef struct pg_uuid_t
 } pg_uuid_t;
 
 /* fmgr interface macros */
-static inline Datum
-UUIDPGetDatum(const pg_uuid_t *X)
-{
-   return PointerGetDatum(X);
-}
-
+#define UUIDPGetDatum(X)       PointerGetDatum(X)
 #define PG_RETURN_UUID_P(X)        return UUIDPGetDatum(X)
-
-static inline pg_uuid_t *
-DatumGetUUIDP(Datum X)
-{
-   return (pg_uuid_t *) DatumGetPointer(X);
-}
-
+#define DatumGetUUIDP(X)       ((pg_uuid_t *) DatumGetPointer(X))
 #define PG_GETARG_UUID_P(X)        DatumGetUUIDP(PG_GETARG_DATUM(X))
 
 #endif                         /* UUID_H */
index e65e7f65e7e45434a781cdfcefaf6ea4659a89e3..039ba860cfcd69522eae51e20c3b9360b2c5a1c2 100644 (file)
@@ -41,24 +41,9 @@ typedef struct
  * BIT and BIT VARYING are toastable varlena types.  They are the same
  * as far as representation goes, so we just have one set of macros.
  */
-static inline VarBit *
-DatumGetVarBitP(Datum X)
-{
-   return (VarBit *) PG_DETOAST_DATUM(X);
-}
-
-static inline VarBit *
-DatumGetVarBitPCopy(Datum X)
-{
-   return (VarBit *) PG_DETOAST_DATUM_COPY(X);
-}
-
-static inline Datum
-VarBitPGetDatum(const VarBit *X)
-{
-   return PointerGetDatum(X);
-}
-
+#define DatumGetVarBitP(X)        ((VarBit *) PG_DETOAST_DATUM(X))
+#define DatumGetVarBitPCopy(X)    ((VarBit *) PG_DETOAST_DATUM_COPY(X))
+#define VarBitPGetDatum(X)        PointerGetDatum(X)
 #define PG_GETARG_VARBIT_P(n)     DatumGetVarBitP(PG_GETARG_DATUM(n))
 #define PG_GETARG_VARBIT_P_COPY(n) DatumGetVarBitPCopy(PG_GETARG_DATUM(n))
 #define PG_RETURN_VARBIT_P(x)     return VarBitPGetDatum(x)
index 9c5ce241db09c6786a8c772efab0491938c7a05d..b702fc1a910a79e1ea9fb75d3b23bb4d723b756f 100644 (file)
 
 #include "access/transam.h"
 
-static inline FullTransactionId
-DatumGetFullTransactionId(Datum X)
-{
-   return FullTransactionIdFromU64(DatumGetUInt64(X));
-}
-
-static inline Datum
-FullTransactionIdGetDatum(FullTransactionId X)
-{
-   return UInt64GetDatum(U64FromFullTransactionId(X));
-}
-
+#define DatumGetFullTransactionId(X) (FullTransactionIdFromU64(DatumGetUInt64(X)))
+#define FullTransactionIdGetDatum(X) (UInt64GetDatum(U64FromFullTransactionId(X)))
 #define PG_GETARG_FULLTRANSACTIONID(X) DatumGetFullTransactionId(PG_GETARG_DATUM(X))
 #define PG_RETURN_FULLTRANSACTIONID(X) return FullTransactionIdGetDatum(X)
 
index c71174d2041b9f42627381612de55835a10f569c..6620a6261919e71babc7ef9f9e5ff6f8e21c784c 100644 (file)
@@ -47,17 +47,8 @@ typedef enum
 /* struct PgXmlErrorContext is private to xml.c */
 typedef struct PgXmlErrorContext PgXmlErrorContext;
 
-static inline xmltype *
-DatumGetXmlP(Datum X)
-{
-   return (xmltype *) PG_DETOAST_DATUM(X);
-}
-
-static inline Datum
-XmlPGetDatum(const xmltype *X)
-{
-   return PointerGetDatum(X);
-}
+#define DatumGetXmlP(X)        ((xmltype *) PG_DETOAST_DATUM(X))
+#define XmlPGetDatum(X)        PointerGetDatum(X)
 
 #define PG_GETARG_XML_P(n) DatumGetXmlP(PG_GETARG_DATUM(n))
 #define PG_RETURN_XML_P(x) PG_RETURN_POINTER(x)