Clean up qsort comparison function for GUC entries
Peter Eisentraut <peter@eisentraut.org>
Author:
Peter Eisentraut <peter@eisentraut.org>
Date: 2025-11-11T06:55:10Z
Releases:
19 (unreleased)
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
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/utils/misc/guc.c | modified | +3 −3 |
| src/include/utils/guc_tables.h | modified | +1 −1 |
Discussion
- Reorganize GUC structs 20 messages · 2025-10-03 → 2026-06-24