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>
diff --git a/src/eval.c b/src/eval.c
index 387f61d..9a140c1 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -7100,7 +7100,7 @@
else
{
rettv->v_type = VAR_FUNC;
- rettv->vval.v_string = vim_strsave(ufunc->uf_name);
+ rettv->vval.v_string = vim_strnsave(ufunc->uf_name, ufunc->uf_namelen);
}
continue;
}