mirror of
https://git.postgresql.org/git/postgresql.git
synced 2026-02-24 23:37:03 +08: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:
@ -352,8 +352,8 @@ extern PGDLLIMPORT bool Array_nulls;
|
||||
* prototypes for functions defined in arrayfuncs.c
|
||||
*/
|
||||
extern void CopyArrayEls(ArrayType *array,
|
||||
Datum *values,
|
||||
bool *nulls,
|
||||
const Datum *values,
|
||||
const bool *nulls,
|
||||
int nitems,
|
||||
int typlen,
|
||||
bool typbyval,
|
||||
@ -405,14 +405,14 @@ extern ArrayType *construct_empty_array(Oid elmtype);
|
||||
extern ExpandedArrayHeader *construct_empty_expanded_array(Oid element_type,
|
||||
MemoryContext parentcontext,
|
||||
ArrayMetaState *metacache);
|
||||
extern void deconstruct_array(ArrayType *array,
|
||||
extern void deconstruct_array(const ArrayType *array,
|
||||
Oid elmtype,
|
||||
int elmlen, bool elmbyval, char elmalign,
|
||||
Datum **elemsp, bool **nullsp, int *nelemsp);
|
||||
extern void deconstruct_array_builtin(ArrayType *array,
|
||||
extern void deconstruct_array_builtin(const ArrayType *array,
|
||||
Oid elmtype,
|
||||
Datum **elemsp, bool **nullsp, int *nelemsp);
|
||||
extern bool array_contains_nulls(ArrayType *array);
|
||||
extern bool array_contains_nulls(const ArrayType *array);
|
||||
|
||||
extern ArrayBuildState *initArrayResult(Oid element_type,
|
||||
MemoryContext rcontext, bool subcontext);
|
||||
|
||||
Reference in New Issue
Block a user