mirror of
https://github.com/postgres/postgres.git
synced 2026-02-22 01:11:05 -05:00
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. For the *GetDatumFast() macros, converting to an inline function doesn't work in the !USE_FLOAT8_BYVAL case, but we can use AssertVariableIsOfTypeMacro() to get a similar level of type checking. Reviewed-by: Aleksander Alekseev <aleksander@timescale.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://www.postgresql.org/message-id/flat/8528fb7e-0aa2-6b54-85fb-0c0886dbd6ed%40enterprisedb.com
42 lines
939 B
C
42 lines
939 B
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* uuid.h
|
|
* Header file for the "uuid" ADT. In C, we use the name pg_uuid_t,
|
|
* to avoid conflicts with any uuid_t type that might be defined by
|
|
* the system headers.
|
|
*
|
|
* Copyright (c) 2007-2022, PostgreSQL Global Development Group
|
|
*
|
|
* src/include/utils/uuid.h
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
#ifndef UUID_H
|
|
#define UUID_H
|
|
|
|
/* uuid size in bytes */
|
|
#define UUID_LEN 16
|
|
|
|
typedef struct pg_uuid_t
|
|
{
|
|
unsigned char data[UUID_LEN];
|
|
} pg_uuid_t;
|
|
|
|
/* fmgr interface macros */
|
|
static inline Datum
|
|
UUIDPGetDatum(const pg_uuid_t *X)
|
|
{
|
|
return 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 PG_GETARG_UUID_P(X) DatumGetUUIDP(PG_GETARG_DATUM(X))
|
|
|
|
#endif /* UUID_H */
|