Constify fields and parameters in spell.c
I started by marking VoidString as const, and fixing the fallout by
marking more fields and function arguments as const. It proliferated
quite a lot, but all within spell.c and spell.h.
A more narrow patch to get rid of the static VoidString buffer would
be to replace it with '#define VoidString ""', as C99 allows assigning
"" to a non-const pointer, even though you're not allowed to modify
it. But it seems like good hygiene to mark all these as const. In the
structs, the pointers can point to the constant VoidString, or a
buffer allocated with palloc(), or with compact_palloc(), so you
should not modify them.
Reviewed-by: Andres Freund
Discussion: https://www.postgresql.org/message-id/54c29fb0-edf2-48ea-9814-44e918bbd6e8@iki.fi
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/d5f139cb6814f0af2d2e1106899361e45c305630
Modified Files
--------------
src/backend/tsearch/spell.c | 58 +++++++++++++++++++++------------------
src/include/tsearch/dicts/spell.h | 16 +++++------
2 files changed, 39 insertions(+), 35 deletions(-)