mirror of
https://github.com/postgres/postgres.git
synced 2025-11-25 12:03:53 +03:00
Consolidate ItemPointer to Datum conversion functions
Instead of defining the same set of macros several times, define it once in an appropriate header file. In passing, convert to inline functions. Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi> Discussion: https://www.postgresql.org/message-id/flat/844dd4c5-e5a1-3df1-bfaf-d1e1c2a16e45%40enterprisedb.com
This commit is contained in:
@@ -222,4 +222,24 @@ extern int32 ItemPointerCompare(ItemPointer arg1, ItemPointer arg2);
|
||||
extern void ItemPointerInc(ItemPointer pointer);
|
||||
extern void ItemPointerDec(ItemPointer pointer);
|
||||
|
||||
/* ----------------
|
||||
* Datum conversion functions
|
||||
* ----------------
|
||||
*/
|
||||
|
||||
static inline ItemPointer
|
||||
DatumGetItemPointer(Datum X)
|
||||
{
|
||||
return (ItemPointer) DatumGetPointer(X);
|
||||
}
|
||||
|
||||
static inline Datum
|
||||
ItemPointerGetDatum(const ItemPointerData *X)
|
||||
{
|
||||
return PointerGetDatum(X);
|
||||
}
|
||||
|
||||
#define PG_GETARG_ITEMPOINTER(n) DatumGetItemPointer(PG_GETARG_DATUM(n))
|
||||
#define PG_RETURN_ITEMPOINTER(x) return ItemPointerGetDatum(x)
|
||||
|
||||
#endif /* ITEMPTR_H */
|
||||
|
||||
Reference in New Issue
Block a user