patch 9.1.0870: too many strlen() calls in eval.c
Problem: too many strlen() calls in eval.c
Solution: Refactor eval.c to remove calls to STRLEN()
(John Marriott)
closes: #16066
Signed-off-by: John Marriott <basilisk@internode.on.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/filepath.c b/src/filepath.c
index d514aaf..3dd71bc 100644
--- a/src/filepath.c
+++ b/src/filepath.c
@@ -668,12 +668,14 @@
str = vim_strnsave(*fnamep, *fnamelen);
if (sub != NULL && str != NULL)
{
+ size_t slen;
+
*usedlen = p + 1 - src;
- s = do_string_sub(str, pat, sub, NULL, flags);
+ s = do_string_sub(str, *fnamelen, pat, sub, NULL, flags, &slen);
if (s != NULL)
{
*fnamep = s;
- *fnamelen = (int)STRLEN(s);
+ *fnamelen = slen;
vim_free(*bufp);
*bufp = s;
didit = TRUE;