1
0
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:
John Marriott
2025-02-01 15:25:34 +01:00
committed by Christian Brabandt
parent 3219da514c
commit b32800f7c5
9 changed files with 192 additions and 114 deletions

View File

@@ -3135,7 +3135,7 @@ eval_variable(
// assumed.
rettv->vval.v_string = vim_strsave(name);
else
rettv->vval.v_string = vim_strsave(ufunc->uf_name);
rettv->vval.v_string = vim_strnsave(ufunc->uf_name, ufunc->uf_namelen);
if (rettv->vval.v_string != NULL)
func_ref(ufunc->uf_name);
}