mirror of
https://github.com/neovim/neovim.git
synced 2025-09-15 15:58:17 +00:00
api/dispatch: Mark generated functions table readonly (#6576)
This commit is contained in:

committed by
Justin M. Keyes

parent
7f6d3d3052
commit
8dc3eca49b
@@ -41,6 +41,7 @@ funcsdata:close()
|
|||||||
gperfpipe:write([[
|
gperfpipe:write([[
|
||||||
%language=ANSI-C
|
%language=ANSI-C
|
||||||
%global-table
|
%global-table
|
||||||
|
%readonly-tables
|
||||||
%define initializer-suffix ,0,0,NULL,NULL
|
%define initializer-suffix ,0,0,NULL,NULL
|
||||||
%define word-array-name functions
|
%define word-array-name functions
|
||||||
%define hash-function-name hash_internal_func_gperf
|
%define hash-function-name hash_internal_func_gperf
|
||||||
|
@@ -6009,7 +6009,7 @@ char_u *get_expr_name(expand_T *xp, int idx)
|
|||||||
/// @param[in] name Name of the function.
|
/// @param[in] name Name of the function.
|
||||||
///
|
///
|
||||||
/// Returns pointer to the function definition or NULL if not found.
|
/// Returns pointer to the function definition or NULL if not found.
|
||||||
static VimLFuncDef *find_internal_func(const char *const name)
|
static const VimLFuncDef *find_internal_func(const char *const name)
|
||||||
FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_PURE FUNC_ATTR_NONNULL_ALL
|
FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_PURE FUNC_ATTR_NONNULL_ALL
|
||||||
{
|
{
|
||||||
size_t len = strlen(name);
|
size_t len = strlen(name);
|
||||||
@@ -6378,7 +6378,7 @@ call_func(
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Find the function name in the table, call its implementation.
|
// Find the function name in the table, call its implementation.
|
||||||
VimLFuncDef *const fdef = find_internal_func((const char *)fname);
|
const VimLFuncDef *const fdef = find_internal_func((const char *)fname);
|
||||||
if (fdef != NULL) {
|
if (fdef != NULL) {
|
||||||
if (argcount < fdef->min_argc) {
|
if (argcount < fdef->min_argc) {
|
||||||
error = ERROR_TOOFEW;
|
error = ERROR_TOOFEW;
|
||||||
|
Reference in New Issue
Block a user