From 8a27d418f8fc08b62f371c1b167efbfbf0a2a24e Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Fri, 31 Oct 2025 10:45:02 +0100 Subject: 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 Discussion: https://www.postgresql.org/message-id/flat/CAEoWx2msfT0knvzUa72ZBwu9LR_RLY4on85w2a9YpE-o2By5HQ@mail.gmail.com --- src/include/utils/jsonb.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/include/utils/jsonb.h') diff --git a/src/include/utils/jsonb.h b/src/include/utils/jsonb.h index fecb33b9c67..ff30fbcf6df 100644 --- a/src/include/utils/jsonb.h +++ b/src/include/utils/jsonb.h @@ -426,9 +426,9 @@ extern char *JsonbUnquote(Jsonb *jb); extern bool JsonbExtractScalar(JsonbContainer *jbc, JsonbValue *res); extern const char *JsonbTypeName(JsonbValue *val); -extern Datum jsonb_set_element(Jsonb *jb, Datum *path, int path_len, +extern Datum jsonb_set_element(Jsonb *jb, const Datum *path, int path_len, JsonbValue *newval); -extern Datum jsonb_get_element(Jsonb *jb, Datum *path, int npath, +extern Datum jsonb_get_element(Jsonb *jb, const Datum *path, int npath, bool *isnull, bool as_text); extern bool to_jsonb_is_immutable(Oid typoid); extern Datum jsonb_build_object_worker(int nargs, const Datum *args, const bool *nulls, -- cgit v1.2.3