0
0
mirror of https://github.com/vim/vim.git synced 2025-10-25 09:04:09 -04:00

patch 9.1.1692: global_functions are not constant

Problem:  global_functions are not constant
Solution: Place global_functions[] in read-only memory (Damien Lejay).

Mark global_functions[] as `static const`.  The table is never modified
at runtime, so keeping it in writable `.data` has no benefit.

Only a local pointer in func_check_arg_types() needed adjusting to
`const`.  No functional changes.

closes: #18121

Signed-off-by: Damien Lejay <damien@lejay.be>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Damien Lejay
2025-08-26 21:03:31 +02:00
committed by Christian Brabandt
parent 0a9ad34cad
commit 93160530c4
3 changed files with 6 additions and 4 deletions

View File

@@ -17,7 +17,7 @@ func Test_function_lists()
" Create a file of the functions in evalfunc.c:global_functions[].
enew!
read ../evalfunc.c
1,/^static funcentry_T global_functions\[\] =$/d
1,/^static const funcentry_T global_functions\[\] =$/d
call search('^};$')
.,$d
v/^ {/d
@@ -38,7 +38,7 @@ func Test_function_lists()
" not obsolete, sorted in ASCII order.
enew!
read ../evalfunc.c
1,/^static funcentry_T global_functions\[\] =$/d
1,/^static const funcentry_T global_functions\[\] =$/d
call search('^};$')
.,$d
v/^ {/d