Convert *GetDatum() and DatumGet*() macros to inline functions
authorPeter Eisentraut <peter@eisentraut.org>
Tue, 27 Sep 2022 18:47:07 +0000 (20:47 +0200)
committerPeter Eisentraut <peter@eisentraut.org>
Tue, 27 Sep 2022 18:50:21 +0000 (20:50 +0200)
commitc8b2ef05f481ef06326d7b9f3eb14b303f215c7e
tree5f72d0b7ee1eebd619c1b91b25f9a35a98f9218f
parent8caf96de0b7b4ad5beb02b36a158196520c035a7
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.

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
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