postgresql/src/backend/tsearch
Tom Lane de77775a7b Fix some cases of indirectly casting away const.
Newest versions of gcc+glibc are able to detect cases where code
implicitly casts away const by assigning the result of strchr() or
a similar function applied to a "const char *" value to a target
variable that's just "char *".  This of course creates a hazard of
not getting a compiler warning about scribbling on a string one was
not supposed to, so fixing up such cases is good.

This patch fixes a dozen or so places where we were doing that.
Most are trivial additions of "const" to the target variable,
since no actually-hazardous change was occurring.

Thanks to Bertrand Drouvot for finding a couple more spots than
I had.

This commit back-patches relevant portions of 8f1791c61 and
9f7565c6c into supported branches.  However, there are two
places in ecpg (in v18 only) where a proper fix is more
complicated than seems appropriate for a back-patch.  I opted
to silence those two warnings by adding casts.

Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/1324889.1764886170@sss.pgh.pa.us
Discussion: https://postgr.es/m/3988414.1771950285@sss.pgh.pa.us
Backpatch-through: 14-18
2026-02-25 11:19:50 -05:00
..
dicts Update copyright for 2019 2019-01-02 12:44:25 -05:00
dict.c Update copyright for 2025 2025-01-01 11:21:55 -05:00
dict_ispell.c Update copyright for 2025 2025-01-01 11:21:55 -05:00
dict_simple.c Update copyright for 2025 2025-01-01 11:21:55 -05:00
dict_synonym.c Replace pg_mblen() with bounds-checked versions. 2026-02-09 12:43:42 +13:00
dict_thesaurus.c Replace pg_mblen() with bounds-checked versions. 2026-02-09 12:43:42 +13:00
Makefile Update copyright for 2025 2025-01-01 11:21:55 -05:00
meson.build Update copyright for 2025 2025-01-01 11:21:55 -05:00
regis.c Replace pg_mblen() with bounds-checked versions. 2026-02-09 12:43:42 +13:00
spell.c Fix some cases of indirectly casting away const. 2026-02-25 11:19:50 -05:00
to_tsany.c Update copyright for 2025 2025-01-01 11:21:55 -05:00
ts_locale.c Replace pg_mblen() with bounds-checked versions. 2026-02-09 12:43:42 +13:00
ts_parse.c Update copyright for 2025 2025-01-01 11:21:55 -05:00
ts_selfuncs.c Require superuser to install a non-built-in selectivity estimator. 2026-02-09 10:07:31 -05:00
ts_typanalyze.c Add is_analyze parameter to vacuum_delay_point(). 2025-02-11 16:38:14 -06:00
ts_utils.c Replace pg_mblen() with bounds-checked versions. 2026-02-09 12:43:42 +13:00
wparser.c Update copyright for 2025 2025-01-01 11:21:55 -05:00
wparser_def.c Replace pg_mblen() with bounds-checked versions. 2026-02-09 12:43:42 +13:00