forked from aniani/vim
patch 9.1.1063: too many strlen() calls in userfunc.c
Problem: too many strlen() calls in userfunc.c Solution: refactor userfunc.c and remove calls to strlen(), drop set_ufunc_name() and roll it into alloc_ufunc(), check for out-of-memory condition in trans_function_name_ext() (John Marriott) closes: #16537 Signed-off-by: John Marriott <basilisk@internode.on.net> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
3219da514c
commit
b32800f7c5
@@ -1445,7 +1445,7 @@ generate_FUNCREF(
|
||||
}
|
||||
}
|
||||
if (ufunc->uf_def_status == UF_NOT_COMPILED || cl != NULL)
|
||||
extra->fre_func_name = vim_strsave(ufunc->uf_name);
|
||||
extra->fre_func_name = vim_strnsave(ufunc->uf_name, ufunc->uf_namelen);
|
||||
if (ufunc->uf_def_status != UF_NOT_COMPILED && cl == NULL)
|
||||
{
|
||||
if (isn_idx == NULL && ufunc->uf_def_status == UF_TO_BE_COMPILED)
|
||||
@@ -1912,7 +1912,7 @@ generate_CALL(
|
||||
{
|
||||
// A user function may be deleted and redefined later, can't use the
|
||||
// ufunc pointer, need to look it up again at runtime.
|
||||
isn->isn_arg.ufunc.cuf_name = vim_strsave(ufunc->uf_name);
|
||||
isn->isn_arg.ufunc.cuf_name = vim_strnsave(ufunc->uf_name, ufunc->uf_namelen);
|
||||
isn->isn_arg.ufunc.cuf_argcount = argcount;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user