diff options
author | John Marriott <basilisk@internode.on.net> | 2024-03-11 22:04:45 +0100 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2024-03-11 22:04:45 +0100 |
commit | bfcc895482c717c9f6d86890d789ec739c3016b4 (patch) | |
tree | 56bf61a73afb69adbaacd00ba88fde013c98d8ce /src/evalfunc.c | |
parent | 5cd86c6cff94256ed2db872c46b57da259a648ac (diff) |
patch 9.1.0168: too many STRLEN() callsv9.1.0168
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>
Diffstat (limited to 'src/evalfunc.c')
-rw-r--r-- | src/evalfunc.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c index eeee00d663..14650caf6b 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -3637,7 +3637,7 @@ get_col(typval_T *argvars, typval_T *rettv, int charcol) { // '> 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 @@ f_synID(typval_T *argvars UNUSED, typval_T *rettv) 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 @@ f_synconcealed(typval_T *argvars UNUSED, typval_T *rettv) 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 @@ f_synstack(typval_T *argvars UNUSED, typval_T *rettv) 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 @@ f_virtcol(typval_T *argvars, typval_T *rettv) 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; } |