1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-27 23:21:58 +03:00

Change fastgetattr and heap_getattr to inline functions

They were macros previously, but recent callsite additions made Coverity
complain about one of the assertions being always true.  This change
could have been made a long time ago, but the Coverity complain broke
the inertia.

Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Japin Li <japinli@hotmail.com>
Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Discussion: https://postgr.es/m/202203241021.uts52sczx3al@alvherre.pgsql
This commit is contained in:
Alvaro Herrera
2022-03-24 18:02:27 +01:00
parent 0bd7af082a
commit e27f4ee0a7
2 changed files with 69 additions and 128 deletions

View File

@ -1131,52 +1131,6 @@ heapgettup_pagemode(HeapScanDesc scan,
}
#if defined(DISABLE_COMPLEX_MACRO)
/*
* This is formatted so oddly so that the correspondence to the macro
* definition in access/htup_details.h is maintained.
*/
Datum
fastgetattr(HeapTuple tup, int attnum, TupleDesc tupleDesc,
bool *isnull)
{
return (
(attnum) > 0 ?
(
(*(isnull) = false),
HeapTupleNoNulls(tup) ?
(
TupleDescAttr((tupleDesc), (attnum) - 1)->attcacheoff >= 0 ?
(
fetchatt(TupleDescAttr((tupleDesc), (attnum) - 1),
(char *) (tup)->t_data + (tup)->t_data->t_hoff +
TupleDescAttr((tupleDesc), (attnum) - 1)->attcacheoff)
)
:
nocachegetattr((tup), (attnum), (tupleDesc))
)
:
(
att_isnull((attnum) - 1, (tup)->t_data->t_bits) ?
(
(*(isnull) = true),
(Datum) NULL
)
:
(
nocachegetattr((tup), (attnum), (tupleDesc))
)
)
)
:
(
(Datum) NULL
)
);
}
#endif /* defined(DISABLE_COMPLEX_MACRO) */
/* ----------------------------------------------------------------
* heap access method interface
* ----------------------------------------------------------------