1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-24 00:23:06 +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:
Peter Eisentraut
2025-10-31 10:45:02 +01:00
parent aa4535307e
commit 8a27d418f8
34 changed files with 145 additions and 145 deletions

View File

@@ -47,8 +47,8 @@ typedef struct
static Selectivity tsquerysel(VariableStatData *vardata, Datum constval);
static Selectivity mcelem_tsquery_selec(TSQuery query,
Datum *mcelem, int nmcelem,
float4 *numbers, int nnumbers);
const Datum *mcelem, int nmcelem,
const float4 *numbers, int nnumbers);
static Selectivity tsquery_opr_selec(QueryItem *item, char *operand,
TextFreq *lookup, int length, float4 minfreq);
static int compare_lexeme_textfreq(const void *e1, const void *e2);
@@ -204,8 +204,8 @@ tsquerysel(VariableStatData *vardata, Datum constval)
* Extract data from the pg_statistic arrays into useful format.
*/
static Selectivity
mcelem_tsquery_selec(TSQuery query, Datum *mcelem, int nmcelem,
float4 *numbers, int nnumbers)
mcelem_tsquery_selec(TSQuery query, const Datum *mcelem, int nmcelem,
const float4 *numbers, int nnumbers)
{
float4 minfreq;
TextFreq *lookup;