mirror of
https://github.com/neovim/neovim.git
synced 2025-09-12 06:18:16 +00:00
Merge pull request #20077 from dundargoc/refactor/char_u/11
refactor: replace char_u with char 11: remove `STRLEN` part 1
This commit is contained in:
@@ -840,7 +840,7 @@ static void get_col(typval_T *argvars, typval_T *rettv, bool charcol)
|
||||
if (fp->col == MAXCOL) {
|
||||
// '> 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 = (colnr_T)strlen(ml_get(fp->lnum)) + 1;
|
||||
} else {
|
||||
col = MAXCOL;
|
||||
}
|
||||
@@ -7782,7 +7782,7 @@ free_lstval:
|
||||
if (strval == NULL) {
|
||||
return;
|
||||
}
|
||||
write_reg_contents_ex(regname, strval, (ssize_t)STRLEN(strval),
|
||||
write_reg_contents_ex(regname, strval, (ssize_t)strlen(strval),
|
||||
append, yank_type, (colnr_T)block_len);
|
||||
}
|
||||
if (pointreg != 0) {
|
||||
@@ -8351,7 +8351,7 @@ static void f_strgetchar(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
||||
return;
|
||||
}
|
||||
|
||||
const size_t len = STRLEN(str);
|
||||
const size_t len = strlen(str);
|
||||
size_t byteidx = 0;
|
||||
|
||||
while (charidx >= 0 && byteidx < len) {
|
||||
@@ -8457,7 +8457,7 @@ static void f_strwidth(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
||||
static void f_strcharpart(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
||||
{
|
||||
const char *const p = tv_get_string(&argvars[0]);
|
||||
const size_t slen = STRLEN(p);
|
||||
const size_t slen = strlen(p);
|
||||
|
||||
int nbyte = 0;
|
||||
bool error = false;
|
||||
@@ -8597,7 +8597,7 @@ static void f_strridx(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
||||
return; // Type error; errmsg already given.
|
||||
}
|
||||
|
||||
const size_t haystack_len = STRLEN(haystack);
|
||||
const size_t haystack_len = strlen(haystack);
|
||||
ptrdiff_t end_idx;
|
||||
if (argvars[2].v_type != VAR_UNKNOWN) {
|
||||
// Third argument: upper limit for index.
|
||||
@@ -8728,7 +8728,7 @@ static void f_synID(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
||||
|
||||
int id = 0;
|
||||
if (!transerr && lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count
|
||||
&& col >= 0 && (size_t)col < STRLEN(ml_get(lnum))) {
|
||||
&& col >= 0 && (size_t)col < strlen(ml_get(lnum))) {
|
||||
id = syn_get_id(curwin, lnum, col, trans, NULL, false);
|
||||
}
|
||||
|
||||
@@ -8794,7 +8794,7 @@ static void f_synIDattr(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
||||
}
|
||||
break;
|
||||
case 'u':
|
||||
if (STRLEN(what) >= 9) {
|
||||
if (strlen(what) >= 9) {
|
||||
if (TOLOWER_ASC(what[5]) == 'l') {
|
||||
// underline
|
||||
p = highlight_has_attr(id, HL_UNDERLINE, modec);
|
||||
@@ -8853,7 +8853,7 @@ static void f_synconcealed(typval_T *argvars, typval_T *rettv, EvalFuncData fptr
|
||||
CLEAR_FIELD(str);
|
||||
|
||||
if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count && col >= 0
|
||||
&& (size_t)col <= STRLEN(ml_get(lnum)) && curwin->w_p_cole > 0) {
|
||||
&& (size_t)col <= strlen(ml_get(lnum)) && curwin->w_p_cole > 0) {
|
||||
(void)syn_get_id(curwin, lnum, col, false, NULL, false);
|
||||
syntax_flags = get_syntax_info(&matchid);
|
||||
|
||||
@@ -8890,7 +8890,7 @@ static void f_synstack(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
||||
if (lnum >= 1
|
||||
&& lnum <= curbuf->b_ml.ml_line_count
|
||||
&& col >= 0
|
||||
&& (size_t)col <= STRLEN(ml_get(lnum))) {
|
||||
&& (size_t)col <= strlen(ml_get(lnum))) {
|
||||
tv_list_alloc_ret(rettv, kListLenMayKnow);
|
||||
(void)syn_get_id(curwin, lnum, col, false, NULL, true);
|
||||
|
||||
@@ -9444,7 +9444,7 @@ static void f_trim(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
||||
}
|
||||
}
|
||||
|
||||
const char *tail = head + STRLEN(head);
|
||||
const char *tail = head + strlen(head);
|
||||
if (dir == 0 || dir == 2) {
|
||||
// Trim trailing characters
|
||||
for (; tail > head; tail = prev) {
|
||||
@@ -9552,7 +9552,7 @@ static void f_virtcol(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
||||
if (fp->col < 0) {
|
||||
fp->col = 0;
|
||||
} else {
|
||||
const size_t len = STRLEN(ml_get(fp->lnum));
|
||||
const size_t len = strlen(ml_get(fp->lnum));
|
||||
if (fp->col > (colnr_T)len) {
|
||||
fp->col = (colnr_T)len;
|
||||
}
|
||||
|
Reference in New Issue
Block a user