agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Avoid casting void * function arguments
Date: Mon, 12 Jan 2026 15:39:31 +0000
Message-ID: <E1vfK0w-0003Hk-19@gemulon.postgresql.org> (raw)

Avoid casting void * function arguments

In many cases, the cast would silently drop a const qualifier.  To
fix, drop the unnecessary cast and let the compiler check the types
and qualifiers.  Add const to read-only local variables, preserving
the const qualifiers from the function signatures.

Co-authored-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Co-authored-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/aUQHy/MmWq7c97wK%40ip-10-97-1-34.eu-west-3.compute.internal

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/c3c240537f6da498186bfb07017a7b01b9a2c24f

Modified Files
--------------
src/backend/access/brin/brin_minmax_multi.c          | 12 ++++++------
src/backend/access/common/heaptuple.c                |  6 +++---
src/backend/access/heap/pruneheap.c                  |  4 ++--
src/backend/access/nbtree/nbtpage.c                  |  4 ++--
src/backend/access/nbtree/nbtpreprocesskeys.c        |  4 ++--
src/backend/access/nbtree/nbtsplitloc.c              |  4 ++--
src/backend/access/spgist/spgkdtreeproc.c            |  8 ++++----
src/backend/statistics/extended_stats.c              |  4 ++--
src/backend/statistics/mcv.c                         |  8 ++++----
src/backend/tsearch/spell.c                          |  4 ++--
src/backend/utils/adt/rangetypes_gist.c              | 18 +++++++++---------
src/backend/utils/adt/rangetypes_spgist.c            |  6 +++---
src/backend/utils/adt/rangetypes_typanalyze.c        |  6 +++---
src/backend/utils/cache/typcache.c                   | 14 +++++++-------
src/bin/pg_dump/pg_dump.c                            |  2 +-
src/test/modules/injection_points/injection_points.c | 12 ++++++------
16 files changed, 58 insertions(+), 58 deletions(-)



view thread (2+ messages)  latest in thread

Message-ID: <E1vfK0w-0003Hk-19@gemulon.postgresql.org>
Permalink:  ../E1vfK0w-0003Hk-19@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1vfK0w-0003Hk-19@gemulon.postgresql.org

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: peter@eisentraut.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Avoid casting void * function arguments
  In-Reply-To: <E1vfK0w-0003Hk-19@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox