pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Clean up qsort comparison function for GUC entries
Date: Tue, 11 Nov 2025 07:03:45 +0000
Message-ID: <E1vIiPp-0061uc-0u@gemulon.postgresql.org> (raw)

Clean up qsort comparison function for GUC entries

guc_var_compare() is invoked from qsort() on an array of struct
config_generic, but the function accesses these directly as
strings (char *).  This relies on the name being the first field, so
this works.  But we can write this more clearly by using the struct
and then accessing the field through the struct.  Before the
reorganization of the GUC structs (commit a13833c35f9), the old code
was probably more convenient, but now we can write this more clearly
and correctly.

After this change, it is no longer required that the name is the first
field in struct config_generic, so remove that comment.

Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/2c961fa1-14f6-44a2-985c-e30b95654e8d%40eisentraut.org

Branch
------
master

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

Modified Files
--------------
src/backend/utils/misc/guc.c   | 6 +++---
src/include/utils/guc_tables.h | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)



Message-ID: <E1vIiPp-0061uc-0u@gemulon.postgresql.org>
Permalink:  ../E1vIiPp-0061uc-0u@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1vIiPp-0061uc-0u@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: Clean up qsort comparison function for GUC entries
  In-Reply-To: <E1vIiPp-0061uc-0u@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 DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox