mirror of
https://github.com/postgres/postgres.git
synced 2025-11-13 16:22:44 +03:00
Mark function arguments of type "Datum *" as "const Datum *" where possible
Several functions in the codebase accept "Datum *" parameters but do not modify the pointed-to data. These have been updated to take "const Datum *" instead, improving type safety and making the interfaces clearer about their intent. This change helps the compiler catch accidental modifications and better documents immutability of arguments. Most of "Datum *" parameters have a pairing "bool *isnull" parameter, they are constified as well. No functional behavior is changed by this patch. Author: Chao Li <lic@highgo.com> Discussion: https://www.postgresql.org/message-id/flat/CAEoWx2msfT0knvzUa72ZBwu9LR_RLY4on85w2a9YpE-o2By5HQ@mail.gmail.com
This commit is contained in:
14
src/backend/utils/cache/catcache.c
vendored
14
src/backend/utils/cache/catcache.c
vendored
@@ -117,10 +117,10 @@ static CatCTup *CatalogCacheCreateEntry(CatCache *cache, HeapTuple ntp,
|
||||
|
||||
static void ReleaseCatCacheWithOwner(HeapTuple tuple, ResourceOwner resowner);
|
||||
static void ReleaseCatCacheListWithOwner(CatCList *list, ResourceOwner resowner);
|
||||
static void CatCacheFreeKeys(TupleDesc tupdesc, int nkeys, int *attnos,
|
||||
Datum *keys);
|
||||
static void CatCacheCopyKeys(TupleDesc tupdesc, int nkeys, int *attnos,
|
||||
Datum *srckeys, Datum *dstkeys);
|
||||
static void CatCacheFreeKeys(TupleDesc tupdesc, int nkeys, const int *attnos,
|
||||
const Datum *keys);
|
||||
static void CatCacheCopyKeys(TupleDesc tupdesc, int nkeys, const int *attnos,
|
||||
const Datum *srckeys, Datum *dstkeys);
|
||||
|
||||
|
||||
/*
|
||||
@@ -2279,7 +2279,7 @@ CatalogCacheCreateEntry(CatCache *cache, HeapTuple ntp, Datum *arguments,
|
||||
* Helper routine that frees keys stored in the keys array.
|
||||
*/
|
||||
static void
|
||||
CatCacheFreeKeys(TupleDesc tupdesc, int nkeys, int *attnos, Datum *keys)
|
||||
CatCacheFreeKeys(TupleDesc tupdesc, int nkeys, const int *attnos, const Datum *keys)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -2301,8 +2301,8 @@ CatCacheFreeKeys(TupleDesc tupdesc, int nkeys, int *attnos, Datum *keys)
|
||||
* context.
|
||||
*/
|
||||
static void
|
||||
CatCacheCopyKeys(TupleDesc tupdesc, int nkeys, int *attnos,
|
||||
Datum *srckeys, Datum *dstkeys)
|
||||
CatCacheCopyKeys(TupleDesc tupdesc, int nkeys, const int *attnos,
|
||||
const Datum *srckeys, Datum *dstkeys)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user