mirror of
https://github.com/postgres/postgres.git
synced 2025-12-19 17:02:53 +03:00
Recommend wrappers of PG_DETOAST_DATUM_PACKED().
When commit 3e23b68dac introduced
single-byte varlena headers, its fmgr.h changes presented
PG_GETARG_TEXT_PP() and PG_GETARG_TEXT_P() as equals. Its postgres.h
changes presented PG_DETOAST_DATUM_PACKED() and VARDATA_ANY() as the
exceptional case. Now, instead, firmly recommend PG_GETARG_TEXT_PP()
over PG_GETARG_TEXT_P(); likewise for other ...PP() macros. This shaves
cycles and invites consistency of style.
This commit is contained in:
@@ -104,12 +104,13 @@ typedef struct macaddr
|
||||
/*
|
||||
* fmgr interface macros
|
||||
*/
|
||||
#define DatumGetInetP(X) ((inet *) PG_DETOAST_DATUM(X))
|
||||
#define DatumGetInetPP(X) ((inet *) PG_DETOAST_DATUM_PACKED(X))
|
||||
#define InetPGetDatum(X) PointerGetDatum(X)
|
||||
#define PG_GETARG_INET_P(n) DatumGetInetP(PG_GETARG_DATUM(n))
|
||||
#define PG_GETARG_INET_PP(n) DatumGetInetPP(PG_GETARG_DATUM(n))
|
||||
#define PG_RETURN_INET_P(x) return InetPGetDatum(x)
|
||||
/* obsolescent variants */
|
||||
#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 */
|
||||
#define DatumGetMacaddrP(X) ((macaddr *) DatumGetPointer(X))
|
||||
#define MacaddrPGetDatum(X) PointerGetDatum(X)
|
||||
|
||||
Reference in New Issue
Block a user