[PATCH] Add const modifier to static functions in jsonb_utils.c

From: Dmitry Mityugov <d(dot)mityugov(at)postgrespro(dot)ru>
To: pgsql-hackers(at)postgresql(dot)org
Subject: [PATCH] Add const modifier to static functions in jsonb_utils.c
Date: 2025-07-07 16:23:03
Message-ID: 5313957a9cb30557c9d4c273a2a0375c@postgrespro.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

It seems that not all parameters passed by pointer to static functions
defined in src/backend/utils/adt/jsonb_util.c are actually modified by
these functions. I propose a simple patch that adds const modifiers to
such parameters to make it clear that their values remain intact during
the call.

This modification was inspired by warnings produced by GCC 15.1 for
jsonb_util.c, discovered independently, but, as it turned out, already
described in this thread:
https://postgrespro.com/list/id/988bf1bc-3f1f-99f3-bf98-222f1cd9dc5e(at)xs4all(dot)nl
.

This is my first submission so I'm sorry in advance for any mistakes.
This modification was passed through pgindent, clearly compiles with GCC
15.1.1 on Arch Linux x86 64-bit, and ‘make check’ successfully passes
for it. I'm attaching the patch.

Best regards,
Dmitry

Attachment Content-Type Size
0001-Add-const-to-static-functions-in-jsonb_utils.c.patch text/x-diff 7.3 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Álvaro Herrera 2025-07-07 16:36:29 Re: Inconsistent LSN format in pg_waldump output
Previous Message Robin Haberkorn 2025-07-07 16:15:52 Re: [PATCH] contrib/xml2: xslt_process() should report XSLT-related error details