patch 9.1.0168: too many STRLEN() calls
Problem: too many STRLEN() calls
Solution: Make use of ml_get_len() calls instead
(John Marriott)
closes: #14123
Signed-off-by: John Marriott <basilisk@internode.on.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/evalfunc.c b/src/evalfunc.c
index eeee00d..14650ca 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -3637,7 +3637,7 @@
{
// '> can be MAXCOL, get the length of the line then
if (fp->lnum <= curbuf->b_ml.ml_line_count)
- col = (colnr_T)STRLEN(ml_get(fp->lnum)) + 1;
+ col = ml_get_len(fp->lnum) + 1;
else
col = MAXCOL;
}
@@ -11134,7 +11134,7 @@
trans = (int)tv_get_bool_chk(&argvars[2], &transerr);
if (!transerr && lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count
- && col >= 0 && col < (long)STRLEN(ml_get(lnum)))
+ && col >= 0 && col < (long)ml_get_len(lnum))
id = syn_get_id(curwin, lnum, col, trans, NULL, FALSE);
#endif
@@ -11311,7 +11311,7 @@
if (rettv_list_alloc(rettv) == OK)
{
if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count
- && col >= 0 && col <= (long)STRLEN(ml_get(lnum))
+ && col >= 0 && col <= (long)ml_get_len(lnum)
&& curwin->w_p_cole > 0)
{
(void)syn_get_id(curwin, lnum, col, FALSE, NULL, FALSE);
@@ -11368,7 +11368,7 @@
col = (colnr_T)tv_get_number(&argvars[1]) - 1; // -1 on type error
if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count
- && col >= 0 && col <= (long)STRLEN(ml_get(lnum))
+ && col >= 0 && col <= (long)ml_get_len(lnum)
&& rettv_list_alloc(rettv) == OK)
{
(void)syn_get_id(curwin, lnum, col, FALSE, NULL, TRUE);
@@ -11546,7 +11546,7 @@
fp->col = 0;
else
{
- len = (int)STRLEN(ml_get(fp->lnum));
+ len = (int)ml_get_len(fp->lnum);
if (fp->col > len)
fp->col = len;
}