Fix -Wcast-qual warning in guc_funcs.c

show_all_settings() passed its char *values[] array to
GetConfigOptionValues() by casting it to const char **, which triggers
-Wcast-qual warnings.  This was harmless in practice, because the only
consumer, BuildTupleFromCStrings(), does not modify the strings.

Fix by declaring the array as const char *values[], which is what
GetConfigOptionValues() stores into it, and casting away the const
with unconstify() when passing it to BuildTupleFromCStrings().  This
keeps the const removal explicit and type-checked, and it compiles to
the same code as before.

Reviewed-by: Chao Li <[email protected]>
Discussion: 
https://www.postgresql.org/message-id/flat/70b86618-4038-4b19-8847-1a400d99d477%40eisentraut.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/470d9948965835a8c3bfb3ac102384bcc84a604c

Modified Files
--------------
src/backend/utils/misc/guc_funcs.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)

Reply via email to