aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDundar Göc <gocdundar@gmail.com>2022-08-26 23:11:25 +0200
committerdundargoc <gocdundar@gmail.com>2022-09-11 13:28:59 +0200
commit3ff46544c9872b4161fd098569c30b55fe3abd36 (patch)
tree589b9ebdd86fde7e200b6235596ce6feac976122
parent4638fcf4fb688fa548b8ce337ec3b7c1327fbfe9 (diff)
downloadrneovim-3ff46544c9872b4161fd098569c30b55fe3abd36.tar.gz
rneovim-3ff46544c9872b4161fd098569c30b55fe3abd36.tar.bz2
rneovim-3ff46544c9872b4161fd098569c30b55fe3abd36.zip
refactor: replace char_u with char
Work on https://github.com/neovim/neovim/issues/459
-rw-r--r--src/nvim/api/autocmd.c2
-rw-r--r--src/nvim/api/command.c2
-rw-r--r--src/nvim/api/extmark.c6
-rw-r--r--src/nvim/api/ui.c2
-rw-r--r--src/nvim/api/vimscript.c2
-rw-r--r--src/nvim/autocmd.c14
-rw-r--r--src/nvim/buffer.c12
-rw-r--r--src/nvim/change.c32
-rw-r--r--src/nvim/charset.c6
-rw-r--r--src/nvim/cmdexpand.c26
-rw-r--r--src/nvim/cmdhist.c8
-rw-r--r--src/nvim/cursor.c6
-rw-r--r--src/nvim/cursor_shape.c2
-rw-r--r--src/nvim/diff.c14
-rw-r--r--src/nvim/digraph.c6
-rw-r--r--src/nvim/drawscreen.c2
-rw-r--r--src/nvim/edit.c10
-rw-r--r--src/nvim/eval.c60
-rw-r--r--src/nvim/eval/encode.c4
-rw-r--r--src/nvim/eval/funcs.c22
-rw-r--r--src/nvim/eval/userfunc.c24
-rw-r--r--src/nvim/eval/vars.c4
-rw-r--r--src/nvim/ex_cmds.c56
-rw-r--r--src/nvim/ex_cmds2.c2
-rw-r--r--src/nvim/ex_docmd.c36
-rw-r--r--src/nvim/ex_eval.c8
-rw-r--r--src/nvim/ex_getln.c18
-rw-r--r--src/nvim/file_search.c32
-rw-r--r--src/nvim/fileio.c28
-rw-r--r--src/nvim/fold.c22
-rw-r--r--src/nvim/garray.c2
-rw-r--r--src/nvim/getchar.c10
-rw-r--r--src/nvim/hardcopy.c40
-rw-r--r--src/nvim/hashtab.c2
-rw-r--r--src/nvim/help.c26
-rw-r--r--src/nvim/highlight.c2
-rw-r--r--src/nvim/highlight_group.c8
-rw-r--r--src/nvim/if_cscope.c4
-rw-r--r--src/nvim/indent_c.c16
-rw-r--r--src/nvim/insexpand.c18
-rw-r--r--src/nvim/keycodes.c4
-rw-r--r--src/nvim/lua/executor.c8
-rw-r--r--src/nvim/main.c6
-rw-r--r--src/nvim/mapping.c12
-rw-r--r--src/nvim/mark.c2
-rw-r--r--src/nvim/mbyte.c2
-rw-r--r--src/nvim/memline.c10
-rw-r--r--src/nvim/menu.c14
-rw-r--r--src/nvim/message.c30
-rw-r--r--src/nvim/msgpack_rpc/server.c2
-rw-r--r--src/nvim/normal.c18
-rw-r--r--src/nvim/ops.c78
-rw-r--r--src/nvim/option.c18
-rw-r--r--src/nvim/optionstr.c8
-rw-r--r--src/nvim/os/env.c6
-rw-r--r--src/nvim/os/shell.c8
-rw-r--r--src/nvim/os/users.c2
-rw-r--r--src/nvim/path.c26
-rw-r--r--src/nvim/popupmenu.c2
-rw-r--r--src/nvim/quickfix.c70
-rw-r--r--src/nvim/regexp.c16
-rw-r--r--src/nvim/regexp_bt.c17
-rw-r--r--src/nvim/runtime.c64
-rw-r--r--src/nvim/screen.c8
-rw-r--r--src/nvim/search.c8
-rw-r--r--src/nvim/sha256.c2
-rw-r--r--src/nvim/shada.c4
-rw-r--r--src/nvim/sign.c16
-rw-r--r--src/nvim/spell.c22
-rw-r--r--src/nvim/spellfile.c22
-rw-r--r--src/nvim/spellsuggest.c10
-rw-r--r--src/nvim/statusline.c28
-rw-r--r--src/nvim/strings.c14
-rw-r--r--src/nvim/syntax.c12
-rw-r--r--src/nvim/tag.c2
-rw-r--r--src/nvim/terminal.c4
-rw-r--r--src/nvim/textformat.c8
-rw-r--r--src/nvim/undo.c8
-rw-r--r--src/nvim/usercmd.c28
-rw-r--r--src/nvim/window.c10
80 files changed, 613 insertions, 612 deletions
diff --git a/src/nvim/api/autocmd.c b/src/nvim/api/autocmd.c
index 1cf0211f43..99340a3c59 100644
--- a/src/nvim/api/autocmd.c
+++ b/src/nvim/api/autocmd.c
@@ -240,7 +240,7 @@ Array nvim_get_autocmds(Dict(get_autocmds) *opts, Error *err)
assert(pattern_filters[i]);
char *pat = pattern_filters[i];
- int patlen = (int)STRLEN(pat);
+ int patlen = (int)strlen(pat);
if (aupat_is_buflocal(pat, patlen)) {
aupat_normalize_buflocal_pat(pattern_buflocal,
diff --git a/src/nvim/api/command.c b/src/nvim/api/command.c
index b3518f1b0f..ed0907e8f8 100644
--- a/src/nvim/api/command.c
+++ b/src/nvim/api/command.c
@@ -105,7 +105,7 @@ Dictionary nvim_parse_cmd(String str, Dictionary opts, Error *err)
// Parse arguments
Array args = ARRAY_DICT_INIT;
- size_t length = STRLEN(ea.arg);
+ size_t length = strlen(ea.arg);
// For nargs = 1 or '?', pass the entire argument list as a single argument,
// otherwise split arguments by whitespace.
diff --git a/src/nvim/api/extmark.c b/src/nvim/api/extmark.c
index ae051d8cab..edcea52838 100644
--- a/src/nvim/api/extmark.c
+++ b/src/nvim/api/extmark.c
@@ -742,7 +742,7 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, Integer line, Integer
line = buf->b_ml.ml_line_count;
}
} else if (line < buf->b_ml.ml_line_count) {
- len = ephemeral ? MAXCOL : STRLEN(ml_get_buf(buf, (linenr_T)line + 1, false));
+ len = ephemeral ? MAXCOL : strlen(ml_get_buf(buf, (linenr_T)line + 1, false));
}
if (col == -1) {
@@ -761,7 +761,7 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, Integer line, Integer
if (col2 >= 0) {
if (line2 >= 0 && line2 < buf->b_ml.ml_line_count) {
- len = ephemeral ? MAXCOL : STRLEN(ml_get_buf(buf, (linenr_T)line2 + 1, false));
+ len = ephemeral ? MAXCOL : strlen(ml_get_buf(buf, (linenr_T)line2 + 1, false));
} else if (line2 == buf->b_ml.ml_line_count) {
// We are trying to add an extmark past final newline
len = 0;
@@ -1106,7 +1106,7 @@ static int init_sign_text(char **sign_text, char *text)
{
char *s;
- char *endp = text + (int)STRLEN(text);
+ char *endp = text + (int)strlen(text);
// Count cells and check for non-printable chars
int cells = 0;
diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c
index 27fb4b8e16..45c20d07e1 100644
--- a/src/nvim/api/ui.c
+++ b/src/nvim/api/ui.c
@@ -122,7 +122,7 @@ static char *mpack_array_dyn16(char **buf)
static void mpack_str(char **buf, const char *str)
{
assert(sizeof(schar_T) - 1 < 0x20);
- size_t len = STRLEN(str);
+ size_t len = strlen(str);
mpack_w(buf, 0xa0 | len);
memcpy(*buf, str, len);
*buf += len;
diff --git a/src/nvim/api/vimscript.c b/src/nvim/api/vimscript.c
index f6d0e39327..1758f18926 100644
--- a/src/nvim/api/vimscript.c
+++ b/src/nvim/api/vimscript.c
@@ -304,7 +304,7 @@ Object nvim_call_dict_function(Object dict, String fn, Array args, Error *err)
}
fn = (String) {
.data = di->di_tv.vval.v_string,
- .size = STRLEN(di->di_tv.vval.v_string),
+ .size = strlen(di->di_tv.vval.v_string),
};
}
diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c
index 9d37647a4e..dafbae5813 100644
--- a/src/nvim/autocmd.c
+++ b/src/nvim/autocmd.c
@@ -266,7 +266,7 @@ static void au_show_for_event(int group, event_T event, char *pat)
// normalize pat into standard "<buffer>#N" form
aupat_normalize_buflocal_pat(buflocal_pat, pat, patlen, aupat_get_buflocal_nr(pat, patlen));
pat = (char *)buflocal_pat;
- patlen = (int)STRLEN(buflocal_pat);
+ patlen = (int)strlen(buflocal_pat);
}
assert(*pat != NUL);
@@ -725,7 +725,7 @@ int check_ei(void)
char *au_event_disable(char *what)
{
char *save_ei = xstrdup(p_ei);
- char *new_ei = xstrnsave(p_ei, STRLEN(p_ei) + STRLEN(what));
+ char *new_ei = xstrnsave(p_ei, strlen(p_ei) + strlen(what));
if (*what == ',' && *p_ei == NUL) {
STRCPY(new_ei, what + 1);
} else {
@@ -957,7 +957,7 @@ int do_autocmd_event(event_T event, char *pat, bool once, int nested, char *cmd,
aupat_normalize_buflocal_pat(buflocal_pat, pat, patlen, buflocal_nr);
pat = buflocal_pat;
- patlen = (int)STRLEN(buflocal_pat);
+ patlen = (int)strlen(buflocal_pat);
}
if (delete) {
@@ -1018,7 +1018,7 @@ int autocmd_register(int64_t id, event_T event, char *pat, int patlen, int group
int findgroup;
char buflocal_pat[BUFLOCAL_PAT_LEN]; // for "<buffer=X>"
- if (patlen > (int)STRLEN(pat)) {
+ if (patlen > (int)strlen(pat)) {
return FAIL;
}
@@ -1039,7 +1039,7 @@ int autocmd_register(int64_t id, event_T event, char *pat, int patlen, int group
aupat_normalize_buflocal_pat(buflocal_pat, pat, patlen, buflocal_nr);
pat = buflocal_pat;
- patlen = (int)STRLEN(buflocal_pat);
+ patlen = (int)strlen(buflocal_pat);
}
// always goes at or after the last one, so start at the end.
@@ -1193,7 +1193,7 @@ size_t aucmd_pattern_length(char *pat)
return (size_t)(endpat - pat);
}
- return STRLEN(pat);
+ return strlen(pat);
}
char *aucmd_next_pattern(char *pat, size_t patlen)
@@ -2012,7 +2012,7 @@ void auto_next_pat(AutoPatCmd *apc, int stop_at_last)
s = _("%s Autocommands for \"%s\"");
const size_t sourcing_name_len
- = (STRLEN(s) + strlen(name) + (size_t)ap->patlen + 1);
+ = (strlen(s) + strlen(name) + (size_t)ap->patlen + 1);
char *const namep = xmalloc(sourcing_name_len);
snprintf(namep, sourcing_name_len, s, name, ap->pat);
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 1cc68c9cee..1d8f4a257c 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -2170,7 +2170,7 @@ int buflist_findpat(const char *pattern, const char *pattern_end, bool unlisted,
if (pat == NULL) {
return -1;
}
- patend = pat + STRLEN(pat) - 1;
+ patend = pat + strlen(pat) - 1;
toggledollar = (patend > pat && *patend == '$');
// First try finding a listed buffer. If not found and "unlisted"
@@ -2284,7 +2284,7 @@ int ExpandBufnames(char *pat, int *num_file, char ***file, int options)
// Make a copy of "pat" and change "^" to "\(^\|[\/]\)".
if (*pat == '^') {
- patc = xmalloc(STRLEN(pat) + 11);
+ patc = xmalloc(strlen(pat) + 11);
STRCPY(patc, "\\(^\\|[\\/]\\)");
STRCPY(patc + 11, pat + 1);
} else {
@@ -3037,7 +3037,7 @@ void fileinfo(int fullname, int shorthelp, int dont_truncate)
if (fullname > 1) { // 2 CTRL-G: include buffer number
vim_snprintf(buffer, IOSIZE, "buf %d: ", curbuf->b_fnum);
- p = buffer + STRLEN(buffer);
+ p = buffer + strlen(buffer);
} else {
p = buffer;
}
@@ -3096,7 +3096,7 @@ void fileinfo(int fullname, int shorthelp, int dont_truncate)
(int64_t)curbuf->b_ml.ml_line_count,
n);
validate_virtcol();
- len = STRLEN(buffer);
+ len = strlen(buffer);
col_print(buffer + len, IOSIZE - len,
(int)curwin->w_cursor.col + 1, (int)curwin->w_virtcol + 1);
}
@@ -3305,7 +3305,7 @@ void maketitle(void)
}
*icon_str = NUL;
// Truncate name at 100 bytes.
- len = (int)STRLEN(buf_p);
+ len = (int)strlen(buf_p);
if (len > 100) {
len -= 100;
len += utf_cp_tail_off(buf_p, buf_p + len) + 1;
@@ -3412,7 +3412,7 @@ bool append_arg_number(win_T *wp, char *buf, int buflen, bool add_file)
return false;
}
- char *p = buf + STRLEN(buf); // go to the end of the buffer
+ char *p = buf + strlen(buf); // go to the end of the buffer
// Early out if the string is getting too long
if (p - buf + 35 >= buflen) {
diff --git a/src/nvim/change.c b/src/nvim/change.c
index 6cd971cd74..ab550259c8 100644
--- a/src/nvim/change.c
+++ b/src/nvim/change.c
@@ -589,7 +589,7 @@ bool file_ff_differs(buf_T *buf, bool ignore_empty)
/// Handles Replace mode and multi-byte characters.
void ins_bytes(char *p)
{
- ins_bytes_len(p, STRLEN(p));
+ ins_bytes_len(p, strlen(p));
}
/// Insert string "p" with length "len" at the cursor position.
@@ -632,7 +632,7 @@ void ins_char_bytes(char *buf, size_t charlen)
size_t col = (size_t)curwin->w_cursor.col;
linenr_T lnum = curwin->w_cursor.lnum;
char *oldp = ml_get(lnum);
- size_t linelen = STRLEN(oldp) + 1; // length of old line including NUL
+ size_t linelen = strlen(oldp) + 1; // length of old line including NUL
// The lengths default to the values for when not replacing.
size_t oldlen = 0; // nr of bytes inserted
@@ -731,7 +731,7 @@ void ins_char_bytes(char *buf, size_t charlen)
/// Caller must have prepared for undo.
void ins_str(char *s)
{
- int newlen = (int)STRLEN(s);
+ int newlen = (int)strlen(s);
linenr_T lnum = curwin->w_cursor.lnum;
if (virtual_active() && curwin->w_cursor.coladd > 0) {
@@ -740,7 +740,7 @@ void ins_str(char *s)
colnr_T col = curwin->w_cursor.col;
char *oldp = ml_get(lnum);
- int oldlen = (int)STRLEN(oldp);
+ int oldlen = (int)strlen(oldp);
char *newp = xmalloc((size_t)oldlen + (size_t)newlen + 1);
if (col > 0) {
@@ -798,7 +798,7 @@ int del_bytes(colnr_T count, bool fixpos_arg, bool use_delcombine)
colnr_T col = curwin->w_cursor.col;
bool fixpos = fixpos_arg;
char *oldp = ml_get(lnum);
- colnr_T oldlen = (colnr_T)STRLEN(oldp);
+ colnr_T oldlen = (colnr_T)strlen(oldp);
// Can't do anything when the cursor is on the NUL after the line.
if (col >= oldlen) {
@@ -962,7 +962,7 @@ int copy_indent(int size, char *src)
if (p == NULL) {
// Allocate memory for the result: the copied indent, new indent
// and the rest of the line.
- line_len = (int)STRLEN(get_cursor_line_ptr()) + 1;
+ line_len = (int)strlen(get_cursor_line_ptr()) + 1;
assert(ind_len + line_len >= 0);
size_t line_size;
STRICT_ADD(ind_len, line_len, &line_size, size_t);
@@ -1072,7 +1072,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
p = skipwhite(p_extra);
first_char = (unsigned char)(*p);
}
- extra_len = (int)STRLEN(p_extra);
+ extra_len = (int)strlen(p_extra);
saved_char = *p_extra;
*p_extra = NUL;
}
@@ -1155,7 +1155,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
}
} else { // Not a comment line
// Find last non-blank in line
- p = ptr + STRLEN(ptr) - 1;
+ p = ptr + strlen(ptr) - 1;
while (p > ptr && ascii_iswhite(*p)) {
p--;
}
@@ -1205,7 +1205,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
while ((ptr[0] == '#' || was_backslashed)
&& curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) {
- if (*ptr && ptr[STRLEN(ptr) - 1] == '\\') {
+ if (*ptr && ptr[strlen(ptr) - 1] == '\\') {
was_backslashed = true;
} else {
was_backslashed = false;
@@ -1331,7 +1331,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
if (lead_len > 0) {
if (current_flag == COM_START) {
lead_repl = (char *)lead_middle;
- lead_repl_len = (int)STRLEN(lead_middle);
+ lead_repl_len = (int)strlen(lead_middle);
}
// If we have hit RETURN immediately after the start
@@ -1641,7 +1641,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
if (flags & OPENLINE_COM_LIST && second_line_indent > 0) {
int i;
int padding = second_line_indent
- - (newindent + (int)STRLEN(leader));
+ - (newindent + (int)strlen(leader));
// Here whitespace is inserted after the comment char.
// Below, set_indent(newindent, SIN_INSERT) will insert the
@@ -1755,7 +1755,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
}
ml_replace(curwin->w_cursor.lnum, saved_line, false);
- int new_len = (int)STRLEN(saved_line);
+ int new_len = (int)strlen(saved_line);
// TODO(vigoux): maybe there is issues there with expandtabs ?
int cols_spliced = 0;
@@ -1795,7 +1795,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
if (did_append) {
changed_lines(curwin->w_cursor.lnum, 0, curwin->w_cursor.lnum, 1L, true);
// bail out and just get the final length of the line we just manipulated
- bcount_t extra = (bcount_t)STRLEN(ml_get(curwin->w_cursor.lnum));
+ bcount_t extra = (bcount_t)strlen(ml_get(curwin->w_cursor.lnum));
extmark_splice(curbuf, (int)curwin->w_cursor.lnum - 1, 0,
0, 0, 0, 1, 0, 1 + extra, kExtmarkUndo);
}
@@ -2084,7 +2084,7 @@ int get_last_leader_offset(char *line, char **flags)
char part_buf[COM_MAX_LEN]; // buffer for one option part
// Repeat to match several nested comment strings.
- int i = (int)STRLEN(line);
+ int i = (int)strlen(line);
while (--i >= lower_check_bound) {
// scan through the 'comments' option for a match
int found_one = false;
@@ -2171,7 +2171,7 @@ int get_last_leader_offset(char *line, char **flags)
while (ascii_iswhite(*com_leader)) {
com_leader++;
}
- len1 = (int)STRLEN(com_leader);
+ len1 = (int)strlen(com_leader);
for (list = curbuf->b_p_com; *list;) {
char *flags_save = list;
@@ -2185,7 +2185,7 @@ int get_last_leader_offset(char *line, char **flags)
while (ascii_iswhite(*string)) {
string++;
}
- len2 = (int)STRLEN(string);
+ len2 = (int)strlen(string);
if (len2 == 0) {
continue;
}
diff --git a/src/nvim/charset.c b/src/nvim/charset.c
index 693ff90179..0cc2189948 100644
--- a/src/nvim/charset.c
+++ b/src/nvim/charset.c
@@ -268,7 +268,7 @@ int buf_init_chartab(buf_T *buf, int global)
void trans_characters(char *buf, int bufsize)
{
char_u *trs; // translated character
- int len = (int)STRLEN(buf); // length of string needing translation
+ int len = (int)strlen(buf); // length of string needing translation
int room = bufsize - len; // room in buffer after string
while (*buf != 0) {
@@ -1078,7 +1078,7 @@ void getvvcol(win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor, colnr_T *e
// Cannot put the cursor on part of a wide character.
char *ptr = ml_get_buf(wp->w_buffer, pos->lnum, false);
- if (pos->col < (colnr_T)STRLEN(ptr)) {
+ if (pos->col < (colnr_T)strlen(ptr)) {
int c = utf_ptr2char(ptr + pos->col);
if ((c != TAB) && vim_isprintc(c)) {
endadd = (colnr_T)(char2cells(c) - 1);
@@ -1157,7 +1157,7 @@ char *skipwhite(const char *const p)
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL
FUNC_ATTR_NONNULL_RET
{
- return skipwhite_len(p, STRLEN(p));
+ return skipwhite_len(p, strlen(p));
}
/// Like `skipwhite`, but skip up to `len` characters.
diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c
index 3e9edea372..65b07cc17b 100644
--- a/src/nvim/cmdexpand.c
+++ b/src/nvim/cmdexpand.c
@@ -511,7 +511,7 @@ char *ExpandOne(expand_T *xp, char *str, char *orig, int options, int mode)
if (mode == WILD_ALL && xp->xp_numfiles > 0 && !got_int) {
size_t len = 0;
for (i = 0; i < xp->xp_numfiles; i++) {
- len += STRLEN(xp->xp_files[i]) + 1;
+ len += strlen(xp->xp_files[i]) + 1;
}
ss = xmalloc(len);
*ss = NUL;
@@ -672,7 +672,7 @@ int showmatches(expand_T *xp, int wildmenu)
for (k = i; k < num_files; k += lines) {
if (xp->xp_context == EXPAND_TAGS_LISTFILES) {
msg_outtrans_attr(files_found[k], HL_ATTR(HLF_D));
- p = (char_u *)files_found[k] + STRLEN(files_found[k]) + 1;
+ p = (char_u *)files_found[k] + strlen(files_found[k]) + 1;
msg_advance(maxlen + 1);
msg_puts((const char *)p);
msg_advance(maxlen + 3);
@@ -2280,7 +2280,7 @@ static void ExpandGeneric(expand_T *xp, regmatch_T *regmatch, int *num_file, cha
(*file)[count++] = str;
if (func == get_menu_names) {
// Test for separator added by get_menu_names().
- str += STRLEN(str) - 1;
+ str += strlen(str) - 1;
if (*str == '\001') {
*str = '.';
}
@@ -2362,7 +2362,7 @@ static void expand_shellcmd(char *filepat, int *num_file, char ***file, int flag
for (s = path;; s = e) {
e = vim_strchr(s, ENV_SEPCHAR);
if (e == NULL) {
- e = s + STRLEN(s);
+ e = s + strlen(s);
}
if (*s == NUL) {
@@ -2386,7 +2386,7 @@ static void expand_shellcmd(char *filepat, int *num_file, char ***file, int flag
}
STRLCPY(buf, s, l + 1);
add_pathsep(buf);
- l = STRLEN(buf);
+ l = strlen(buf);
STRLCPY(buf + l, pat, MAXPATHL - l);
// Expand matches in one directory of $PATH.
@@ -2493,7 +2493,7 @@ static int ExpandUserDefined(expand_T *xp, regmatch_T *regmatch, int *num_file,
for (char *s = retstr; *s != NUL; s = e) {
e = vim_strchr(s, '\n');
if (e == NULL) {
- e = s + STRLEN(s);
+ e = s + strlen(s);
}
const char keep = *e;
*e = NUL;
@@ -2584,7 +2584,7 @@ void globpath(char *path, char *file, garray_T *ga, int expand_options)
while (*path != NUL) {
// Copy one item of the path to buf[] and concatenate the file name.
copy_option_part(&path, (char *)buf, MAXPATHL, ",");
- if (STRLEN(buf) + STRLEN(file) + 2 < MAXPATHL) {
+ if (STRLEN(buf) + strlen(file) + 2 < MAXPATHL) {
add_pathsep((char *)buf);
STRCAT(buf, file); // NOLINT
@@ -2864,14 +2864,14 @@ void f_getcompletion(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
if (strcmp(type, "cmdline") == 0) {
set_one_cmd_context(&xpc, pattern);
- xpc.xp_pattern_len = STRLEN(xpc.xp_pattern);
- xpc.xp_col = (int)STRLEN(pattern);
+ xpc.xp_pattern_len = strlen(xpc.xp_pattern);
+ xpc.xp_col = (int)strlen(pattern);
goto theend;
}
ExpandInit(&xpc);
xpc.xp_pattern = (char *)pattern;
- xpc.xp_pattern_len = STRLEN(xpc.xp_pattern);
+ xpc.xp_pattern_len = strlen(xpc.xp_pattern);
xpc.xp_context = cmdcomplete_str_to_type(type);
if (xpc.xp_context == EXPAND_NOTHING) {
semsg(_(e_invarg2), type);
@@ -2880,17 +2880,17 @@ void f_getcompletion(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
if (xpc.xp_context == EXPAND_MENUS) {
set_context_in_menu_cmd(&xpc, "menu", xpc.xp_pattern, false);
- xpc.xp_pattern_len = STRLEN(xpc.xp_pattern);
+ xpc.xp_pattern_len = strlen(xpc.xp_pattern);
}
if (xpc.xp_context == EXPAND_CSCOPE) {
set_context_in_cscope_cmd(&xpc, (const char *)xpc.xp_pattern, CMD_cscope);
- xpc.xp_pattern_len = STRLEN(xpc.xp_pattern);
+ xpc.xp_pattern_len = strlen(xpc.xp_pattern);
}
if (xpc.xp_context == EXPAND_SIGN) {
set_context_in_sign_cmd(&xpc, xpc.xp_pattern);
- xpc.xp_pattern_len = STRLEN(xpc.xp_pattern);
+ xpc.xp_pattern_len = strlen(xpc.xp_pattern);
}
theend:
diff --git a/src/nvim/cmdhist.c b/src/nvim/cmdhist.c
index 3747c91c4f..5a59f09113 100644
--- a/src/nvim/cmdhist.c
+++ b/src/nvim/cmdhist.c
@@ -91,7 +91,7 @@ static char *(history_names[]) = {
char *get_history_arg(expand_T *xp, int idx)
{
const char *short_names = ":=@>?/";
- const int short_names_count = (int)STRLEN(short_names);
+ const int short_names_count = (int)strlen(short_names);
const int history_name_count = ARRAY_SIZE(history_names) - 1;
if (idx < short_names_count) {
@@ -312,7 +312,7 @@ void add_to_history(int histype, char *new_entry, int in_map, int sep)
hist_free_entry(hisptr);
// Store the separator after the NUL of the string.
- size_t len = STRLEN(new_entry);
+ size_t len = strlen(new_entry);
hisptr->hisstr = xstrnsave(new_entry, len + 2);
hisptr->timestamp = os_time();
hisptr->additional_elements = NULL;
@@ -644,8 +644,8 @@ void ex_history(exarg_T *eap)
snprintf((char *)IObuff, IOSIZE, "%c%6d ", i == idx ? '>' : ' ',
hist[i].hisnum);
if (vim_strsize(hist[i].hisstr) > Columns - 10) {
- trunc_string(hist[i].hisstr, (char *)IObuff + STRLEN(IObuff),
- Columns - 10, IOSIZE - (int)STRLEN(IObuff));
+ trunc_string(hist[i].hisstr, (char *)IObuff + strlen(IObuff),
+ Columns - 10, IOSIZE - (int)strlen(IObuff));
} else {
STRCAT(IObuff, hist[i].hisstr);
}
diff --git a/src/nvim/cursor.c b/src/nvim/cursor.c
index cd651fcf4c..6c0475822b 100644
--- a/src/nvim/cursor.c
+++ b/src/nvim/cursor.c
@@ -67,7 +67,7 @@ int coladvance_force(colnr_T wcol)
/// Try to advance the Cursor to the specified screen column.
/// If virtual editing: fine tune the cursor position.
/// Note that all virtual positions off the end of a line should share
-/// a curwin->w_cursor.col value (n.b. this is equal to STRLEN(line)),
+/// a curwin->w_cursor.col value (n.b. this is equal to strlen(line)),
/// beginning at coladd 0.
///
/// @return OK if desired column is reached, FAIL if not
@@ -346,7 +346,7 @@ void check_cursor_col_win(win_T *win)
colnr_T oldcoladd = win->w_cursor.col + win->w_cursor.coladd;
unsigned int cur_ve_flags = get_ve_flags();
- colnr_T len = (colnr_T)STRLEN(ml_get_buf(win->w_buffer, win->w_cursor.lnum, false));
+ colnr_T len = (colnr_T)strlen(ml_get_buf(win->w_buffer, win->w_cursor.lnum, false));
if (len == 0) {
win->w_cursor.col = 0;
} else if (win->w_cursor.col >= len) {
@@ -412,7 +412,7 @@ void check_visual_pos(void)
VIsual.col = 0;
VIsual.coladd = 0;
} else {
- int len = (int)STRLEN(ml_get(VIsual.lnum));
+ int len = (int)strlen(ml_get(VIsual.lnum));
if (VIsual.col > len) {
VIsual.col = len;
diff --git a/src/nvim/cursor_shape.c b/src/nvim/cursor_shape.c
index 73ad99876a..6f4f17659a 100644
--- a/src/nvim/cursor_shape.c
+++ b/src/nvim/cursor_shape.c
@@ -220,7 +220,7 @@ char *parse_shape_opt(int what)
endp = vim_strchr(p, '-');
if (commap == NULL) { // last part
if (endp == NULL) {
- endp = p + STRLEN(p); // find end of part
+ endp = p + strlen(p); // find end of part
}
} else if (endp > commap || endp == NULL) {
endp = commap;
diff --git a/src/nvim/diff.c b/src/nvim/diff.c
index c5092dc866..9446d35630 100644
--- a/src/nvim/diff.c
+++ b/src/nvim/diff.c
@@ -729,7 +729,7 @@ static int diff_write_buffer(buf_T *buf, diffin_T *din)
// xdiff requires one big block of memory with all the text.
for (linenr_T lnum = 1; lnum <= buf->b_ml.ml_line_count; lnum++) {
- len += (long)STRLEN(ml_get_buf(buf, lnum, false)) + 1;
+ len += (long)strlen(ml_get_buf(buf, lnum, false)) + 1;
}
char_u *ptr = try_malloc((size_t)len);
if (ptr == NULL) {
@@ -1128,7 +1128,7 @@ static int diff_file(diffio_T *dio)
return diff_file_internal(dio);
} else {
const size_t len = (strlen(tmp_orig) + strlen(tmp_new) + strlen(tmp_diff)
- + STRLEN(p_srr) + 27);
+ + strlen(p_srr) + 27);
char *const cmd = xmalloc(len);
// We don't want $DIFF_OPTIONS to get in the way.
@@ -1267,7 +1267,7 @@ void ex_diffpatch(exarg_T *eap)
emsg(_("E816: Cannot read patch output"));
} else {
if (curbuf->b_fname != NULL) {
- newname = xstrnsave(curbuf->b_fname, STRLEN(curbuf->b_fname) + 4);
+ newname = xstrnsave(curbuf->b_fname, strlen(curbuf->b_fname) + 4);
STRCAT(newname, ".new");
}
@@ -1429,7 +1429,7 @@ void diff_win_options(win_T *wp, int addbuf)
free_string_option(wp->w_p_fdc);
wp->w_p_fdc = xstrdup("2");
assert(diff_foldcolumn >= 0 && diff_foldcolumn <= 9);
- snprintf(wp->w_p_fdc, STRLEN(wp->w_p_fdc) + 1, "%d", diff_foldcolumn);
+ snprintf(wp->w_p_fdc, strlen(wp->w_p_fdc) + 1, "%d", diff_foldcolumn);
wp->w_p_fen = true;
wp->w_p_fdl = 0;
foldUpdateAll(wp);
@@ -2356,8 +2356,8 @@ bool diff_find_change(win_T *wp, linenr_T lnum, int *startp, int *endp)
// Search for end of difference, if any.
if ((line_org[si_org] != NUL) || (line_new[si_new] != NUL)) {
- ei_org = (int)STRLEN(line_org);
- ei_new = (int)STRLEN(line_new);
+ ei_org = (int)strlen(line_org);
+ ei_new = (int)strlen(line_new);
while (ei_org >= *startp
&& ei_new >= si_new
@@ -2564,7 +2564,7 @@ void ex_diffgetput(exarg_T *eap)
}
} else {
// Buffer number or pattern given. Ignore trailing white space.
- p = eap->arg + STRLEN(eap->arg);
+ p = eap->arg + strlen(eap->arg);
while (p > eap->arg && ascii_iswhite(p[-1])) {
p--;
}
diff --git a/src/nvim/digraph.c b/src/nvim/digraph.c
index 8e31d3feab..c0e7a6250e 100644
--- a/src/nvim/digraph.c
+++ b/src/nvim/digraph.c
@@ -1926,7 +1926,7 @@ void f_digraph_get(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
if (digraphs == NULL) {
return;
}
- if (STRLEN(digraphs) != 2) {
+ if (strlen(digraphs) != 2) {
semsg(_(e_digraph_must_be_just_two_characters_str), digraphs);
return;
}
@@ -2036,7 +2036,7 @@ char *keymap_init(void)
// Source the keymap file. It will contain a ":loadkeymap" command
// which will call ex_loadkeymap() below.
- buflen = STRLEN(curbuf->b_p_keymap) + STRLEN(p_enc) + 14;
+ buflen = strlen(curbuf->b_p_keymap) + strlen(p_enc) + 14;
buf = xmalloc(buflen);
// try finding "keymap/'keymap'_'encoding'.vim" in 'runtimepath'
@@ -2102,7 +2102,7 @@ void ex_loadkeymap(exarg_T *eap)
s = skiptowhite(p);
kp->to = xstrnsave(p, (size_t)(s - p));
- if ((STRLEN(kp->from) + STRLEN(kp->to) >= KMAP_LLEN)
+ if ((strlen(kp->from) + strlen(kp->to) >= KMAP_LLEN)
|| (*kp->from == NUL)
|| (*kp->to == NUL)) {
if (*kp->to == NUL) {
diff --git a/src/nvim/drawscreen.c b/src/nvim/drawscreen.c
index 5b83821927..957e8ae4da 100644
--- a/src/nvim/drawscreen.c
+++ b/src/nvim/drawscreen.c
@@ -1448,7 +1448,7 @@ win_update_start:
pos.lnum += cursor_above ? 1 : -1) {
colnr_T t;
- pos.col = (colnr_T)STRLEN(ml_get_buf(wp->w_buffer, pos.lnum, false));
+ pos.col = (colnr_T)strlen(ml_get_buf(wp->w_buffer, pos.lnum, false));
getvvcol(wp, &pos, NULL, NULL, &t);
if (toc < t) {
toc = t;
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 1a8030d511..a165078bdf 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -1773,7 +1773,7 @@ void truncate_spaces(char *line)
int i;
// find start of trailing white space
- for (i = (int)STRLEN(line) - 1; i >= 0 && ascii_iswhite(line[i]); i--) {
+ for (i = (int)strlen(line) - 1; i >= 0 && ascii_iswhite(line[i]); i--) {
if (State & REPLACE_FLAG) {
replace_join(0); // remove a NUL from the replace stack
}
@@ -2676,7 +2676,7 @@ int stuff_inserted(int c, long count, int no_esc)
// when the last char is either "0" or "^" it will be quoted if no ESC
// comes after it OR if it will inserted more than once and "ptr"
// starts with ^D. -- Acevedo
- last_ptr = (esc_ptr ? esc_ptr : ptr + STRLEN(ptr)) - 1;
+ last_ptr = (esc_ptr ? esc_ptr : ptr + strlen(ptr)) - 1;
if (last_ptr >= ptr && (*last_ptr == '0' || *last_ptr == '^')
&& (no_esc || (*ptr == Ctrl_D && count > 1))) {
last = *last_ptr;
@@ -2938,7 +2938,7 @@ static void replace_do_bs(int limit_col)
}
(void)del_char_after_col(limit_col);
if (l_State & VREPLACE_FLAG) {
- orig_len = (int)STRLEN(get_cursor_pos_ptr());
+ orig_len = (int)strlen(get_cursor_pos_ptr());
}
replace_push(cc);
replace_pop_ins();
@@ -3856,7 +3856,7 @@ static bool ins_bs(int c, int mode, int *inserted_space_p)
return false;
}
Insstart.lnum--;
- Insstart.col = (colnr_T)STRLEN(ml_get(Insstart.lnum));
+ Insstart.col = (colnr_T)strlen(ml_get(Insstart.lnum));
}
// In replace mode:
// cc < 0: NL was inserted, delete it
@@ -4674,7 +4674,7 @@ bool ins_eol(int c)
// NL in reverse insert will always start in the end of current line.
if (revins_on) {
- curwin->w_cursor.col += (colnr_T)STRLEN(get_cursor_pos_ptr());
+ curwin->w_cursor.col += (colnr_T)strlen(get_cursor_pos_ptr());
}
AppendToRedobuff(NL_STR);
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index ead01fcbad..1eaf29a4de 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -358,7 +358,7 @@ void eval_init(void)
for (size_t i = 0; i < ARRAY_SIZE(vimvars); i++) {
struct vimvar *p = &vimvars[i];
- assert(STRLEN(p->vv_name) <= VIMVAR_KEY_LEN);
+ assert(strlen(p->vv_name) <= VIMVAR_KEY_LEN);
STRCPY(p->vv_di.di_key, p->vv_name);
if (p->vv_flags & VV_RO) {
p->vv_di.di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
@@ -578,7 +578,7 @@ void var_redir_str(char *value, int value_len)
int len;
if (value_len == -1) {
- len = (int)STRLEN(value); // Append the entire string
+ len = (int)strlen(value); // Append the entire string
} else {
len = value_len; // Append only "value_len" characters
}
@@ -1078,7 +1078,7 @@ int call_vim_function(const char *func, int argc, typval_T *argv, typval_T *rett
FUNC_ATTR_NONNULL_ALL
{
int ret;
- int len = (int)STRLEN(func);
+ int len = (int)strlen(func);
partial_T *pt = NULL;
if (len >= 6 && !memcmp(func, "v:lua.", 6)) {
@@ -1667,7 +1667,7 @@ void set_var_lval(lval_T *lp, char *endp, typval_T *rettv, int copy, const bool
// handle +=, -=, *=, /=, %= and .=
di = NULL;
- if (get_var_tv(lp->ll_name, (int)STRLEN(lp->ll_name),
+ if (get_var_tv(lp->ll_name, (int)strlen(lp->ll_name),
&tv, &di, true, false) == OK) {
if ((di == NULL
|| (!var_check_ro(di->di_flags, lp->ll_name, TV_CSTRING)
@@ -1960,7 +1960,7 @@ void set_context_for_expression(expand_T *xp, char *arg, cmdidx_T cmdidx)
xp->xp_context = EXPAND_USER_VARS;
if (strpbrk(arg, "\"'+-*/%.=!?~|&$([<>,#") == NULL) {
// ":let var1 var2 ...": find last space.
- for (p = arg + STRLEN(arg); p >= arg;) {
+ for (p = arg + strlen(arg); p >= arg;) {
xp->xp_pattern = p;
MB_PTR_BACK(arg, p);
if (ascii_iswhite(*p)) {
@@ -2077,7 +2077,7 @@ static size_t varnamebuflen = 0;
char *cat_prefix_varname(int prefix, const char *name)
FUNC_ATTR_NONNULL_ALL
{
- size_t len = STRLEN(name) + 3;
+ size_t len = strlen(name) + 3;
if (len > varnamebuflen) {
xfree(varnamebuf);
@@ -3828,7 +3828,7 @@ static int get_string_tv(char **arg, typval_T *rettv, int evaluate)
if (p[1] != '*') {
flags |= FSK_SIMPLIFY;
}
- extra = trans_special((const char_u **)&p, STRLEN(p), (char_u *)name, flags, false, NULL);
+ extra = trans_special((const char_u **)&p, strlen(p), (char_u *)name, flags, false, NULL);
if (extra != 0) {
name += extra;
if (name >= rettv->vval.v_string + len) {
@@ -5019,7 +5019,7 @@ void common_function(typval_T *argvars, typval_T *rettv, bool is_funcref)
// printable text.
snprintf(sid_buf, sizeof(sid_buf), "<SNR>%" PRId64 "_",
(int64_t)current_sctx.sc_sid);
- name = xmalloc(STRLEN(sid_buf) + STRLEN(s + off) + 1);
+ name = xmalloc(strlen(sid_buf) + strlen(s + off) + 1);
STRCPY(name, sid_buf);
STRCAT(name, s + off);
} else {
@@ -5594,10 +5594,10 @@ void set_buffer_lines(buf_T *buf, linenr_T lnum_arg, bool append, const typval_T
if (!append && lnum <= curbuf->b_ml.ml_line_count) {
// Existing line, replace it.
- int old_len = (int)STRLEN(ml_get(lnum));
+ int old_len = (int)strlen(ml_get(lnum));
if (u_savesub(lnum) == OK
&& ml_replace(lnum, (char *)line, true) == OK) {
- inserted_bytes(lnum, 0, old_len, (int)STRLEN(line));
+ inserted_bytes(lnum, 0, old_len, (int)strlen(line));
if (is_curbuf && lnum == curwin->w_cursor.lnum) {
check_cursor_col();
}
@@ -5838,7 +5838,7 @@ bool callback_call(Callback *const callback, const int argcount_in, typval_T *co
switch (callback->type) {
case kCallbackFuncref:
name = callback->data.funcref;
- int len = (int)STRLEN(name);
+ int len = (int)strlen(name);
if (len >= 6 && !memcmp(name, "v:lua.", 6)) {
name += 6;
len = check_luafunc_name(name, false);
@@ -6365,7 +6365,7 @@ pos_T *var2fpos(const typval_T *const tv, const bool dollar_lnum, int *const ret
if (charcol) {
len = mb_charlen((char_u *)ml_get(pos.lnum));
} else {
- len = (int)STRLEN(ml_get(pos.lnum));
+ len = (int)strlen(ml_get(pos.lnum));
}
// We accept "$" for the column number: last column.
@@ -6451,7 +6451,7 @@ pos_T *var2fpos(const typval_T *const tv, const bool dollar_lnum, int *const ret
if (charcol) {
pos.col = (colnr_T)mb_charlen((char_u *)get_cursor_line_ptr());
} else {
- pos.col = (colnr_T)STRLEN(get_cursor_line_ptr());
+ pos.col = (colnr_T)strlen(get_cursor_line_ptr());
}
}
return &pos;
@@ -6621,7 +6621,7 @@ int get_name_len(const char **const arg, char **alias, bool evaluate, bool verbo
}
*alias = temp_string;
*arg = (const char *)skipwhite(p);
- return (int)STRLEN(temp_string);
+ return (int)strlen(temp_string);
}
len += get_id_len(arg);
@@ -6747,7 +6747,7 @@ static char *make_expanded_name(const char *in_start, char *expr_start, char *ex
char *temp_result = eval_to_string(expr_start + 1, &nextcmd, false);
if (temp_result != NULL && nextcmd == NULL) {
- retval = xmalloc(STRLEN(temp_result) + (size_t)(expr_start - in_start)
+ retval = xmalloc(strlen(temp_result) + (size_t)(expr_start - in_start)
+ (size_t)(in_end - expr_end) + 1);
STRCPY(retval, in_start);
STRCAT(retval, temp_result);
@@ -7015,7 +7015,7 @@ char *set_cmdarg(exarg_T *eap, char *oldarg)
len += 10; // " ++ff=unix"
}
if (eap->force_enc != 0) {
- len += STRLEN(eap->cmd + eap->force_enc) + 7;
+ len += strlen(eap->cmd + eap->force_enc) + 7;
}
if (eap->bad_char != 0) {
len += 7 + 4; // " ++bad=" + "keep" or "drop"
@@ -7037,20 +7037,20 @@ char *set_cmdarg(exarg_T *eap, char *oldarg)
}
if (eap->force_ff != 0) {
- snprintf(newval + STRLEN(newval), newval_len, " ++ff=%s",
+ snprintf(newval + strlen(newval), newval_len, " ++ff=%s",
eap->force_ff == 'u' ? "unix" :
eap->force_ff == 'd' ? "dos" : "mac");
}
if (eap->force_enc != 0) {
- snprintf(newval + STRLEN(newval), newval_len, " ++enc=%s",
+ snprintf(newval + strlen(newval), newval_len, " ++enc=%s",
eap->cmd + eap->force_enc);
}
if (eap->bad_char == BAD_KEEP) {
- STRCPY(newval + STRLEN(newval), " ++bad=keep");
+ STRCPY(newval + strlen(newval), " ++bad=keep");
} else if (eap->bad_char == BAD_DROP) {
- STRCPY(newval + STRLEN(newval), " ++bad=drop");
+ STRCPY(newval + strlen(newval), " ++bad=drop");
} else if (eap->bad_char != 0) {
- snprintf(newval + STRLEN(newval), newval_len, " ++bad=%c",
+ snprintf(newval + strlen(newval), newval_len, " ++bad=%c",
eap->bad_char);
}
vimvars[VV_CMDARG].vv_str = newval;
@@ -8073,7 +8073,7 @@ repeat:
// Append a path separator to a directory.
if (os_isdir(*fnamep)) {
// Make room for one or two extra characters.
- *fnamep = xstrnsave(*fnamep, STRLEN(*fnamep) + 2);
+ *fnamep = xstrnsave(*fnamep, strlen(*fnamep) + 2);
xfree(*bufp); // free any allocated file name
*bufp = *fnamep;
add_pathsep(*fnamep);
@@ -8113,7 +8113,7 @@ repeat:
home_replace(NULL, s, dirname, MAXPATHL, true);
xfree(s);
}
- size_t namelen = STRLEN(dirname);
+ size_t namelen = strlen(dirname);
// Do not call shorten_fname() here since it removes the prefix
// even though the path does not have a prefix.
@@ -8149,7 +8149,7 @@ repeat:
}
char *tail = path_tail(*fnamep);
- *fnamelen = STRLEN(*fnamep);
+ *fnamelen = strlen(*fnamep);
// ":h" - head, remove "/file_name", can be repeated
// Don't remove the first "/" or "c:\"
@@ -8266,7 +8266,7 @@ repeat:
*usedlen = (size_t)(p + 1 - src);
s = do_string_sub(str, pat, sub, NULL, flags);
*fnamep = s;
- *fnamelen = STRLEN(s);
+ *fnamelen = strlen(s);
xfree(*bufp);
*bufp = s;
didit = true;
@@ -8294,7 +8294,7 @@ repeat:
}
xfree(*bufp);
*bufp = *fnamep = p;
- *fnamelen = STRLEN(p);
+ *fnamelen = strlen(p);
*usedlen += 2;
}
@@ -8325,7 +8325,7 @@ char *do_string_sub(char *str, char *pat, char *sub, typval_T *expr, char *flags
regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING);
if (regmatch.regprog != NULL) {
char *tail = str;
- char *end = str + STRLEN(str);
+ char *end = str + strlen(str);
while (vim_regexec_nl(&regmatch, (char_u *)str, (colnr_T)(tail - str))) {
// Skip empty match except for first match.
if (regmatch.startp[0] == regmatch.endp[0]) {
@@ -8600,7 +8600,7 @@ void ex_checkhealth(exarg_T *eap)
return;
}
- size_t bufsize = STRLEN(eap->arg) + sizeof("call health#check('')");
+ size_t bufsize = strlen(eap->arg) + sizeof("call health#check('')");
char *buf = xmalloc(bufsize);
snprintf(buf, bufsize, "call health#check('%s')", eap->arg);
@@ -8626,8 +8626,8 @@ void invoke_prompt_callback(void)
}
char *text = ml_get(lnum);
char *prompt = (char *)prompt_text();
- if (STRLEN(text) >= STRLEN(prompt)) {
- text += STRLEN(prompt);
+ if (strlen(text) >= strlen(prompt)) {
+ text += strlen(prompt);
}
argv[0].v_type = VAR_STRING;
argv[0].vval.v_string = xstrdup(text);
diff --git a/src/nvim/eval/encode.c b/src/nvim/eval/encode.c
index bb514fba47..599bbae0f5 100644
--- a/src/nvim/eval/encode.c
+++ b/src/nvim/eval/encode.c
@@ -219,7 +219,7 @@ bool encode_vim_list_to_buf(const list_T *const list, size_t *const ret_len, cha
}
len++;
if (TV_LIST_ITEM_TV(li)->vval.v_string != NULL) {
- len += STRLEN(TV_LIST_ITEM_TV(li)->vval.v_string);
+ len += strlen(TV_LIST_ITEM_TV(li)->vval.v_string);
}
});
if (len) {
@@ -281,7 +281,7 @@ int encode_read_from_list(ListReaderState *const state, char *const buf, const s
state->offset = 0;
state->li_length = (TV_LIST_ITEM_TV(state->li)->vval.v_string == NULL
? 0
- : STRLEN(TV_LIST_ITEM_TV(state->li)->vval.v_string));
+ : strlen(TV_LIST_ITEM_TV(state->li)->vval.v_string));
}
}
*read_bytes = nbuf;
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c
index b59caab34f..96f0c0dcd2 100644
--- a/src/nvim/eval/funcs.c
+++ b/src/nvim/eval/funcs.c
@@ -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;
}
@@ -7808,7 +7808,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) {
@@ -8377,7 +8377,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) {
@@ -8483,7 +8483,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;
@@ -8623,7 +8623,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.
@@ -8754,7 +8754,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);
}
@@ -8820,7 +8820,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);
@@ -8879,7 +8879,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);
@@ -8916,7 +8916,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);
@@ -9470,7 +9470,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) {
@@ -9578,7 +9578,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;
}
diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c
index 70c9e02d5c..283dc23793 100644
--- a/src/nvim/eval/userfunc.c
+++ b/src/nvim/eval/userfunc.c
@@ -528,14 +528,14 @@ static char *fname_trans_sid(const char *const name, char *const fname_buf, char
} else {
snprintf(fname_buf + i, (size_t)(FLEN_FIXED + 1 - i), "%" PRId64 "_",
(int64_t)current_sctx.sc_sid);
- i = (int)STRLEN(fname_buf);
+ i = (int)strlen(fname_buf);
}
}
- if ((size_t)i + STRLEN(name + llen) < FLEN_FIXED) {
+ if ((size_t)i + strlen(name + llen) < FLEN_FIXED) {
STRCPY(fname_buf + i, name + llen);
fname = fname_buf;
} else {
- fname = xmalloc((size_t)i + STRLEN(name + llen) + 1);
+ fname = xmalloc((size_t)i + strlen(name + llen) + 1);
*tofree = fname;
memmove(fname, fname_buf, (size_t)i);
STRCPY(fname + i, name + llen);
@@ -1516,7 +1516,7 @@ int call_func(const char *funcname, int len, typval_T *rettv, int argcount_in, t
fp = find_func((char_u *)rfname);
}
// Try loading a package.
- if (fp == NULL && script_autoload((const char *)rfname, STRLEN(rfname),
+ if (fp == NULL && script_autoload((const char *)rfname, strlen(rfname),
true) && !aborting()) {
// Loaded a package, search for the function again.
fp = find_func((char_u *)rfname);
@@ -2167,7 +2167,7 @@ void ex_function(exarg_T *eap)
theline = line_arg;
p = vim_strchr(theline, '\n');
if (p == NULL) {
- line_arg += STRLEN(line_arg);
+ line_arg += strlen(line_arg);
} else {
*p = NUL;
line_arg = p + 1;
@@ -2209,14 +2209,14 @@ void ex_function(exarg_T *eap)
if (heredoc_trimmed == NULL
|| (is_heredoc && skipwhite(theline) == theline)
|| STRNCMP(theline, heredoc_trimmed,
- STRLEN(heredoc_trimmed)) == 0) {
+ strlen(heredoc_trimmed)) == 0) {
if (heredoc_trimmed == NULL) {
p = theline;
} else if (is_heredoc) {
p = skipwhite(theline) == theline
- ? theline : theline + STRLEN(heredoc_trimmed);
+ ? theline : theline + strlen(heredoc_trimmed);
} else {
- p = theline + STRLEN(heredoc_trimmed);
+ p = theline + strlen(heredoc_trimmed);
}
if (strcmp(p, skip_until) == 0) {
XFREE_CLEAR(skip_until);
@@ -2383,7 +2383,7 @@ void ex_function(exarg_T *eap)
// If there are no errors, add the function
if (fudi.fd_dict == NULL) {
- v = find_var((const char *)name, STRLEN(name), &ht, false);
+ v = find_var((const char *)name, strlen(name), &ht, false);
if (v != NULL && v->di_tv.v_type == VAR_FUNC) {
emsg_funcname(N_("E707: Function name conflicts with variable: %s"),
(char_u *)name);
@@ -2458,7 +2458,7 @@ void ex_function(exarg_T *eap)
// Check that the autoload name matches the script name.
int j = FAIL;
if (SOURCING_NAME != NULL) {
- scriptname = (char_u *)autoload_name((const char *)name, STRLEN(name));
+ scriptname = (char_u *)autoload_name((const char *)name, strlen(name));
p = vim_strchr((char *)scriptname, '/');
plen = (int)STRLEN(p);
slen = (int)STRLEN(SOURCING_NAME);
@@ -2474,7 +2474,7 @@ void ex_function(exarg_T *eap)
}
}
- fp = xcalloc(1, offsetof(ufunc_T, uf_name) + STRLEN(name) + 1);
+ fp = xcalloc(1, offsetof(ufunc_T, uf_name) + strlen(name) + 1);
if (fudi.fd_dict != NULL) {
if (fudi.fd_di == NULL) {
@@ -3085,7 +3085,7 @@ char *get_return_cmd(void *rettv)
STRCPY(IObuff, ":return ");
STRLCPY(IObuff + 8, s, IOSIZE - 8);
- if (STRLEN(s) + 8 >= IOSIZE) {
+ if (strlen(s) + 8 >= IOSIZE) {
STRCPY(IObuff + IOSIZE - 4, "...");
}
xfree(tofree);
diff --git a/src/nvim/eval/vars.c b/src/nvim/eval/vars.c
index 004a239fda..1c07fc4d45 100644
--- a/src/nvim/eval/vars.c
+++ b/src/nvim/eval/vars.c
@@ -710,7 +710,7 @@ static char *ex_let_one(char *arg, typval_T *const tv, const bool copy, const bo
}
}
if (p != NULL) {
- write_reg_contents(*arg == '@' ? '"' : *arg, p, (ssize_t)STRLEN(p), false);
+ write_reg_contents(*arg == '@' ? '"' : *arg, p, (ssize_t)strlen(p), false);
arg_end = arg + 1;
}
xfree(ptofree);
@@ -1801,7 +1801,7 @@ void f_setbufvar(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
// reset notion of buffer
aucmd_restbuf(&aco);
} else {
- const size_t varname_len = STRLEN(varname);
+ const size_t varname_len = strlen(varname);
char *const bufvarname = xmalloc(varname_len + 3);
buf_T *const save_curbuf = curbuf;
curbuf = buf;
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 96bef4902c..97080ad81d 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -330,7 +330,7 @@ static int linelen(int *has_tab)
first = skipwhite(line);
// find the character after the last non-blank character
- for (last = first + STRLEN(first);
+ for (last = first + strlen(first);
last > first && ascii_iswhite(last[-1]); last--) {}
char save = *last;
*last = NUL;
@@ -550,7 +550,7 @@ void ex_sort(exarg_T *eap)
// Also get the longest line length for allocating "sortbuf".
for (lnum = eap->line1; lnum <= eap->line2; lnum++) {
s = ml_get(lnum);
- len = (int)STRLEN(s);
+ len = (int)strlen(s);
if (maxlen < len) {
maxlen = len;
}
@@ -651,7 +651,7 @@ void ex_sort(exarg_T *eap)
}
s = ml_get(get_lnum);
- size_t bytelen = STRLEN(s) + 1; // include EOL in bytelen
+ size_t bytelen = strlen(s) + 1; // include EOL in bytelen
old_count += (bcount_t)bytelen;
if (!unique || i == 0 || string_compare(s, sortbuf1) != 0) {
// Copy the line into a buffer, it may become invalid in
@@ -796,7 +796,7 @@ void ex_retab(exarg_T *eap)
// len is actual number of white characters used
len = num_spaces + num_tabs;
- old_len = (long)STRLEN(ptr);
+ old_len = (long)strlen(ptr);
const long new_len = old_len - col + start_col + len + 1;
if (new_len <= 0 || new_len >= MAXCOL) {
emsg(_(e_resulting_text_too_long));
@@ -1142,9 +1142,9 @@ void do_bang(int addr_count, exarg_T *eap, bool forceit, bool do_in, bool do_out
bool ins_prevcmd = forceit;
trailarg = arg;
do {
- len = STRLEN(trailarg) + 1;
+ len = strlen(trailarg) + 1;
if (newcmd != NULL) {
- len += STRLEN(newcmd);
+ len += strlen(newcmd);
}
if (ins_prevcmd) {
if (prevcmd == NULL) {
@@ -1152,7 +1152,7 @@ void do_bang(int addr_count, exarg_T *eap, bool forceit, bool do_in, bool do_out
xfree(newcmd);
return;
}
- len += STRLEN(prevcmd);
+ len += strlen(prevcmd);
}
t = xmalloc(len);
*t = NUL;
@@ -1162,7 +1162,7 @@ void do_bang(int addr_count, exarg_T *eap, bool forceit, bool do_in, bool do_out
if (ins_prevcmd) {
STRCAT(t, prevcmd);
}
- p = t + STRLEN(t);
+ p = t + strlen(t);
STRCAT(t, trailarg);
xfree(newcmd);
newcmd = t;
@@ -1201,7 +1201,7 @@ void do_bang(int addr_count, exarg_T *eap, bool forceit, bool do_in, bool do_out
}
// Add quotes around the command, for shells that need them.
if (*p_shq != NUL) {
- newcmd = xmalloc(STRLEN(prevcmd) + 2 * STRLEN(p_shq) + 1);
+ newcmd = xmalloc(strlen(prevcmd) + 2 * STRLEN(p_shq) + 1);
STRCPY(newcmd, p_shq);
STRCAT(newcmd, prevcmd);
STRCAT(newcmd, p_shq);
@@ -1542,23 +1542,23 @@ char *make_filter_cmd(char *cmd, char *itmp, char *otmp)
bool is_pwsh = STRNCMP(invocation_path_tail((char_u *)p_sh, NULL), "pwsh", 4) == 0
|| STRNCMP(invocation_path_tail((char_u *)p_sh, NULL), "powershell", 10) == 0;
- size_t len = STRLEN(cmd) + 1; // At least enough space for cmd + NULL.
+ size_t len = strlen(cmd) + 1; // At least enough space for cmd + NULL.
len += is_fish_shell ? sizeof("begin; " "; end") - 1
: is_pwsh ? sizeof("Start-Process ")
: sizeof("(" ")") - 1;
if (itmp != NULL) {
- len += is_pwsh ? STRLEN(itmp) + sizeof(" -RedirectStandardInput ")
- : STRLEN(itmp) + sizeof(" { " " < " " } ") - 1;
+ len += is_pwsh ? strlen(itmp) + sizeof(" -RedirectStandardInput ")
+ : strlen(itmp) + sizeof(" { " " < " " } ") - 1;
}
if (otmp != NULL) {
- len += STRLEN(otmp) + STRLEN(p_srr) + 2; // two extra spaces (" "),
+ len += strlen(otmp) + strlen(p_srr) + 2; // two extra spaces (" "),
}
const char *const cmd_args = strchr(cmd, ' ');
len += (is_pwsh && cmd_args)
- ? STRLEN(" -ArgumentList ") + 2 // two extra quotes
+ ? strlen(" -ArgumentList ") + 2 // two extra quotes
: 0;
char *const buf = xmalloc(len);
@@ -1568,7 +1568,7 @@ char *make_filter_cmd(char *cmd, char *itmp, char *otmp)
if (cmd_args == NULL) {
xstrlcat(buf, cmd, len);
} else {
- xstrlcpy(buf + STRLEN(buf), cmd, (size_t)(cmd_args - cmd + 1));
+ xstrlcpy(buf + strlen(buf), cmd, (size_t)(cmd_args - cmd + 1));
xstrlcat(buf, " -ArgumentList \"", len);
xstrlcat(buf, cmd_args + 1, len); // +1 to skip the leading space.
xstrlcat(buf, "\"", len);
@@ -2372,7 +2372,7 @@ int do_ecmd(int fnum, char *ffname, char *sfname, exarg_T *eap, linenr_T newlnum
if ((command != NULL || newlnum > (linenr_T)0)
&& *get_vim_var_str(VV_SWAPCOMMAND) == NUL) {
// Set v:swapcommand for the SwapExists autocommands.
- const size_t len = (command != NULL) ? STRLEN(command) + 3 : 30;
+ const size_t len = (command != NULL) ? strlen(command) + 3 : 30;
char *const p = xmalloc(len);
if (command != NULL) {
vim_snprintf(p, len, ":%s\r", command);
@@ -2941,7 +2941,7 @@ void ex_append(exarg_T *eap)
}
p = vim_strchr(eap->nextcmd, NL);
if (p == NULL) {
- p = eap->nextcmd + STRLEN(eap->nextcmd);
+ p = eap->nextcmd + strlen(eap->nextcmd);
}
theline = xstrnsave(eap->nextcmd, (size_t)(p - eap->nextcmd));
if (*p != NUL) {
@@ -3329,7 +3329,7 @@ static char *sub_grow_buf(char **new_start, int needed_len)
// Check if the temporary buffer is long enough to do the
// substitution into. If not, make it larger (with a bit
// extra to avoid too many calls to xmalloc()/free()).
- size_t len = STRLEN(*new_start);
+ size_t len = strlen(*new_start);
needed_len += (int)len;
if (needed_len > new_start_len) {
new_start_len = needed_len + 50;
@@ -3777,7 +3777,7 @@ static int do_sub(exarg_T *eap, proftime_T timeout, long cmdpreview_ns, handle_T
// we continue looking for a match on the next line.
// Avoids that ":s/\nB\@=//gc" get stuck.
if (nmatch > 1) {
- matchcol = (colnr_T)STRLEN(sub_firstline);
+ matchcol = (colnr_T)strlen(sub_firstline);
nmatch = 1;
skip_match = true;
}
@@ -3878,7 +3878,7 @@ static int do_sub(exarg_T *eap, proftime_T timeout, long cmdpreview_ns, handle_T
// Position the cursor relative to the end of the line, the
// previous substitute may have inserted or deleted characters
// before the cursor.
- len_change = (int)STRLEN(new_line) - (int)STRLEN(orig_line);
+ len_change = (int)strlen(new_line) - (int)strlen(orig_line);
curwin->w_cursor.col += len_change;
ml_replace(lnum, new_line, false);
}
@@ -3971,7 +3971,7 @@ static int do_sub(exarg_T *eap, proftime_T timeout, long cmdpreview_ns, handle_T
// Avoids that ":%s/\nB\@=//gc" and ":%s/\n/,\r/gc"
// get stuck when pressing 'n'.
if (nmatch > 1) {
- matchcol = (colnr_T)STRLEN(sub_firstline);
+ matchcol = (colnr_T)strlen(sub_firstline);
skip_match = true;
}
goto skip;
@@ -4081,7 +4081,7 @@ static int do_sub(exarg_T *eap, proftime_T timeout, long cmdpreview_ns, handle_T
}
size_t copy_len = (size_t)(regmatch.startpos[0].col - copycol);
new_end = sub_grow_buf(&new_start,
- (colnr_T)STRLEN(p1) - regmatch.endpos[0].col
+ (colnr_T)strlen(p1) - regmatch.endpos[0].col
+ (colnr_T)copy_len + sublen + 1);
// copy the text up to the part that matched
@@ -4115,7 +4115,7 @@ static int do_sub(exarg_T *eap, proftime_T timeout, long cmdpreview_ns, handle_T
bcount_t replaced_bytes = 0;
lpos_T start = regmatch.startpos[0], end = regmatch.endpos[0];
for (i = 0; i < nmatch - 1; i++) {
- replaced_bytes += (bcount_t)STRLEN(ml_get((linenr_T)(lnum_start + i))) + 1;
+ replaced_bytes += (bcount_t)strlen(ml_get((linenr_T)(lnum_start + i))) + 1;
}
replaced_bytes += end.col - start.col;
@@ -4158,7 +4158,7 @@ static int do_sub(exarg_T *eap, proftime_T timeout, long cmdpreview_ns, handle_T
p1 += utfc_ptr2len(p1) - 1;
}
}
- colnr_T new_endcol = (colnr_T)STRLEN(new_start);
+ colnr_T new_endcol = (colnr_T)strlen(new_start);
current_match.end.col = new_endcol;
current_match.end.lnum = lnum;
@@ -4214,8 +4214,8 @@ skip:
// have changed the number of characters. Same for
// "prev_matchcol".
STRCAT(new_start, sub_firstline + copycol);
- matchcol = (colnr_T)STRLEN(sub_firstline) - matchcol;
- prev_matchcol = (colnr_T)STRLEN(sub_firstline)
+ matchcol = (colnr_T)strlen(sub_firstline) - matchcol;
+ prev_matchcol = (colnr_T)strlen(sub_firstline)
- prev_matchcol;
if (u_savesub(lnum) != OK) {
@@ -4260,8 +4260,8 @@ skip:
xfree(sub_firstline); // free the temp buffer
sub_firstline = new_start;
new_start = NULL;
- matchcol = (colnr_T)STRLEN(sub_firstline) - matchcol;
- prev_matchcol = (colnr_T)STRLEN(sub_firstline)
+ matchcol = (colnr_T)strlen(sub_firstline) - matchcol;
+ prev_matchcol = (colnr_T)strlen(sub_firstline)
- prev_matchcol;
copycol = 0;
}
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index e551cbee0b..1248251556 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -703,7 +703,7 @@ void ex_compiler(exarg_T *eap)
do_cmdline_cmd("echo globpath(&rtp, 'compiler/*.vim')"); // NOLINT
do_cmdline_cmd("echo globpath(&rtp, 'compiler/*.lua')"); // NOLINT
} else {
- size_t bufsize = STRLEN(eap->arg) + 14;
+ size_t bufsize = strlen(eap->arg) + 14;
buf = xmalloc(bufsize);
if (eap->forceit) {
// ":compiler! {name}" sets global options
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 5defabc05a..52841b6021 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -1302,7 +1302,7 @@ static void parse_register(exarg_T *eap)
if (!eap->skip) {
set_expr_line(xstrdup(eap->arg));
}
- eap->arg += STRLEN(eap->arg);
+ eap->arg += strlen(eap->arg);
}
eap->arg = skipwhite(eap->arg);
}
@@ -1536,7 +1536,7 @@ static int execute_cmd0(int *retv, exarg_T *eap, char **errormsg, bool preview)
|| eap->cmdidx == CMD_bunload) {
p = skiptowhite_esc(eap->arg);
} else {
- p = eap->arg + STRLEN(eap->arg);
+ p = eap->arg + strlen(eap->arg);
while (p > eap->arg && ascii_iswhite(p[-1])) {
p--;
}
@@ -2824,7 +2824,7 @@ bool checkforcmd(char **pp, char *cmd, int len)
/// invisible otherwise.
static void append_command(char *cmd)
{
- size_t len = STRLEN(IObuff);
+ size_t len = strlen(IObuff);
char *s = cmd;
char *d;
@@ -3666,7 +3666,7 @@ char *replace_makeprg(exarg_T *eap, char *arg, char **cmdlinep)
// Replace $* by given arguments
if ((new_cmdline = strrep(program, "$*", arg)) == NULL) {
// No $* in arg, build "<makeprg> <arg>" instead
- new_cmdline = xmalloc(STRLEN(program) + STRLEN(arg) + 2);
+ new_cmdline = xmalloc(strlen(program) + strlen(arg) + 2);
STRCPY(new_cmdline, program);
STRCAT(new_cmdline, " ");
STRCAT(new_cmdline, arg);
@@ -3805,7 +3805,7 @@ int expand_filename(exarg_T *eap, char **cmdlinep, char **errormsgp)
p = NULL;
}
if (p != NULL) {
- (void)repl_cmdline(eap, eap->arg, STRLEN(eap->arg), p, cmdlinep);
+ (void)repl_cmdline(eap, eap->arg, strlen(eap->arg), p, cmdlinep);
}
}
@@ -3833,7 +3833,7 @@ int expand_filename(exarg_T *eap, char **cmdlinep, char **errormsgp)
if (p == NULL) {
return FAIL;
}
- (void)repl_cmdline(eap, eap->arg, STRLEN(eap->arg), p, cmdlinep);
+ (void)repl_cmdline(eap, eap->arg, strlen(eap->arg), p, cmdlinep);
xfree(p);
}
}
@@ -3851,10 +3851,10 @@ static char *repl_cmdline(exarg_T *eap, char *src, size_t srclen, char *repl, ch
// The new command line is build in new_cmdline[].
// First allocate it.
// Careful: a "+cmd" argument may have been NUL terminated.
- size_t len = STRLEN(repl);
- size_t i = (size_t)(src - *cmdlinep) + STRLEN(src + srclen) + len + 3;
+ size_t len = strlen(repl);
+ size_t i = (size_t)(src - *cmdlinep) + strlen(src + srclen) + len + 3;
if (eap->nextcmd != NULL) {
- i += STRLEN(eap->nextcmd); // add space for next command
+ i += strlen(eap->nextcmd); // add space for next command
}
char *new_cmdline = xmalloc(i);
size_t offset = (size_t)(src - *cmdlinep);
@@ -3872,7 +3872,7 @@ static char *repl_cmdline(exarg_T *eap, char *src, size_t srclen, char *repl, ch
src = new_cmdline + i; // remember where to continue
if (eap->nextcmd != NULL) { // append next command
- i = STRLEN(new_cmdline) + 1;
+ i = strlen(new_cmdline) + 1;
STRCPY(new_cmdline + i, eap->nextcmd);
eap->nextcmd = new_cmdline + i;
}
@@ -4913,7 +4913,7 @@ void ex_splitview(exarg_T *eap)
}
if (eap->cmdidx == CMD_sfind || eap->cmdidx == CMD_tabfind) {
- fname = (char *)find_file_in_path((char_u *)eap->arg, STRLEN(eap->arg),
+ fname = (char *)find_file_in_path((char_u *)eap->arg, strlen(eap->arg),
FNAME_MESS, true, (char_u *)curbuf->b_ffname);
if (fname == NULL) {
goto theend;
@@ -5106,7 +5106,7 @@ static void ex_resize(exarg_T *eap)
/// ":find [+command] <file>" command.
static void ex_find(exarg_T *eap)
{
- char *fname = (char *)find_file_in_path((char_u *)eap->arg, STRLEN(eap->arg),
+ char *fname = (char *)find_file_in_path((char_u *)eap->arg, strlen(eap->arg),
FNAME_MESS, true, (char_u *)curbuf->b_ffname);
if (eap->addr_count > 0) {
// Repeat finding the file "count" times. This matters when it
@@ -6292,7 +6292,7 @@ static void ex_normal(exarg_T *eap)
}
}
if (len > 0) {
- arg = xmalloc(STRLEN(eap->arg) + (size_t)len + 1);
+ arg = xmalloc(strlen(eap->arg) + (size_t)len + 1);
len = 0;
for (p = eap->arg; *p != NUL; p++) {
arg[len++] = *p;
@@ -6471,7 +6471,7 @@ static void ex_findpat(exarg_T *eap)
}
}
if (!eap->skip) {
- find_pattern_in_path((char_u *)eap->arg, 0, STRLEN(eap->arg), whole, !eap->forceit,
+ find_pattern_in_path((char_u *)eap->arg, 0, strlen(eap->arg), whole, !eap->forceit,
*eap->cmd == 'd' ? FIND_DEFINE : FIND_ANY,
n, action, eap->line1, eap->line2);
}
@@ -6612,7 +6612,7 @@ ssize_t find_cmdline_var(const char_u *src, size_t *usedlen)
};
for (size_t i = 0; i < ARRAY_SIZE(spec_str); i++) {
- size_t len = STRLEN(spec_str[i]);
+ size_t len = strlen(spec_str[i]);
if (STRNCMP(src, spec_str[i], len) == 0) {
*usedlen = len;
assert(i <= SSIZE_MAX);
@@ -6879,7 +6879,7 @@ char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnum
}
// Length of new string.
- resultlen = STRLEN(result);
+ resultlen = strlen(result);
// Remove the file name extension.
if (src[*usedlen] == '<') {
(*usedlen)++;
@@ -6942,11 +6942,11 @@ char *expand_sfile(char *arg)
p += srclen;
continue;
}
- size_t len = STRLEN(result) - srclen + STRLEN(repl) + 1;
+ size_t len = strlen(result) - srclen + strlen(repl) + 1;
char *newres = xmalloc(len);
memmove(newres, result, (size_t)(p - result));
STRCPY(newres + (p - result), repl);
- len = STRLEN(newres);
+ len = strlen(newres);
STRCAT(newres, p + srclen);
xfree(repl);
xfree(result);
diff --git a/src/nvim/ex_eval.c b/src/nvim/ex_eval.c
index f40149d07a..c2648b9bfc 100644
--- a/src/nvim/ex_eval.c
+++ b/src/nvim/ex_eval.c
@@ -376,13 +376,13 @@ char *get_exception_string(void *value, except_type_T type, char *cmdname, int *
*should_free = true;
mesg = ((msglist_T *)value)->throw_msg;
if (cmdname != NULL && *cmdname != NUL) {
- size_t cmdlen = STRLEN(cmdname);
- ret = xstrnsave("Vim(", 4 + cmdlen + 2 + STRLEN(mesg));
+ size_t cmdlen = strlen(cmdname);
+ ret = xstrnsave("Vim(", 4 + cmdlen + 2 + strlen(mesg));
STRCPY(&ret[4], cmdname);
STRCPY(&ret[4 + cmdlen], "):");
val = ret + 4 + cmdlen + 2;
} else {
- ret = xstrnsave("Vim:", 4 + STRLEN(mesg));
+ ret = xstrnsave("Vim:", 4 + strlen(mesg));
val = ret + 4;
}
@@ -410,7 +410,7 @@ char *get_exception_string(void *value, except_type_T type, char *cmdname, int *
STRCAT(val, p);
p[-2] = NUL;
- snprintf(val + STRLEN(p), strlen(" (%s)"), " (%s)", &mesg[1]);
+ snprintf(val + strlen(p), strlen(" (%s)"), " (%s)", &mesg[1]);
p[-2] = '"';
}
break;
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 2b7797ddc8..4a398badec 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -1411,7 +1411,7 @@ static int may_do_command_line_next_incsearch(int firstc, long count, incsearch_
static void command_line_next_histidx(CommandLineState *s, bool next_match)
{
- int j = (int)STRLEN(s->lookfor);
+ int j = (int)strlen(s->lookfor);
for (;;) {
// one step backwards
if (!next_match) {
@@ -1920,7 +1920,7 @@ static int command_line_handle_key(CommandLineState *s)
STRCPY(ccline.cmdbuff, p);
}
- ccline.cmdpos = ccline.cmdlen = (int)STRLEN(ccline.cmdbuff);
+ ccline.cmdpos = ccline.cmdlen = (int)strlen(ccline.cmdbuff);
redrawcmd();
return command_line_changed(s);
}
@@ -2027,7 +2027,7 @@ static int command_line_not_changed(CommandLineState *s)
/// as a trailing \|, which can happen while typing a pattern.
static int empty_pattern(char *p)
{
- size_t n = STRLEN(p);
+ size_t n = strlen(p);
// remove trailing \v and the like
while (n >= 2 && p[n - 2] == '\\'
@@ -2803,7 +2803,7 @@ static void color_expr_cmdline(const CmdlineInfo *const colored_ccline,
ParserLine parser_lines[] = {
{
.data = (const char *)colored_ccline->cmdbuff,
- .size = STRLEN(colored_ccline->cmdbuff),
+ .size = strlen(colored_ccline->cmdbuff),
.allocated = false,
},
{ NULL, 0, false },
@@ -3377,7 +3377,7 @@ void unputcmdline(void)
}
// Put the given string, of the given length, onto the command line.
-// If len is -1, then STRLEN() is used to calculate the length.
+// If len is -1, then strlen() is used to calculate the length.
// If 'redraw' is true then the new part of the command line, and the remaining
// part will be redrawn, otherwise it will not. If this function is called
// twice in a row, then 'redraw' should be false and redrawcmd() should be
@@ -3863,7 +3863,7 @@ char *vim_strsave_fnameescape(const char *const fname, const int what)
/// Put a backslash before the file name in "pp", which is in allocated memory.
void escape_fname(char **pp)
{
- char_u *p = xmalloc(STRLEN(*pp) + 2);
+ char_u *p = xmalloc(strlen(*pp) + 2);
p[0] = '\\';
STRCPY(p + 1, *pp);
xfree(*pp);
@@ -4010,7 +4010,7 @@ static int set_cmdline_str(const char *str, int pos)
return 1;
}
- int len = (int)STRLEN(str);
+ int len = (int)strlen(str);
realloc_cmdbuff(len + 1);
p->cmdlen = len;
STRCPY(p->cmdbuff, str);
@@ -4347,7 +4347,7 @@ static int open_cmdwin(void)
ccline.cmdpos = 0;
cmdwin_result = Ctrl_C;
} else {
- ccline.cmdlen = (int)STRLEN(ccline.cmdbuff);
+ ccline.cmdlen = (int)strlen(ccline.cmdbuff);
ccline.cmdbufflen = ccline.cmdlen + 1;
ccline.cmdpos = curwin->w_cursor.col;
if (ccline.cmdpos > ccline.cmdlen) {
@@ -4420,7 +4420,7 @@ char *script_get(exarg_T *const eap, size_t *const lenp)
const char *const cmd = (const char *)eap->arg;
if (cmd[0] != '<' || cmd[1] != '<' || eap->getline == NULL) {
- *lenp = STRLEN(eap->arg);
+ *lenp = strlen(eap->arg);
return eap->skip ? NULL : xmemdupz(eap->arg, *lenp);
}
diff --git a/src/nvim/file_search.c b/src/nvim/file_search.c
index b3491e98c2..ff23fdf66f 100644
--- a/src/nvim/file_search.c
+++ b/src/nvim/file_search.c
@@ -433,16 +433,16 @@ void *vim_findfile_init(char *path, char *filename, char *stopdirs, int level, i
}
// create an absolute path
- if (STRLEN(search_ctx->ffsc_start_dir)
- + STRLEN(search_ctx->ffsc_fix_path) + 3 >= MAXPATHL) {
+ if (strlen(search_ctx->ffsc_start_dir)
+ + strlen(search_ctx->ffsc_fix_path) + 3 >= MAXPATHL) {
emsg(_(e_pathtoolong));
goto error_return;
}
STRCPY(ff_expand_buffer, search_ctx->ffsc_start_dir);
add_pathsep(ff_expand_buffer);
{
- size_t eb_len = STRLEN(ff_expand_buffer);
- char_u *buf = xmalloc(eb_len + STRLEN(search_ctx->ffsc_fix_path) + 1);
+ size_t eb_len = strlen(ff_expand_buffer);
+ char_u *buf = xmalloc(eb_len + strlen(search_ctx->ffsc_fix_path) + 1);
STRCPY(buf, ff_expand_buffer);
STRCPY(buf + eb_len, search_ctx->ffsc_fix_path);
@@ -466,13 +466,13 @@ void *vim_findfile_init(char *path, char *filename, char *stopdirs, int level, i
xstrlcat(ff_expand_buffer, search_ctx->ffsc_fix_path, eb_len + (size_t)len + 1);
add_pathsep(ff_expand_buffer);
} else {
- len = (int)STRLEN(search_ctx->ffsc_fix_path);
+ len = (int)strlen(search_ctx->ffsc_fix_path);
}
if (search_ctx->ffsc_wc_path != NULL) {
wc_path = xstrdup(search_ctx->ffsc_wc_path);
- temp = xmalloc(STRLEN(search_ctx->ffsc_wc_path)
- + STRLEN(search_ctx->ffsc_fix_path + len)
+ temp = xmalloc(strlen(search_ctx->ffsc_wc_path)
+ + strlen(search_ctx->ffsc_fix_path + len)
+ 1);
STRCPY(temp, search_ctx->ffsc_fix_path + len);
STRCAT(temp, search_ctx->ffsc_wc_path);
@@ -569,7 +569,7 @@ char_u *vim_findfile(void *search_ctx_arg)
// store the end of the start dir -- needed for upward search
if (search_ctx->ffsc_start_dir != NULL) {
- path_end = (char_u *)&search_ctx->ffsc_start_dir[STRLEN(search_ctx->ffsc_start_dir)];
+ path_end = (char_u *)&search_ctx->ffsc_start_dir[strlen(search_ctx->ffsc_start_dir)];
}
// upward search loop
@@ -652,7 +652,7 @@ char_u *vim_findfile(void *search_ctx_arg)
// if we have a start dir copy it in
if (!vim_isAbsName(stackp->ffs_fix_path)
&& search_ctx->ffsc_start_dir) {
- if (STRLEN(search_ctx->ffsc_start_dir) + 1 >= MAXPATHL) {
+ if (strlen(search_ctx->ffsc_start_dir) + 1 >= MAXPATHL) {
ff_free_stack_element(stackp);
goto fail;
}
@@ -758,8 +758,8 @@ char_u *vim_findfile(void *search_ctx_arg)
continue; // not a directory
}
// prepare the filename to be checked for existence below
- if (STRLEN(stackp->ffs_filearray[i]) + 1
- + STRLEN(search_ctx->ffsc_file_to_search) >= MAXPATHL) {
+ if (strlen(stackp->ffs_filearray[i]) + 1
+ + strlen(search_ctx->ffsc_file_to_search) >= MAXPATHL) {
ff_free_stack_element(stackp);
goto fail;
}
@@ -902,8 +902,8 @@ char_u *vim_findfile(void *search_ctx_arg)
break;
}
- if (STRLEN(search_ctx->ffsc_start_dir) + 1
- + STRLEN(search_ctx->ffsc_fix_path) >= MAXPATHL) {
+ if (strlen(search_ctx->ffsc_start_dir) + 1
+ + strlen(search_ctx->ffsc_fix_path) >= MAXPATHL) {
goto fail;
}
STRCPY(file_path, search_ctx->ffsc_start_dir);
@@ -1091,7 +1091,7 @@ static int ff_check_visited(ff_visited_T **visited_list, char *fname, char *wc_p
}
// New file/dir. Add it to the list of visited files/dirs.
- vp = xmalloc(sizeof(ff_visited_T) + STRLEN(ff_expand_buffer));
+ vp = xmalloc(sizeof(ff_visited_T) + strlen(ff_expand_buffer));
if (!url) {
vp->file_id_valid = true;
@@ -1397,7 +1397,7 @@ char_u *find_file_in_path_option(char_u *ptr, size_t len, int options, int first
// When FNAME_REL flag given first use the directory of the file.
// Otherwise or when this fails use the current directory.
for (int run = 1; run <= 2; run++) {
- size_t l = STRLEN(ff_file_to_find);
+ size_t l = strlen(ff_file_to_find);
if (run == 1
&& rel_to_curdir
&& (options & FNAME_REL)
@@ -1405,7 +1405,7 @@ char_u *find_file_in_path_option(char_u *ptr, size_t len, int options, int first
&& STRLEN(rel_fname) + l < MAXPATHL) {
STRCPY(NameBuff, rel_fname);
STRCPY(path_tail((char *)NameBuff), ff_file_to_find);
- l = STRLEN(NameBuff);
+ l = strlen(NameBuff);
} else {
STRCPY(NameBuff, ff_file_to_find);
run = 2;
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index 0bc7f736bc..f2db4086c1 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -346,7 +346,7 @@ int readfile(char *fname, char *sfname, linenr_T from, linenr_T lines_to_skip,
}
// If the name is too long we might crash further on, quit here.
if (fname != NULL && *fname != NUL) {
- size_t namelen = STRLEN(fname);
+ size_t namelen = strlen(fname);
// If the name is too long we might crash further on, quit here.
if (namelen >= MAXPATHL) {
@@ -1782,12 +1782,12 @@ failed:
c = true;
}
if (conv_error != 0) {
- sprintf((char *)IObuff + STRLEN(IObuff),
- _("[CONVERSION ERROR in line %" PRId64 "]"), (int64_t)conv_error);
+ snprintf(IObuff + strlen(IObuff), IOSIZE - strlen(IObuff),
+ _("[CONVERSION ERROR in line %" PRId64 "]"), (int64_t)conv_error);
c = true;
} else if (illegal_byte > 0) {
- sprintf((char *)IObuff + STRLEN(IObuff),
- _("[ILLEGAL BYTE in line %" PRId64 "]"), (int64_t)illegal_byte);
+ snprintf(IObuff + strlen(IObuff), IOSIZE - strlen(IObuff),
+ _("[ILLEGAL BYTE in line %" PRId64 "]"), (int64_t)illegal_byte);
c = true;
} else if (error) {
STRCAT(IObuff, _("[READ ERRORS]"));
@@ -1958,7 +1958,7 @@ static linenr_T readfile_linenr(linenr_T linecnt, char_u *p, char_u *endp)
void prep_exarg(exarg_T *eap, const buf_T *buf)
FUNC_ATTR_NONNULL_ALL
{
- const size_t cmd_len = 15 + STRLEN(buf->b_p_fenc);
+ const size_t cmd_len = 15 + strlen(buf->b_p_fenc);
eap->cmd = xmalloc(cmd_len);
snprintf(eap->cmd, cmd_len, "e ++enc=%s", buf->b_p_fenc);
@@ -2022,7 +2022,7 @@ static char *next_fenc(char **pp, bool *alloced)
p = vim_strchr((*pp), ',');
if (p == NULL) {
r = enc_canonize(*pp);
- *pp += STRLEN(*pp);
+ *pp += strlen(*pp);
} else {
r = xstrnsave(*pp, (size_t)(p - *pp));
*pp = p + 1;
@@ -2203,7 +2203,7 @@ int buf_write(buf_T *buf, char *fname, char *sfname, linenr_T start, linenr_T en
}
// Avoid a crash for a long name.
- if (STRLEN(fname) >= MAXPATHL) {
+ if (strlen(fname) >= MAXPATHL) {
emsg(_(e_longname));
return FAIL;
}
@@ -2733,7 +2733,7 @@ int buf_write(buf_T *buf, char *fname, char *sfname, linenr_T start, linenr_T en
// delete an existing one, and try to use another name instead.
// Change one character, just before the extension.
//
- wp = backup + STRLEN(backup) - 1 - STRLEN(backup_ext);
+ wp = backup + strlen(backup) - 1 - strlen(backup_ext);
if (wp < backup) { // empty file name ???
wp = backup;
}
@@ -2861,7 +2861,7 @@ nobackup:
// delete an existing one, try to use another name.
// Change one character, just before the extension.
if (!p_bk && os_path_exists(backup)) {
- p = backup + STRLEN(backup) - 1 - STRLEN(backup_ext);
+ p = backup + strlen(backup) - 1 - strlen(backup_ext);
if (p < backup) { // empty file name ???
p = backup;
}
@@ -3172,7 +3172,7 @@ restore_backup:
// Keep it fast!
ptr = ml_get_buf(buf, lnum, false) - 1;
if (write_undo_file) {
- sha256_update(&sha_ctx, (char_u *)ptr + 1, (uint32_t)(STRLEN(ptr + 1) + 1));
+ sha256_update(&sha_ctx, (char_u *)ptr + 1, (uint32_t)(strlen(ptr + 1) + 1));
}
while ((c = *++ptr) != NUL) {
if (c == NL) {
@@ -4527,7 +4527,7 @@ int vim_rename(const char *from, const char *to)
// Find a name that doesn't exist and is in the same directory.
// Rename "from" to "tempname" and then rename "tempname" to "to".
- if (STRLEN(from) >= MAXPATHL - 5) {
+ if (strlen(from) >= MAXPATHL - 5) {
return -1;
}
STRCPY(tempname, from);
@@ -4892,7 +4892,7 @@ int buf_check_timestamp(buf_T *buf)
if (!helpmesg) {
mesg2 = "";
}
- const size_t tbuf_len = STRLEN(path) + STRLEN(mesg) + STRLEN(mesg2) + 2;
+ const size_t tbuf_len = strlen(path) + strlen(mesg) + strlen(mesg2) + 2;
char *const tbuf = xmalloc(tbuf_len);
snprintf(tbuf, tbuf_len, mesg, path);
// Set warningmsg here, before the unimportant and output-specific
@@ -5489,7 +5489,7 @@ char *file_pat_to_reg_pat(const char *pat, const char *pat_end, char *allow_dirs
*allow_dirs = false;
}
if (pat_end == NULL) {
- pat_end = pat + STRLEN(pat);
+ pat_end = pat + strlen(pat);
}
if (pat_end == pat) {
diff --git a/src/nvim/fold.c b/src/nvim/fold.c
index 2e8d282ede..d46470d413 100644
--- a/src/nvim/fold.c
+++ b/src/nvim/fold.c
@@ -996,7 +996,7 @@ void foldAdjustVisual(void)
}
if (hasFolding(end->lnum, NULL, &end->lnum)) {
ptr = ml_get(end->lnum);
- end->col = (colnr_T)STRLEN(ptr);
+ end->col = (colnr_T)strlen(ptr);
if (end->col > 0 && *p_sel == 'o') {
end->col--;
}
@@ -1589,7 +1589,7 @@ static void foldAddMarker(buf_T *buf, pos_T pos, const char *marker, size_t mark
if (u_save(lnum - 1, lnum + 1) == OK) {
// Check if the line ends with an unclosed comment
skip_comment(line, false, false, &line_is_comment);
- newline = xmalloc(line_len + markerlen + STRLEN(cms) + 1);
+ newline = xmalloc(line_len + markerlen + strlen(cms) + 1);
STRCPY(newline, line);
// Append the marker to the end of the line
if (p == NULL || line_is_comment) {
@@ -1599,7 +1599,7 @@ static void foldAddMarker(buf_T *buf, pos_T pos, const char *marker, size_t mark
STRCPY(newline + line_len, cms);
memcpy(newline + line_len + (p - cms), marker, markerlen);
STRCPY(newline + line_len + (p - cms) + markerlen, p + 2);
- added = markerlen + STRLEN(cms) - 2;
+ added = markerlen + strlen(cms) - 2;
}
ml_replace_buf(buf, lnum, newline, false);
if (added) {
@@ -1655,14 +1655,14 @@ static void foldDelMarker(buf_T *buf, linenr_T lnum, char *marker, size_t marker
char *cms2 = strstr(cms, "%s");
if (p - line >= cms2 - cms
&& STRNCMP(p - (cms2 - cms), cms, cms2 - cms) == 0
- && STRNCMP(p + len, cms2 + 2, STRLEN(cms2 + 2)) == 0) {
+ && STRNCMP(p + len, cms2 + 2, strlen(cms2 + 2)) == 0) {
p -= cms2 - cms;
- len += STRLEN(cms) - 2;
+ len += strlen(cms) - 2;
}
}
if (u_save(lnum - 1, lnum + 1) == OK) {
// Make new line: text-before-marker + text-after-marker
- char *newline = xmalloc(STRLEN(line) - len + 1);
+ char *newline = xmalloc(strlen(line) - len + 1);
assert(p >= line);
memcpy(newline, line, (size_t)(p - line));
STRCPY(newline + (p - line), p + len);
@@ -1789,7 +1789,7 @@ static void foldtext_cleanup(char *str)
{
// Ignore leading and trailing white space in 'commentstring'.
char *cms_start = skipwhite(curbuf->b_p_cms);
- size_t cms_slen = STRLEN(cms_start);
+ size_t cms_slen = strlen(cms_start);
while (cms_slen > 0 && ascii_iswhite(cms_start[cms_slen - 1])) {
cms_slen--;
}
@@ -2985,7 +2985,7 @@ static void parseMarker(win_T *wp)
{
foldendmarker = vim_strchr(wp->w_p_fmr, ',');
foldstartmarkerlen = (size_t)(foldendmarker++ - wp->w_p_fmr);
- foldendmarkerlen = STRLEN(foldendmarker);
+ foldendmarkerlen = strlen(foldendmarker);
}
// foldlevelMarker() {{{2
@@ -3262,13 +3262,13 @@ void f_foldtext(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
}
int count = foldend - foldstart + 1;
char *txt = NGETTEXT("+-%s%3ld line: ", "+-%s%3ld lines: ", count);
- size_t len = STRLEN(txt)
- + STRLEN(dashes) // for %s
+ size_t len = strlen(txt)
+ + strlen(dashes) // for %s
+ 20 // for %3ld
+ STRLEN(s); // concatenated
char *r = xmalloc(len);
snprintf(r, len, txt, dashes, count);
- len = STRLEN(r);
+ len = strlen(r);
STRCAT(r, s);
// remove 'foldmarker' and 'commentstring'
foldtext_cleanup(r + len);
diff --git a/src/nvim/garray.c b/src/nvim/garray.c
index adc3eda5ca..6c63ce5a7c 100644
--- a/src/nvim/garray.c
+++ b/src/nvim/garray.c
@@ -198,7 +198,7 @@ void ga_concat(garray_T *gap, const char *restrict s)
return;
}
- ga_concat_len(gap, s, STRLEN(s));
+ ga_concat_len(gap, s, strlen(s));
}
/// Concatenate a string to a growarray which contains characters
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c
index 0f0e3aece1..c7cfc91591 100644
--- a/src/nvim/getchar.c
+++ b/src/nvim/getchar.c
@@ -148,7 +148,7 @@ static char_u *get_buffcont(buffheader_T *buffer, int dozero)
// compute the total length of the string
for (const buffblock_T *bp = buffer->bh_first.b_next;
bp != NULL; bp = bp->b_next) {
- count += STRLEN(bp->b_str);
+ count += strlen(bp->b_str);
}
if (count || dozero) {
@@ -225,13 +225,13 @@ static void add_buff(buffheader_T *const buf, const char *const s, ptrdiff_t sle
} else if (buf->bh_index != 0) {
memmove(buf->bh_first.b_next->b_str,
buf->bh_first.b_next->b_str + buf->bh_index,
- STRLEN(buf->bh_first.b_next->b_str + buf->bh_index) + 1);
+ strlen(buf->bh_first.b_next->b_str + buf->bh_index) + 1);
}
buf->bh_index = 0;
size_t len;
if (buf->bh_space >= (size_t)slen) {
- len = STRLEN(buf->bh_curr->b_str);
+ len = strlen(buf->bh_curr->b_str);
STRLCPY(buf->bh_curr->b_str + len, s, slen + 1);
buf->bh_space -= (size_t)slen;
} else {
@@ -259,7 +259,7 @@ static void delete_buff_tail(buffheader_T *buf, int slen)
if (buf->bh_curr == NULL) {
return; // nothing to delete
}
- len = (int)STRLEN(buf->bh_curr->b_str);
+ len = (int)strlen(buf->bh_curr->b_str);
if (len >= slen) {
buf->bh_curr->b_str[len - slen] = NUL;
buf->bh_space += (size_t)slen;
@@ -845,7 +845,7 @@ int ins_typebuf(char *str, int noremap, int offset, bool nottyped, bool silent)
typebuf.tb_change_cnt = 1;
}
- addlen = (int)STRLEN(str);
+ addlen = (int)strlen(str);
if (offset == 0 && addlen <= typebuf.tb_off) {
// Easy case: there is room in front of typebuf.tb_buf[typebuf.tb_off]
diff --git a/src/nvim/hardcopy.c b/src/nvim/hardcopy.c
index b530e2c5ec..c46f95b64f 100644
--- a/src/nvim/hardcopy.c
+++ b/src/nvim/hardcopy.c
@@ -663,7 +663,7 @@ void ex_hardcopy(exarg_T *eap)
// Estimate the total lines to be printed
for (lnum = eap->line1; lnum <= eap->line2; lnum++) {
- bytes_to_print += STRLEN(skipwhite((char *)ml_get(lnum)));
+ bytes_to_print += strlen(skipwhite(ml_get(lnum)));
}
if (bytes_to_print == 0) {
msg(_("No text to be printed"));
@@ -739,10 +739,10 @@ void ex_hardcopy(exarg_T *eap)
}
if (settings.n_collated_copies > 1) {
- sprintf((char *)IObuff + STRLEN(IObuff),
- _(" Copy %d of %d"),
- collated_copies + 1,
- settings.n_collated_copies);
+ snprintf(IObuff + strlen(IObuff), IOSIZE - strlen(IObuff),
+ _(" Copy %d of %d"),
+ collated_copies + 1,
+ settings.n_collated_copies);
}
prt_message((char_u *)IObuff);
@@ -759,7 +759,7 @@ void ex_hardcopy(exarg_T *eap)
if (prtpos.column == 0) {
// finished a file line
prtpos.bytes_printed +=
- STRLEN(skipwhite((char *)ml_get(prtpos.file_line)));
+ strlen(skipwhite(ml_get(prtpos.file_line)));
if (++prtpos.file_line > eap->line2) {
break; // reached the end
}
@@ -1278,7 +1278,7 @@ static void prt_write_file_raw_len(char_u *buffer, size_t bytes)
static void prt_write_file(char *buffer)
{
- prt_write_file_len((char_u *)buffer, STRLEN(buffer));
+ prt_write_file_len((char_u *)buffer, strlen(buffer));
}
static void prt_write_file_len(char_u *buffer, size_t bytes)
@@ -1475,7 +1475,7 @@ static void prt_resource_name(char *filename, void *cookie)
{
char_u *resource_filename = cookie;
- if (STRLEN(filename) >= MAXPATHL) {
+ if (strlen(filename) >= MAXPATHL) {
*resource_filename = NUL;
} else {
STRCPY(resource_filename, filename);
@@ -1653,14 +1653,14 @@ static bool prt_open_resource(struct prt_ps_resource_S *resource)
int offset = 0;
if (prt_resfile_strncmp(offset, PRT_RESOURCE_HEADER,
- (int)STRLEN(PRT_RESOURCE_HEADER)) != 0) {
+ (int)strlen(PRT_RESOURCE_HEADER)) != 0) {
semsg(_("E618: file \"%s\" is not a PostScript resource file"),
resource->filename);
return false;
}
// Skip over any version numbers and following ws
- offset += (int)STRLEN(PRT_RESOURCE_HEADER);
+ offset += (int)strlen(PRT_RESOURCE_HEADER);
offset = prt_resfile_skip_nonws(offset);
if (offset == -1) {
return false;
@@ -1670,22 +1670,22 @@ static bool prt_open_resource(struct prt_ps_resource_S *resource)
return false;
}
if (prt_resfile_strncmp(offset, PRT_RESOURCE_RESOURCE,
- (int)STRLEN(PRT_RESOURCE_RESOURCE)) != 0) {
+ (int)strlen(PRT_RESOURCE_RESOURCE)) != 0) {
semsg(_("E619: file \"%s\" is not a supported PostScript resource file"),
resource->filename);
return false;
}
- offset += (int)STRLEN(PRT_RESOURCE_RESOURCE);
+ offset += (int)strlen(PRT_RESOURCE_RESOURCE);
// Decide type of resource in the file
if (prt_resfile_strncmp(offset, PRT_RESOURCE_PROCSET,
- (int)STRLEN(PRT_RESOURCE_PROCSET)) == 0) {
+ (int)strlen(PRT_RESOURCE_PROCSET)) == 0) {
resource->type = PRT_RESOURCE_TYPE_PROCSET;
} else if (prt_resfile_strncmp(offset, PRT_RESOURCE_ENCODING,
- (int)STRLEN(PRT_RESOURCE_ENCODING)) == 0) {
+ (int)strlen(PRT_RESOURCE_ENCODING)) == 0) {
resource->type = PRT_RESOURCE_TYPE_ENCODING;
} else if (prt_resfile_strncmp(offset, PRT_RESOURCE_CMAP,
- (int)STRLEN(PRT_RESOURCE_CMAP)) == 0) {
+ (int)strlen(PRT_RESOURCE_CMAP)) == 0) {
resource->type = PRT_RESOURCE_TYPE_CMAP;
} else {
semsg(_("E619: file \"%s\" is not a supported PostScript resource file"),
@@ -2021,7 +2021,7 @@ static int prt_match_encoding(char *p_encoding, struct prt_ps_mbfont_S *p_cmap,
*pp_mbenc = NULL;
// Look for recognised encoding
- enc_len = (int)STRLEN(p_encoding);
+ enc_len = (int)strlen(p_encoding);
p_mbenc = p_cmap->encodings;
for (mbenc = 0; mbenc < p_cmap->num_encodings; mbenc++) {
if (STRNICMP(p_mbenc->encoding, p_encoding, enc_len) == 0) {
@@ -2044,7 +2044,7 @@ static int prt_match_charset(char *p_charset, struct prt_ps_mbfont_S *p_cmap,
if (*p_charset == NUL) {
p_charset = p_cmap->defcs;
}
- char_len = (int)STRLEN(p_charset);
+ char_len = (int)strlen(p_charset);
p_mbchar = p_cmap->charsets;
for (mbchar = 0; mbchar < p_cmap->num_charsets; mbchar++) {
if (STRNICMP(p_mbchar->charset, p_charset, char_len) == 0) {
@@ -2135,8 +2135,8 @@ int mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
}
// CMap name ends with (optional) encoding name and -H for horizontal
- if (p_mbenc->cmap_encoding != NULL && STRLEN(prt_cmap)
- + STRLEN(p_mbenc->cmap_encoding) + 3 < sizeof(prt_cmap)) {
+ if (p_mbenc->cmap_encoding != NULL && strlen(prt_cmap)
+ + strlen(p_mbenc->cmap_encoding) + 3 < sizeof(prt_cmap)) {
STRCAT(prt_cmap, p_mbenc->cmap_encoding);
STRCAT(prt_cmap, "-");
}
@@ -2200,7 +2200,7 @@ int mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
paper_strlen = 2;
}
for (i = 0; i < (int)PRT_MEDIASIZE_LEN; i++) {
- if (STRLEN(prt_mediasize[i].name) == (unsigned)paper_strlen
+ if (strlen(prt_mediasize[i].name) == (unsigned)paper_strlen
&& STRNICMP(prt_mediasize[i].name, paper_name,
paper_strlen) == 0) {
break;
diff --git a/src/nvim/hashtab.c b/src/nvim/hashtab.c
index 308f64f011..3d0ab192b9 100644
--- a/src/nvim/hashtab.c
+++ b/src/nvim/hashtab.c
@@ -87,7 +87,7 @@ void hash_clear_all(hashtab_T *ht, unsigned int off)
/// is changed in any way.
hashitem_T *hash_find(const hashtab_T *const ht, const char *const key)
{
- return hash_lookup(ht, key, STRLEN(key), hash_hash((char_u *)key));
+ return hash_lookup(ht, key, strlen(key), hash_hash((char_u *)key));
}
/// Like hash_find, but key is not NUL-terminated
diff --git a/src/nvim/help.c b/src/nvim/help.c
index 507c5904b3..a24b17e34e 100644
--- a/src/nvim/help.c
+++ b/src/nvim/help.c
@@ -75,7 +75,7 @@ void ex_help(exarg_T *eap)
}
// remove trailing blanks
- p = arg + STRLEN(arg) - 1;
+ p = arg + strlen(arg) - 1;
while (p > arg && ascii_iswhite(*p) && p[-1] != '\\') {
*p-- = NUL;
}
@@ -95,7 +95,7 @@ void ex_help(exarg_T *eap)
if (n != FAIL && lang != NULL) {
// Find first item with the requested language.
for (i = 0; i < num_matches; i++) {
- len = (int)STRLEN(matches[i]);
+ len = (int)strlen(matches[i]);
if (len > 3 && matches[i][len - 3] == '@'
&& STRICMP(matches[i] + len - 2, lang) == 0) {
break;
@@ -219,7 +219,7 @@ void ex_helpclose(exarg_T *eap)
/// @return NULL if not found.
char *check_help_lang(char *arg)
{
- int len = (int)STRLEN(arg);
+ int len = (int)strlen(arg);
if (len >= 3 && arg[len - 3] == '@' && ASCII_ISALPHA(arg[len - 2])
&& ASCII_ISALPHA(arg[len - 1])) {
@@ -278,7 +278,7 @@ int help_heuristic(char *matched_string, int offset, int wrong_case)
if (matched_string[0] == '+' && matched_string[1] != NUL) {
offset += 100;
}
- return 100 * num_letters + (int)STRLEN(matched_string) + offset;
+ return 100 * num_letters + (int)strlen(matched_string) + offset;
}
/// Compare functions for qsort() below, that checks the help heuristics number
@@ -515,16 +515,16 @@ int find_help_tags(const char *arg, int *num_matches, char ***matches, bool keep
if (*IObuff == '`') {
if (d > IObuff + 2 && d[-1] == '`') {
// remove the backticks from `command`
- memmove(IObuff, IObuff + 1, STRLEN(IObuff));
+ memmove(IObuff, IObuff + 1, strlen(IObuff));
d[-2] = NUL;
} else if (d > IObuff + 3 && d[-2] == '`' && d[-1] == ',') {
// remove the backticks and comma from `command`,
- memmove(IObuff, IObuff + 1, STRLEN(IObuff));
+ memmove(IObuff, IObuff + 1, strlen(IObuff));
d[-3] = NUL;
} else if (d > IObuff + 4 && d[-3] == '`'
&& d[-2] == '\\' && d[-1] == '.') {
// remove the backticks and dot from `command`\.
- memmove(IObuff, IObuff + 1, STRLEN(IObuff));
+ memmove(IObuff, IObuff + 1, strlen(IObuff));
d[-4] = NUL;
}
}
@@ -567,7 +567,7 @@ void cleanup_help_tags(int num_file, char **file)
*p = NUL;
for (int i = 0; i < num_file; i++) {
- int len = (int)STRLEN(file[i]) - 3;
+ int len = (int)strlen(file[i]) - 3;
if (len <= 0) {
continue;
}
@@ -577,7 +577,7 @@ void cleanup_help_tags(int num_file, char **file)
int j;
for (j = 0; j < num_file; j++) {
if (j != i
- && (int)STRLEN(file[j]) == len + 3
+ && (int)strlen(file[j]) == len + 3
&& STRNCMP(file[i], file[j], len + 1) == 0) {
break;
}
@@ -591,7 +591,7 @@ void cleanup_help_tags(int num_file, char **file)
if (*buf != NUL) {
for (int i = 0; i < num_file; i++) {
- int len = (int)STRLEN(file[i]) - 3;
+ int len = (int)strlen(file[i]) - 3;
if (len <= 0) {
continue;
}
@@ -915,7 +915,7 @@ static void helptags_one(char *dir, const char *ext, const char *tagfname, bool
ga_init(&ga, (int)sizeof(char_u *), 100);
if (add_help_tags
|| path_full_compare("$VIMRUNTIME/doc", dir, false, true) == kEqualFiles) {
- size_t s_len = 18 + STRLEN(tagfname);
+ size_t s_len = 18 + strlen(tagfname);
s = xmalloc(s_len);
snprintf(s, s_len, "help-tags\t%s\t1\n", tagfname);
GA_APPEND(char *, &ga, s);
@@ -979,7 +979,7 @@ static void helptags_one(char *dir, const char *ext, const char *tagfname, bool
|| s[1] == '\0')) {
*p2 = '\0';
p1++;
- size_t s_len= (size_t)(p2 - p1) + STRLEN(fname) + 2;
+ size_t s_len= (size_t)(p2 - p1) + strlen(fname) + 2;
s = xmalloc(s_len);
GA_APPEND(char *, &ga, s);
snprintf(s, s_len, "%s\t%s", p1, fname);
@@ -1087,7 +1087,7 @@ static void do_helptags(char *dirname, bool add_help_tags, bool ignore_writeerr)
int j;
ga_init(&ga, 1, 10);
for (int i = 0; i < filecount; i++) {
- len = (int)STRLEN(files[i]);
+ len = (int)strlen(files[i]);
if (len <= 4) {
continue;
}
diff --git a/src/nvim/highlight.c b/src/nvim/highlight.c
index e42cb66422..d507f07bca 100644
--- a/src/nvim/highlight.c
+++ b/src/nvim/highlight.c
@@ -407,7 +407,7 @@ void update_ns_hl(int ns_id)
int *hl_attrs = **alloc;
for (int hlf = 0; hlf < HLF_COUNT; hlf++) {
- int id = syn_check_group(hlf_names[hlf], STRLEN(hlf_names[hlf]));
+ int id = syn_check_group(hlf_names[hlf], strlen(hlf_names[hlf]));
bool optional = (hlf == HLF_INACTIVE || hlf == HLF_NFLOAT);
hl_attrs[hlf] = hl_get_ui_attr(ns_id, hlf, id, optional);
}
diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c
index 2cb8fabfb4..fed39c6ed7 100644
--- a/src/nvim/highlight_group.c
+++ b/src/nvim/highlight_group.c
@@ -1084,7 +1084,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
int i;
while (arg[off] != NUL) {
for (i = ARRAY_SIZE(hl_attr_table); --i >= 0;) {
- len = (int)STRLEN(hl_name_table[i]);
+ len = (int)strlen(hl_name_table[i]);
if (STRNICMP(arg + off, hl_name_table[i], len) == 0) {
attr |= hl_attr_table[i];
off += len;
@@ -1519,7 +1519,7 @@ static bool highlight_list_arg(const int id, bool didh, const int type, int iarg
}
}
- (void)syn_list_header(didh, vim_strsize((char *)ts) + (int)STRLEN(name) + 1, id, false);
+ (void)syn_list_header(didh, vim_strsize((char *)ts) + (int)strlen(name) + 1, id, false);
didh = true;
if (!got_int) {
if (*name != NUL) {
@@ -1723,7 +1723,7 @@ int syn_name2id(const char *name)
// if we look up @aaa.bbb, we have to consider @aaa as well
return syn_check_group(name, strlen(name));
} else {
- return syn_name2id_len(name, STRLEN(name));
+ return syn_name2id_len(name, strlen(name));
}
}
@@ -2007,7 +2007,7 @@ void highlight_changed(void)
/// Translate builtin highlight groups into attributes for quick lookup.
for (int hlf = 0; hlf < HLF_COUNT; hlf++) {
- id = syn_check_group(hlf_names[hlf], STRLEN(hlf_names[hlf]));
+ id = syn_check_group(hlf_names[hlf], strlen(hlf_names[hlf]));
if (id == 0) {
abort();
}
diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c
index 719899d0b8..a637e480ea 100644
--- a/src/nvim/if_cscope.c
+++ b/src/nvim/if_cscope.c
@@ -415,7 +415,7 @@ static int cs_add_common(char *arg1, char *arg2, char *flags)
fname = xmalloc(MAXPATHL + 1);
expand_env(arg1, fname, MAXPATHL);
- size_t len = STRLEN(fname);
+ size_t len = strlen(fname);
fbuf = fname;
(void)modify_fname(":p", false, &usedlen, &fname, &fbuf, &len);
if (fname == NULL) {
@@ -1180,7 +1180,7 @@ static cscmd_T *cs_lookup_cmd(exarg_T *eap)
}
// Store length of eap->arg before it gets modified by strtok().
- eap_arg_len = (int)STRLEN(eap->arg);
+ eap_arg_len = (int)strlen(eap->arg);
if ((stok = strtok(eap->arg, (const char *)" ")) == NULL) { // NOLINT(runtime/threadsafe_fn)
return NULL;
diff --git a/src/nvim/indent_c.c b/src/nvim/indent_c.c
index c7f37790b6..5eed2601d5 100644
--- a/src/nvim/indent_c.c
+++ b/src/nvim/indent_c.c
@@ -204,7 +204,7 @@ bool cin_is_cinword(const char *line)
{
bool retval = false;
- size_t cinw_len = STRLEN(curbuf->b_p_cinw) + 1;
+ size_t cinw_len = strlen(curbuf->b_p_cinw) + 1;
char_u *cinw_buf = xmalloc(cinw_len);
line = skipwhite((char *)line);
@@ -485,7 +485,7 @@ bool cin_isscopedecl(const char_u *p)
{
const char_u *s = cin_skipcomment(p);
- const size_t cinsd_len = STRLEN(curbuf->b_p_cinsd) + 1;
+ const size_t cinsd_len = strlen(curbuf->b_p_cinsd) + 1;
char_u *cinsd_buf = xmalloc(cinsd_len);
bool found = false;
@@ -1322,7 +1322,7 @@ static int cin_ends_in(const char_u *s, const char_u *find, const char_u *ignore
/// Return true when "s" starts with "word" and then a non-ID character.
static int cin_starts_with(const char_u *s, const char *word)
{
- int l = (int)STRLEN(word);
+ int l = (int)strlen(word);
return STRNCMP(s, word, l) == 0 && !vim_isIDc(s[l]);
}
@@ -1901,7 +1901,7 @@ int get_c_indent(void)
// For unknown reasons the cursor might be past the end of the line, thus
// check for that.
if ((State & MODE_INSERT)
- && curwin->w_cursor.col < (colnr_T)STRLEN(linecopy)
+ && curwin->w_cursor.col < (colnr_T)strlen(linecopy)
&& linecopy[curwin->w_cursor.col] == ')') {
linecopy[curwin->w_cursor.col] = NUL;
}
@@ -2010,17 +2010,17 @@ int get_c_indent(void)
(void)copy_option_part(&p, lead_end, COM_MAX_LEN, ",");
if (what == COM_START) {
STRCPY(lead_start, lead_end);
- lead_start_len = (int)STRLEN(lead_start);
+ lead_start_len = (int)strlen(lead_start);
start_off = off;
start_align = align;
} else if (what == COM_MIDDLE) {
STRCPY(lead_middle, lead_end);
- lead_middle_len = (int)STRLEN(lead_middle);
+ lead_middle_len = (int)strlen(lead_middle);
} else if (what == COM_END) {
// If our line starts with the middle comment string, line it
// up with the comment opener per the 'comments' option.
if (STRNCMP(theline, lead_middle, lead_middle_len) == 0
- && STRNCMP(theline, lead_end, STRLEN(lead_end)) != 0) {
+ && STRNCMP(theline, lead_end, strlen(lead_end)) != 0) {
done = true;
if (curwin->w_cursor.lnum > 1) {
// If the start comment string matches in the previous
@@ -2051,7 +2051,7 @@ int get_c_indent(void)
// If our line starts with the end comment string, line it up
// with the middle comment
if (STRNCMP(theline, lead_middle, lead_middle_len) != 0
- && STRNCMP(theline, lead_end, STRLEN(lead_end)) == 0) {
+ && STRNCMP(theline, lead_end, strlen(lead_end)) == 0) {
amount = get_indent_lnum(curwin->w_cursor.lnum - 1);
// XXX
if (off != 0) {
diff --git a/src/nvim/insexpand.c b/src/nvim/insexpand.c
index a5e7929525..a4b0d68ffe 100644
--- a/src/nvim/insexpand.c
+++ b/src/nvim/insexpand.c
@@ -652,7 +652,7 @@ static char_u *ins_compl_infercase_gettext(char_u *str, int char_len, int compl_
ga_grow(&gap, IOSIZE);
*p = NUL;
STRCPY(gap.ga_data, IObuff);
- gap.ga_len = (int)STRLEN(IObuff);
+ gap.ga_len = (int)strlen(IObuff);
} else {
p += utf_char2bytes(wca[i++], p);
}
@@ -775,7 +775,7 @@ static int ins_compl_add(char *const str, int len, char *const fname, char *cons
return FAIL;
}
if (len < 0) {
- len = (int)STRLEN(str);
+ len = (int)strlen(str);
}
// If the same match is already present, don't add it.
@@ -784,7 +784,7 @@ static int ins_compl_add(char *const str, int len, char *const fname, char *cons
do {
if (!match_at_original_text(match)
&& STRNCMP(match->cp_str, str, len) == 0
- && ((int)STRLEN(match->cp_str) <= len || match->cp_str[len] == NUL)) {
+ && ((int)strlen(match->cp_str) <= len || match->cp_str[len] == NUL)) {
FREE_CPTEXT(cptext, cptext_allocated);
return NOTDONE;
}
@@ -997,7 +997,7 @@ bool ins_compl_has_shown_match(void)
bool ins_compl_long_shown_match(void)
{
return compl_shown_match != NULL && compl_shown_match->cp_str != NULL
- && (colnr_T)STRLEN(compl_shown_match->cp_str) > curwin->w_cursor.col - compl_col;
+ && (colnr_T)strlen(compl_shown_match->cp_str) > curwin->w_cursor.col - compl_col;
}
/// Set variables that store noselect and noinsert behavior from the
@@ -1124,7 +1124,7 @@ static int ins_compl_build_pum(void)
XFREE_CLEAR(compl_leader);
}
- const int lead_len = compl_leader != NULL ? (int)STRLEN(compl_leader) : 0;
+ const int lead_len = compl_leader != NULL ? (int)strlen(compl_leader) : 0;
do {
if (!match_at_original_text(compl)
@@ -2724,7 +2724,7 @@ static int process_next_cpt_value(ins_compl_next_state_T *st, int *compl_type_ar
// buffer, so that word at start of buffer is found
// correctly.
st->first_match_pos.lnum = st->ins_buf->b_ml.ml_line_count;
- st->first_match_pos.col = (colnr_T)STRLEN(ml_get(st->first_match_pos.lnum));
+ st->first_match_pos.col = (colnr_T)strlen(ml_get(st->first_match_pos.lnum));
}
st->last_match_pos = st->first_match_pos;
compl_type = 0;
@@ -2806,7 +2806,7 @@ done:
static void get_next_include_file_completion(int compl_type)
{
find_pattern_in_path((char_u *)compl_pattern, compl_direction,
- STRLEN(compl_pattern), false, false,
+ strlen(compl_pattern), false, false,
((compl_type == CTRL_X_PATH_DEFINES
&& !(compl_cont_status & CONT_SOL))
? FIND_DEFINE : FIND_ANY),
@@ -2889,7 +2889,7 @@ static void get_next_cmdline_completion(void)
char **matches;
int num_matches;
if (expand_cmdline(&compl_xp, (char_u *)compl_pattern,
- (int)STRLEN(compl_pattern),
+ (int)strlen(compl_pattern),
&num_matches, &matches) == EXPAND_OK) {
ins_compl_add_matches(num_matches, matches, false);
}
@@ -3810,7 +3810,7 @@ static int get_filename_compl_info(char_u *line, int startcol, colnr_T curs_col)
static int get_cmdline_compl_info(char *line, colnr_T curs_col)
{
compl_pattern = xstrnsave(line, (size_t)curs_col);
- set_cmd_context(&compl_xp, (char_u *)compl_pattern, (int)STRLEN(compl_pattern), curs_col, false);
+ set_cmd_context(&compl_xp, (char_u *)compl_pattern, (int)strlen(compl_pattern), curs_col, false);
if (compl_xp.xp_context == EXPAND_UNSUCCESSFUL
|| compl_xp.xp_context == EXPAND_NOTHING) {
// No completion possible, use an empty pattern to get a
diff --git a/src/nvim/keycodes.c b/src/nvim/keycodes.c
index a3763ea9bb..9ec37fd564 100644
--- a/src/nvim/keycodes.c
+++ b/src/nvim/keycodes.c
@@ -539,7 +539,7 @@ char_u *get_special_key_name(int c, int modifiers)
}
}
} else { // use name of special key
- size_t len = STRLEN(key_names_table[table_idx].name);
+ size_t len = strlen(key_names_table[table_idx].name);
if ((int)len + idx + 2 <= MAX_KEY_NAME_LEN) {
STRCPY(string + idx, key_names_table[table_idx].name);
@@ -1050,7 +1050,7 @@ char *vim_strsave_escape_ks(char *p)
// Need a buffer to hold up to three times as much. Four in case of an
// illegal utf-8 byte:
// 0xc0 -> 0xc3 - 0x80 -> 0xc3 K_SPECIAL KS_SPECIAL KE_FILLER
- char_u *res = xmalloc(STRLEN(p) * 4 + 1);
+ char_u *res = xmalloc(strlen(p) * 4 + 1);
char_u *d = res;
for (char_u *s = (char_u *)p; *s != NUL;) {
if (s[0] == K_SPECIAL && s[1] != NUL && s[2] != NUL) {
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c
index 78ac051308..128f133b23 100644
--- a/src/nvim/lua/executor.c
+++ b/src/nvim/lua/executor.c
@@ -1049,7 +1049,7 @@ static int nlua_debug(lua_State *lstate)
return 0;
}
if (luaL_loadbuffer(lstate, (const char *)input.vval.v_string,
- STRLEN(input.vval.v_string), "=(debug command)")) {
+ strlen(input.vval.v_string), "=(debug command)")) {
nlua_error(lstate, _("E5115: Error while loading debug string: %.*s"));
} else if (nlua_pcall(lstate, 0, 0)) {
nlua_error(lstate, _("E5116: Error while calling debug string: %.*s"));
@@ -1641,7 +1641,7 @@ void ex_luado(exarg_T *const eap)
break;
}
if (lua_isstring(lstate, -1)) {
- size_t old_line_len = STRLEN(old_line);
+ size_t old_line_len = strlen(old_line);
size_t new_line_len;
const char *const new_line = lua_tolstring(lstate, -1, &new_line_len);
@@ -2001,7 +2001,7 @@ int nlua_do_ucmd(ucmd_T *cmd, exarg_T *eap, bool preview)
// Split args by unescaped whitespace |<f-args>| (nargs dependent)
if (cmd->uc_argt & EX_NOSPC) {
- if ((cmd->uc_argt & EX_NEEDARG) || STRLEN(eap->arg)) {
+ if ((cmd->uc_argt & EX_NEEDARG) || strlen(eap->arg)) {
// For commands where nargs is 1 or "?" and argument is passed, fargs = { args }
lua_rawseti(lstate, -2, 1);
} else {
@@ -2011,7 +2011,7 @@ int nlua_do_ucmd(ucmd_T *cmd, exarg_T *eap, bool preview)
} else if (eap->args == NULL) {
// For commands with more than one possible argument, split if argument list isn't available.
lua_pop(lstate, 1); // Pop the reference of opts.args
- size_t length = STRLEN(eap->arg);
+ size_t length = strlen(eap->arg);
size_t end = 0;
size_t len = 0;
int i = 1;
diff --git a/src/nvim/main.c b/src/nvim/main.c
index a73c465042..a317789f73 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -1156,7 +1156,7 @@ static void command_line_scan(mparm_T *parmp)
p_verbose = get_number_arg(argv[0], &argv_idx, 10);
if (argv[0][argv_idx] != NUL) {
set_option_value_give_err("verbosefile", 0L, argv[0] + argv_idx, 0);
- argv_idx = (int)STRLEN(argv[0]);
+ argv_idx = (int)strlen(argv[0]);
}
break;
case 'w': // "-w{number}" set window height
@@ -1226,7 +1226,7 @@ static void command_line_scan(mparm_T *parmp)
a = argv[0];
}
- size_t s_size = STRLEN(a) + 9;
+ size_t s_size = strlen(a) + 9;
char *s = xmalloc(s_size);
snprintf(s, s_size, "so %s", a);
parmp->cmds_tofree[parmp->n_commands] = true;
@@ -1375,7 +1375,7 @@ scripterror:
// If there is a "+123" or "-c" command, set v:swapcommand to the first one.
if (parmp->n_commands > 0) {
- const size_t swcmd_len = STRLEN(parmp->commands[0]) + 3;
+ const size_t swcmd_len = strlen(parmp->commands[0]) + 3;
char *const swcmd = xmalloc(swcmd_len);
snprintf(swcmd, swcmd_len, ":%s\r", parmp->commands[0]);
set_vim_var_string(VV_SWAPCOMMAND, swcmd, -1);
diff --git a/src/nvim/mapping.c b/src/nvim/mapping.c
index 9f169427f5..a10146c110 100644
--- a/src/nvim/mapping.c
+++ b/src/nvim/mapping.c
@@ -262,7 +262,7 @@ static bool set_maparg_lhs_rhs(const char *const orig_lhs, const size_t orig_lhs
if (replaced == NULL) {
return false;
}
- mapargs->lhs_len = STRLEN(replaced);
+ mapargs->lhs_len = strlen(replaced);
STRLCPY(mapargs->lhs, replaced, sizeof(mapargs->lhs));
if (did_simplify) {
replaced = replace_termcodes(orig_lhs, orig_lhs_len, &bufarg, flags | REPTERM_NO_SIMPLIFY,
@@ -270,7 +270,7 @@ static bool set_maparg_lhs_rhs(const char *const orig_lhs, const size_t orig_lhs
if (replaced == NULL) {
return false;
}
- mapargs->alt_lhs_len = STRLEN(replaced);
+ mapargs->alt_lhs_len = strlen(replaced);
STRLCPY(mapargs->alt_lhs, replaced, sizeof(mapargs->alt_lhs));
} else {
mapargs->alt_lhs_len = 0;
@@ -299,7 +299,7 @@ static void set_maparg_rhs(const char *const orig_rhs, const size_t orig_rhs_len
char *rhs_buf = NULL;
char *replaced = replace_termcodes(orig_rhs, orig_rhs_len, &rhs_buf, REPTERM_DO_LT, NULL,
cpo_flags);
- mapargs->rhs_len = STRLEN(replaced);
+ mapargs->rhs_len = strlen(replaced);
// NB: replace_termcodes may produce an empty string even if orig_rhs is non-empty
// (e.g. a single ^V, see :h map-empty-rhs)
mapargs->rhs_is_noop = orig_rhs_len != 0 && mapargs->rhs_len == 0;
@@ -709,7 +709,7 @@ static int buf_do_map(int maptype, MapArguments *args, int mode, bool is_abbrev,
}
} else { // do we have a match?
if (round) { // second round: Try unmap "rhs" string
- n = (int)STRLEN(mp->m_str);
+ n = (int)strlen(mp->m_str);
p = (char_u *)mp->m_str;
} else {
n = mp->m_keylen;
@@ -2091,7 +2091,7 @@ static void get_maparg(typval_T *argvars, typval_T *rettv, int exact)
const int mode = get_map_mode((char **)&which, 0);
char_u *keys_simplified
- = (char_u *)replace_termcodes(keys, STRLEN(keys), &keys_buf, flags, &did_simplify,
+ = (char_u *)replace_termcodes(keys, strlen(keys), &keys_buf, flags, &did_simplify,
CPO_TO_CPO_FLAGS);
mapblock_T *mp = NULL;
int buffer_local;
@@ -2101,7 +2101,7 @@ static void get_maparg(typval_T *argvars, typval_T *rettv, int exact)
// When the lhs is being simplified the not-simplified keys are
// preferred for printing, like in do_map().
(void)replace_termcodes(keys,
- STRLEN(keys),
+ strlen(keys),
&alt_keys_buf, flags | REPTERM_NO_SIMPLIFY, NULL,
CPO_TO_CPO_FLAGS);
rhs = check_map((char_u *)alt_keys_buf, mode, exact, false, abbr, &mp, &buffer_local, &rhs_lua);
diff --git a/src/nvim/mark.c b/src/nvim/mark.c
index 6f8aecb3ff..83ac61f7d2 100644
--- a/src/nvim/mark.c
+++ b/src/nvim/mark.c
@@ -658,7 +658,7 @@ static void fname2fnum(xfmark_T *fm)
int len;
expand_env("~/", NameBuff, MAXPATHL);
- len = (int)STRLEN(NameBuff);
+ len = (int)strlen(NameBuff);
STRLCPY(NameBuff + len, fm->fname + 2, MAXPATHL - len);
} else {
STRLCPY(NameBuff, fm->fname, MAXPATHL);
diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c
index dc74e23874..1c2fd6c7db 100644
--- a/src/nvim/mbyte.c
+++ b/src/nvim/mbyte.c
@@ -1556,7 +1556,7 @@ void show_utf8(void)
sprintf((char *)IObuff + rlen, "%02x ",
(line[i] == NL) ? NUL : line[i]); // NUL is stored as NL
clen--;
- rlen += (int)STRLEN(IObuff + rlen);
+ rlen += (int)strlen(IObuff + rlen);
if (rlen > IOSIZE - 20) {
break;
}
diff --git a/src/nvim/memline.c b/src/nvim/memline.c
index 9d1ad5903d..b374010f80 100644
--- a/src/nvim/memline.c
+++ b/src/nvim/memline.c
@@ -627,7 +627,7 @@ static void set_b0_fname(ZERO_BL *b0p, buf_T *buf)
if (b0p->b0_fname[0] == '~') {
// If there is no user name or it is too long, don't use "~/"
int retval = os_get_username(uname, B0_UNAME_SIZE);
- size_t ulen = STRLEN(uname);
+ size_t ulen = strlen(uname);
size_t flen = STRLEN(b0p->b0_fname);
if (retval == FAIL || ulen + flen > B0_FNAME_SIZE_CRYPT - 1) {
STRLCPY(b0p->b0_fname, buf->b_ffname, B0_FNAME_SIZE_CRYPT);
@@ -678,7 +678,7 @@ static void add_b0_fenc(ZERO_BL *b0p, buf_T *buf)
int n;
int size = B0_FNAME_SIZE_NOCRYPT;
- n = (int)STRLEN(buf->b_p_fenc);
+ n = (int)strlen(buf->b_p_fenc);
if ((int)STRLEN(b0p->b0_fname) + n + 1 > size) {
b0p->b0_flags &= (uint8_t) ~B0_HAS_FENC;
} else {
@@ -736,7 +736,7 @@ void ml_recover(bool checkext)
if (fname == NULL) { // When there is no file name
fname = "";
}
- len = (int)STRLEN(fname);
+ len = (int)strlen(fname);
if (checkext && len >= 4
&& STRNICMP(fname + len - 4, ".s", 2) == 0
&& vim_strchr("abcdefghijklmnopqrstuvw", TOLOWER_ASC(fname[len - 2])) != NULL
@@ -1221,7 +1221,7 @@ int recover_names(char_u *fname, int list, int nr, char **fname_out)
// Do the loop for every directory in 'directory'.
// First allocate some memory to put the directory name in.
- dir_name = xmalloc(STRLEN(p_dir) + 1);
+ dir_name = xmalloc(strlen(p_dir) + 1);
dirp = p_dir;
while (*dirp) {
// Isolate a directory name from *dirp and put it in dir_name (we know
@@ -3029,7 +3029,7 @@ int resolve_symlink(const char *fname, char *buf)
STRCPY(tmp, buf);
} else {
char_u *tail = (char_u *)path_tail(tmp);
- if (STRLEN(tail) + STRLEN(buf) >= MAXPATHL) {
+ if (STRLEN(tail) + strlen(buf) >= MAXPATHL) {
return FAIL;
}
STRCPY(tail, buf);
diff --git a/src/nvim/menu.c b/src/nvim/menu.c
index d8b7e872d9..b38e832c77 100644
--- a/src/nvim/menu.c
+++ b/src/nvim/menu.c
@@ -220,7 +220,7 @@ void ex_menu(exarg_T *eap)
map_buf = NULL; // Menu tips are plain text.
} else {
map_buf = NULL;
- map_to = replace_termcodes(map_to, STRLEN(map_to), &map_buf,
+ map_to = replace_termcodes(map_to, strlen(map_to), &map_buf,
REPTERM_DO_LT, NULL, CPO_TO_CPO_FLAGS);
}
menuarg.modes = modes;
@@ -286,7 +286,7 @@ static int add_menu_path(const char *const menu_path, vimmenu_T *menuarg, const
// Get name of this element in the menu hierarchy, and the simplified
// name (without mnemonic and accelerator text).
next_name = menu_name_skip(name);
- map_to = menutrans_lookup(name, (int)STRLEN(name));
+ map_to = menutrans_lookup(name, (int)strlen(name));
if (map_to != NULL) {
en_name = name;
name = map_to;
@@ -424,7 +424,7 @@ static int add_menu_path(const char *const menu_path, vimmenu_T *menuarg, const
}
if (c != 0) {
- menu->strings[i] = xmalloc(STRLEN(call_data) + 5);
+ menu->strings[i] = xmalloc(strlen(call_data) + 5);
menu->strings[i][0] = c;
if (d == 0) {
STRCPY(menu->strings[i] + 1, call_data);
@@ -433,7 +433,7 @@ static int add_menu_path(const char *const menu_path, vimmenu_T *menuarg, const
STRCPY(menu->strings[i] + 2, call_data);
}
if (c == Ctrl_C) {
- int len = (int)STRLEN(menu->strings[i]);
+ int len = (int)strlen(menu->strings[i]);
menu->strings[i][len] = Ctrl_BSL;
menu->strings[i][len + 1] = Ctrl_G;
@@ -1054,7 +1054,7 @@ char *get_menu_names(expand_T *xp, int idx)
while (menu != NULL
&& (menu_is_hidden(menu->dname)
|| (expand_emenu && menu_is_separator(menu->dname))
- || menu->dname[STRLEN(menu->dname) - 1] == '.')) {
+ || menu->dname[strlen(menu->dname) - 1] == '.')) {
menu = menu->next;
}
@@ -1276,7 +1276,7 @@ static char *get_menu_mode_str(int modes)
// Returns the name in allocated memory.
static char *popup_mode_name(char *name, int idx)
{
- size_t len = STRLEN(name);
+ size_t len = strlen(name);
assert(len >= 4);
char *mode_chars = menu_mode_chars[idx];
@@ -1365,7 +1365,7 @@ bool menu_is_toolbar(const char *const name)
/// with '-'
int menu_is_separator(char *name)
{
- return name[0] == '-' && name[STRLEN(name) - 1] == '-';
+ return name[0] == '-' && name[strlen(name) - 1] == '-';
}
/// True if a popup menu or starts with \ref MNU_HIDDEN_CHAR
diff --git a/src/nvim/message.c b/src/nvim/message.c
index 2d23797bc8..46f6adec47 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -433,7 +433,7 @@ void trunc_string(char *s, char *buf, int room_in, int buflen)
}
// Last part: End of the string.
- half = i = (int)STRLEN(s);
+ half = i = (int)strlen(s);
for (;;) {
do {
half = half - utf_head_off(s, s + half - 1) - 1;
@@ -449,7 +449,7 @@ void trunc_string(char *s, char *buf, int room_in, int buflen)
if (i <= e + 3) {
// text fits without truncating
if (s != buf) {
- len = (int)STRLEN(s);
+ len = (int)strlen(s);
if (len >= buflen) {
len = buflen - 1;
}
@@ -463,7 +463,7 @@ void trunc_string(char *s, char *buf, int room_in, int buflen)
} else if (e + 3 < buflen) {
// set the middle and copy the last part
memmove(buf + e, "...", (size_t)3);
- len = (int)STRLEN(s + i) + 1;
+ len = (int)strlen(s + i) + 1;
if (len >= buflen - e - 3) {
len = buflen - e - 3 - 1;
}
@@ -553,7 +553,7 @@ static char *get_emsg_source(void)
}
const char *const p = _("Error detected while processing %s:");
- const size_t buf_len = STRLEN(sname) + strlen(p) + 1;
+ const size_t buf_len = strlen(sname) + strlen(p) + 1;
char *const buf = xmalloc(buf_len);
snprintf(buf, buf_len, p, sname);
xfree(tofree);
@@ -909,7 +909,7 @@ char *msg_may_trunc(bool force, char *s)
room = (Rows - cmdline_row - 1) * Columns + sc_col - 1;
if ((force || (shortmess(SHM_TRUNC) && !exmode_active))
- && (int)STRLEN(s) - room > 0 && p_ch > 0) {
+ && (int)strlen(s) - room > 0 && p_ch > 0) {
int size = vim_strsize(s);
// There may be room anyway when there are multibyte chars.
@@ -968,7 +968,7 @@ static void add_msg_hist_multiattr(const char *s, int len, int attr, bool multil
struct msg_hist *p = xmalloc(sizeof(struct msg_hist));
if (s) {
if (len < 0) {
- len = (int)STRLEN(s);
+ len = (int)strlen(s);
}
// remove leading and trailing newlines
while (len > 0 && *s == '\n') {
@@ -1506,7 +1506,7 @@ int msg_outtrans(char *str)
int msg_outtrans_attr(const char *str, int attr)
{
- return msg_outtrans_len_attr(str, (int)STRLEN(str), attr);
+ return msg_outtrans_len_attr(str, (int)strlen(str), attr);
}
int msg_outtrans_len(const char *str, int len)
@@ -1588,7 +1588,7 @@ int msg_outtrans_len_attr(const char *msgstr, int len, int attr)
}
plain_start = str + 1;
msg_puts_attr((const char *)s, attr == 0 ? HL_ATTR(HLF_8) : attr);
- retval += (int)STRLEN(s);
+ retval += (int)strlen(s);
} else {
retval++;
}
@@ -1819,7 +1819,7 @@ void msg_prt_line(char *s, int list)
if (list) {
// find start of trailing whitespace
if (curwin->w_p_lcs_chars.trail) {
- trail = s + STRLEN(s);
+ trail = s + strlen(s);
while (trail > s && ascii_iswhite(trail[-1])) {
trail--;
}
@@ -2003,7 +2003,7 @@ void msg_puts_title(const char *s)
/// Does not handle multi-byte characters!
void msg_outtrans_long_attr(char *longstr, int attr)
{
- msg_outtrans_long_len_attr(longstr, (int)STRLEN(longstr), attr);
+ msg_outtrans_long_len_attr(longstr, (int)strlen(longstr), attr);
}
void msg_outtrans_long_len_attr(char *longstr, int len, int attr)
@@ -3291,7 +3291,7 @@ static void redir_write(const char *const str, const ptrdiff_t maxlen)
}
}
- size_t len = maxlen == -1 ? STRLEN(s) : (size_t)maxlen;
+ size_t len = maxlen == -1 ? strlen(s) : (size_t)maxlen;
if (capture_ga) {
ga_concat_len(capture_ga, str, len);
}
@@ -3633,9 +3633,9 @@ static char *console_dialog_alloc(const char *message, char *buttons, bool has_h
MB_PTR_ADV(r);
}
- len += (int)(STRLEN(message)
+ len += (int)(strlen(message)
+ 2 // for the NL's
- + STRLEN(buttons)
+ + strlen(buttons)
+ 3); // for the ": " and NUL
lenhotkey++; // for the NUL
@@ -3685,7 +3685,7 @@ static void copy_hotkeys_and_msg(const char *message, char *buttons, int default
*confirm_msg = '\n';
STRCPY(confirm_msg + 1, message);
- char *msgp = confirm_msg + 1 + STRLEN(message);
+ char *msgp = confirm_msg + 1 + strlen(message);
// Define first default hotkey. Keep the hotkey string NUL
// terminated to avoid reading past the end.
@@ -3709,7 +3709,7 @@ static void copy_hotkeys_and_msg(const char *message, char *buttons, int default
*msgp++ = ' '; // '\n' -> ', '
// Advance to next hotkey and set default hotkey
- hotkeys_ptr += STRLEN(hotkeys_ptr);
+ hotkeys_ptr += strlen(hotkeys_ptr);
hotkeys_ptr[copy_char(r + 1, hotkeys_ptr, true)] = NUL;
if (default_button_idx) {
diff --git a/src/nvim/msgpack_rpc/server.c b/src/nvim/msgpack_rpc/server.c
index 532e684f93..6f2d71629c 100644
--- a/src/nvim/msgpack_rpc/server.c
+++ b/src/nvim/msgpack_rpc/server.c
@@ -173,7 +173,7 @@ int server_start(const char *addr)
((SocketWatcher **)watchers.ga_data)[watchers.ga_len++] = watcher;
// Update v:servername, if not set.
- if (STRLEN(get_vim_var_str(VV_SEND_SERVER)) == 0) {
+ if (strlen(get_vim_var_str(VV_SEND_SERVER)) == 0) {
set_vservername(&watchers);
}
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index 326469bd38..249d5b6c0b 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -2752,7 +2752,7 @@ bool add_to_showcmd(int c)
STRCPY(p, "<20>");
}
size_t old_len = STRLEN(showcmd_buf);
- size_t extra_len = STRLEN(p);
+ size_t extra_len = strlen(p);
size_t limit = ui_has(kUIMessages) ? SHOWCMD_BUFLEN - 1 : SHOWCMD_COLS;
if (old_len + extra_len > limit) {
size_t overflow = old_len + extra_len - limit;
@@ -4057,7 +4057,7 @@ static void nv_colon(cmdarg_T *cap)
} else if (cap->oap->op_type != OP_NOP
&& (cap->oap->start.lnum > curbuf->b_ml.ml_line_count
|| cap->oap->start.col >
- (colnr_T)STRLEN(ml_get(cap->oap->start.lnum))
+ (colnr_T)strlen(ml_get(cap->oap->start.lnum))
|| did_emsg)) {
// The start of the operator has become invalid by the Ex command.
clearopbeep(cap->oap);
@@ -4216,7 +4216,7 @@ static size_t nv_K_getcmd(cmdarg_T *cap, char *kp, bool kp_help, bool kp_ex, cha
}
STRCAT(buf, " ");
if (cap->count0 != 0 && (isman || isman_s)) {
- snprintf(buf + STRLEN(buf), buf_size - STRLEN(buf), "%" PRId64,
+ snprintf(buf + strlen(buf), buf_size - strlen(buf), "%" PRId64,
(int64_t)cap->count0);
STRCAT(buf, " ");
}
@@ -4282,7 +4282,7 @@ static void nv_ident(cmdarg_T *cap)
return;
}
bool kp_ex = (*kp == ':'); // 'keywordprg' is an ex command
- size_t buf_size = n * 2 + 30 + STRLEN(kp);
+ size_t buf_size = n * 2 + 30 + strlen(kp);
char *buf = xmalloc(buf_size);
buf[0] = NUL;
@@ -4342,7 +4342,7 @@ static void nv_ident(cmdarg_T *cap)
p = (char *)vim_strsave_shellescape((char_u *)ptr, true, true);
}
xfree(ptr);
- char *newbuf = xrealloc(buf, STRLEN(buf) + STRLEN(p) + 1);
+ char *newbuf = xrealloc(buf, strlen(buf) + strlen(p) + 1);
buf = newbuf;
STRCAT(buf, p);
xfree(p);
@@ -4426,7 +4426,7 @@ bool get_visual_text(cmdarg_T *cap, char **pp, size_t *lenp)
}
if (VIsual_mode == 'V') {
*pp = get_cursor_line_ptr();
- *lenp = STRLEN(*pp);
+ *lenp = strlen(*pp);
} else {
if (lt(curwin->w_cursor, VIsual)) {
*pp = (char *)ml_get_pos(&curwin->w_cursor);
@@ -6151,7 +6151,7 @@ static void nv_gi_cmd(cmdarg_T *cap)
if (curbuf->b_last_insert.mark.lnum != 0) {
curwin->w_cursor = curbuf->b_last_insert.mark;
check_cursor_lnum();
- int i = (int)STRLEN(get_cursor_line_ptr());
+ int i = (int)strlen(get_cursor_line_ptr());
if (curwin->w_cursor.col > (colnr_T)i) {
if (virtual_active()) {
curwin->w_cursor.coladd += curwin->w_cursor.col - i;
@@ -6834,7 +6834,7 @@ bool unadjust_for_sel(void)
mark_mb_adjustpos(curbuf, pp);
} else if (pp->lnum > 1) {
pp->lnum--;
- pp->col = (colnr_T)STRLEN(ml_get(pp->lnum));
+ pp->col = (colnr_T)strlen(ml_get(pp->lnum));
return true;
}
}
@@ -6971,7 +6971,7 @@ void set_cursor_for_append_to_line(void)
coladvance(MAXCOL);
State = save_State;
} else {
- curwin->w_cursor.col += (colnr_T)STRLEN(get_cursor_pos_ptr());
+ curwin->w_cursor.col += (colnr_T)strlen(get_cursor_pos_ptr());
}
}
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 10e957287e..420f6cf840 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -2260,7 +2260,7 @@ void op_insert(oparg_T *oap, long count1)
if (oap->op_type == OP_APPEND) {
firstline += bd.textlen;
}
- pre_textlen = (long)STRLEN(firstline);
+ pre_textlen = (long)strlen(firstline);
}
if (oap->op_type == OP_APPEND) {
@@ -2386,7 +2386,7 @@ void op_insert(oparg_T *oap, long count1)
// Subsequent calls to ml_get() flush the firstline data - take a
// copy of the required string.
firstline = ml_get(oap->start.lnum);
- const size_t len = STRLEN(firstline);
+ const size_t len = strlen(firstline);
colnr_T add = bd.textcol;
colnr_T offset = 0; // offset when cursor was moved in insert mode
if (oap->op_type == OP_APPEND) {
@@ -2408,7 +2408,7 @@ void op_insert(oparg_T *oap, long count1)
} else {
firstline += add;
}
- ins_len = (long)STRLEN(firstline) - pre_textlen - offset;
+ ins_len = (long)strlen(firstline) - pre_textlen - offset;
if (pre_textlen >= 0 && ins_len > 0) {
ins_text = xstrnsave(firstline, (size_t)ins_len);
// block handled here
@@ -2992,7 +2992,7 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
// curwin->w_cursor.col marks the byte position of the cursor in the
// currunt line. It increases up to a max of
- // STRLEN(ml_get(curwin->w_cursor.lnum)). With 'virtualedit' and the
+ // strlen(ml_get(curwin->w_cursor.lnum)). With 'virtualedit' and the
// cursor past the end of the line, curwin->w_cursor.coladd is
// incremented instead of curwin->w_cursor.col.
char_u *cursor_pos = (char_u *)get_cursor_pos_ptr();
@@ -3174,7 +3174,7 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
goto end;
}
- yanklen = (int)STRLEN(y_array[0]);
+ yanklen = (int)strlen(y_array[0]);
if (cur_ve_flags == VE_ALL && y_type == kMTCharWise) {
if (gchar_cursor() == TAB) {
@@ -3259,7 +3259,7 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
}
// get the old line and advance to the position to insert at
oldp = get_cursor_line_ptr();
- oldlen = STRLEN(oldp);
+ oldlen = strlen(oldp);
chartabsize_T cts;
init_chartabsize_arg(&cts, curwin, curwin->w_cursor.lnum, 0, oldp, oldp);
@@ -3292,7 +3292,7 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
}
}
- yanklen = (int)STRLEN(y_array[i]);
+ yanklen = (int)strlen(y_array[i]);
if ((flags & PUT_BLOCK_INNER) == 0) {
// calculate number of spaces required to fill right side of
@@ -3380,7 +3380,7 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
curwin->w_cursor.col++;
// in Insert mode we might be after the NUL, correct for that
- len = (colnr_T)STRLEN(get_cursor_line_ptr());
+ len = (colnr_T)strlen(get_cursor_line_ptr());
if (curwin->w_cursor.col > len) {
curwin->w_cursor.col = len;
}
@@ -3444,7 +3444,7 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
totlen = (size_t)(count * yanklen);
do {
oldp = ml_get(lnum);
- oldlen = STRLEN(oldp);
+ oldlen = strlen(oldp);
if (lnum > start_lnum) {
pos_T pos = {
.lnum = lnum,
@@ -3515,8 +3515,8 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
// Then append y_array[0] to first line.
lnum = new_cursor.lnum;
ptr = ml_get(lnum) + col;
- totlen = STRLEN(y_array[y_size - 1]);
- newp = xmalloc((size_t)(STRLEN(ptr) + totlen + 1));
+ totlen = strlen(y_array[y_size - 1]);
+ newp = xmalloc((size_t)(strlen(ptr) + totlen + 1));
STRCPY(newp, y_array[y_size - 1]);
STRCAT(newp, ptr);
// insert second line
@@ -3550,7 +3550,7 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
curwin->w_cursor.lnum = lnum;
ptr = ml_get(lnum);
if (cnt == count && i == y_size - 1) {
- lendiff = (int)STRLEN(ptr);
+ lendiff = (int)strlen(ptr);
}
if (*ptr == '#' && preprocs_left()) {
indent = 0; // Leave # lines at start
@@ -3567,7 +3567,7 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
curwin->w_cursor = old_pos;
// remember how many chars were removed
if (cnt == count && i == y_size - 1) {
- lendiff -= (int)STRLEN(ml_get(lnum));
+ lendiff -= (int)strlen(ml_get(lnum));
}
}
}
@@ -3577,9 +3577,9 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
if (y_type == kMTCharWise
|| (y_type == kMTLineWise && flags & PUT_LINE_SPLIT)) {
for (i = 0; i < y_size - 1; i++) {
- totsize += (bcount_t)STRLEN(y_array[i]) + 1;
+ totsize += (bcount_t)strlen(y_array[i]) + 1;
}
- lastsize = (int)STRLEN(y_array[y_size - 1]);
+ lastsize = (int)strlen(y_array[y_size - 1]);
totsize += lastsize;
}
if (y_type == kMTCharWise) {
@@ -3623,7 +3623,7 @@ error:
// Put the '] mark on the first byte of the last inserted character.
// Correct the length for change in indent.
curbuf->b_op_end.lnum = new_lnum;
- len = STRLEN(y_array[y_size - 1]);
+ len = strlen(y_array[y_size - 1]);
col = (colnr_T)len - lendiff;
if (col > 1) {
curbuf->b_op_end.col = col - 1;
@@ -4019,7 +4019,7 @@ int do_join(size_t count, int insert_space, int save_undo, int use_formatoptions
if (t == 0 && setmark && (cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0) {
// Set the '[ mark.
curwin->w_buffer->b_op_start.lnum = curwin->w_cursor.lnum;
- curwin->w_buffer->b_op_start.col = (colnr_T)STRLEN(curr);
+ curwin->w_buffer->b_op_start.col = (colnr_T)strlen(curr);
}
if (remove_comments) {
// We don't want to remove the comment leader if the
@@ -4065,7 +4065,7 @@ int do_join(size_t count, int insert_space, int save_undo, int use_formatoptions
0, spaces[t], spaces[t],
kExtmarkUndo);
}
- currsize = (int)STRLEN(curr);
+ currsize = (int)strlen(curr);
sumsize += currsize + spaces[t];
endcurr1 = endcurr2 = NUL;
if (insert_space && currsize > 0) {
@@ -4130,7 +4130,7 @@ int do_join(size_t count, int insert_space, int save_undo, int use_formatoptions
if (insert_space && t > 1) {
curr = skipwhite(curr);
}
- currsize = (int)STRLEN(curr);
+ currsize = (int)strlen(curr);
}
ml_replace(curwin->w_cursor.lnum, newp, false);
@@ -4362,20 +4362,20 @@ void op_addsub(oparg_T *oap, linenr_T Prenum1, bool g_cmd)
} else if (oap->motion_type == kMTLineWise) {
curwin->w_cursor.col = 0;
pos.col = 0;
- length = (colnr_T)STRLEN(ml_get(pos.lnum));
+ length = (colnr_T)strlen(ml_get(pos.lnum));
} else {
// oap->motion_type == kMTCharWise
if (pos.lnum == oap->start.lnum && !oap->inclusive) {
dec(&(oap->end));
}
- length = (colnr_T)STRLEN(ml_get(pos.lnum));
+ length = (colnr_T)strlen(ml_get(pos.lnum));
pos.col = 0;
if (pos.lnum == oap->start.lnum) {
pos.col += oap->start.col;
length -= oap->start.col;
}
if (pos.lnum == oap->end.lnum) {
- length = (int)STRLEN(ml_get(oap->end.lnum));
+ length = (int)strlen(ml_get(oap->end.lnum));
if (oap->end.col >= length) {
oap->end.col = length - 1;
}
@@ -4923,7 +4923,7 @@ void *get_reg_contents(int regname, int flags)
// Compute length of resulting string.
size_t len = 0;
for (size_t i = 0; i < reg->y_size; i++) {
- len += STRLEN(reg->y_array[i]);
+ len += strlen(reg->y_array[i]);
// Insert a newline between lines and after last line if
// y_type is kMTLineWise.
if (reg->y_type == kMTLineWise || i < reg->y_size - 1) {
@@ -4937,7 +4937,7 @@ void *get_reg_contents(int regname, int flags)
len = 0;
for (size_t i = 0; i < reg->y_size; i++) {
STRCPY(retval + len, reg->y_array[i]);
- len += STRLEN(retval + len);
+ len += strlen(retval + len);
// Insert a NL between lines and after the last line if y_type is
// kMTLineWise.
@@ -5039,7 +5039,7 @@ void write_reg_contents_ex(int name, const char *str, ssize_t len, bool must_app
MotionType yank_type, colnr_T block_len)
{
if (len < 0) {
- len = (ssize_t)STRLEN(str);
+ len = (ssize_t)strlen(str);
}
// Special case: '/' search pattern
@@ -5059,7 +5059,7 @@ void write_reg_contents_ex(int name, const char *str, ssize_t len, bool must_app
semsg(_(e_nobufnr), (int64_t)num);
}
} else {
- buf = buflist_findnr(buflist_findpat(str, str + STRLEN(str),
+ buf = buflist_findnr(buflist_findpat(str, str + strlen(str),
true, false, false));
}
if (buf == NULL) {
@@ -5186,7 +5186,7 @@ static void str_to_reg(yankreg_T *y_ptr, MotionType yank_type, const char *str,
}
// When appending, copy the previous line and free it after.
- size_t extra = append ? STRLEN(pp[--lnum]) : 0;
+ size_t extra = append ? strlen(pp[--lnum]) : 0;
char *s = xmallocz(line_len + extra);
if (extra > 0) {
memcpy(s, pp[lnum], extra);
@@ -5486,7 +5486,7 @@ void cursor_pos_info(dict_T *dict)
bom_count = bomb_size();
if (dict == NULL && bom_count > 0) {
- const size_t len = STRLEN(IObuff);
+ const size_t len = strlen(IObuff);
vim_snprintf((char *)IObuff + len, IOSIZE - len,
_("(+%" PRId64 " for BOM)"), (int64_t)bom_count);
}
@@ -5845,10 +5845,10 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
if (lt(VIsual, curwin->w_cursor)) {
VIsual.col = 0;
curwin->w_cursor.col =
- (colnr_T)STRLEN(ml_get(curwin->w_cursor.lnum));
+ (colnr_T)strlen(ml_get(curwin->w_cursor.lnum));
} else {
curwin->w_cursor.col = 0;
- VIsual.col = (colnr_T)STRLEN(ml_get(VIsual.lnum));
+ VIsual.col = (colnr_T)strlen(ml_get(VIsual.lnum));
}
VIsual_mode = 'v';
} else if (VIsual_mode == 'v') {
@@ -5878,7 +5878,7 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
|| oap->motion_type == kMTLineWise)
&& hasFolding(curwin->w_cursor.lnum, NULL,
&curwin->w_cursor.lnum)) {
- curwin->w_cursor.col = (colnr_T)STRLEN(get_cursor_line_ptr());
+ curwin->w_cursor.col = (colnr_T)strlen(get_cursor_line_ptr());
}
}
oap->end = curwin->w_cursor;
@@ -5896,7 +5896,7 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
curwin->w_cursor.col = 0;
}
if (hasFolding(oap->start.lnum, NULL, &oap->start.lnum)) {
- oap->start.col = (colnr_T)STRLEN(ml_get(oap->start.lnum));
+ oap->start.col = (colnr_T)strlen(ml_get(oap->start.lnum));
}
}
oap->end = oap->start;
@@ -6080,7 +6080,7 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
if (inindent(0)) {
oap->motion_type = kMTLineWise;
} else {
- oap->end.col = (colnr_T)STRLEN(ml_get(oap->end.lnum));
+ oap->end.col = (colnr_T)strlen(ml_get(oap->end.lnum));
if (oap->end.col) {
oap->end.col--;
oap->inclusive = true;
@@ -6474,7 +6474,7 @@ bool prepare_yankreg_from_object(yankreg_T *reg, String regtype, size_t lines)
void finish_yankreg_from_object(yankreg_T *reg, bool clipboard_adjust)
{
- if (reg->y_size > 0 && STRLEN(reg->y_array[reg->y_size - 1]) == 0) {
+ if (reg->y_size > 0 && strlen(reg->y_array[reg->y_size - 1]) == 0) {
// a known-to-be charwise yank might have a final linebreak
// but otherwise there is no line after the final newline
if (reg->y_type != kMTCharWise) {
@@ -6495,7 +6495,7 @@ void finish_yankreg_from_object(yankreg_T *reg, bool clipboard_adjust)
if (reg->y_type == kMTBlockWise) {
size_t maxlen = 0;
for (size_t i = 0; i < reg->y_size; i++) {
- size_t rowlen = STRLEN(reg->y_array[i]);
+ size_t rowlen = strlen(reg->y_array[i]);
if (rowlen > maxlen) {
maxlen = rowlen;
}
@@ -6582,7 +6582,7 @@ static bool get_clipboard(int name, yankreg_T **target, bool quiet)
reg->y_array[tv_idx++] = xstrdupnul((const char *)TV_LIST_ITEM_TV(li)->vval.v_string);
});
- if (reg->y_size > 0 && STRLEN(reg->y_array[reg->y_size - 1]) == 0) {
+ if (reg->y_size > 0 && strlen(reg->y_array[reg->y_size - 1]) == 0) {
// a known-to-be charwise yank might have a final linebreak
// but otherwise there is no line after the final newline
if (reg->y_type != kMTCharWise) {
@@ -6601,7 +6601,7 @@ static bool get_clipboard(int name, yankreg_T **target, bool quiet)
if (reg->y_type == kMTBlockWise) {
size_t maxlen = 0;
for (size_t i = 0; i < reg->y_size; i++) {
- size_t rowlen = STRLEN(reg->y_array[i]);
+ size_t rowlen = strlen(reg->y_array[i]);
if (rowlen > maxlen) {
maxlen = rowlen;
}
@@ -6851,13 +6851,13 @@ bcount_t get_region_bytecount(buf_T *buf, linenr_T start_lnum, linenr_T end_lnum
return end_col - start_col;
}
const char *first = (const char *)ml_get_buf(buf, start_lnum, false);
- bcount_t deleted_bytes = (bcount_t)STRLEN(first) - start_col + 1;
+ bcount_t deleted_bytes = (bcount_t)strlen(first) - start_col + 1;
for (linenr_T i = 1; i <= end_lnum - start_lnum - 1; i++) {
if (start_lnum + i > max_lnum) {
return deleted_bytes;
}
- deleted_bytes += (bcount_t)STRLEN(ml_get_buf(buf, start_lnum + i, false)) + 1;
+ deleted_bytes += (bcount_t)strlen(ml_get_buf(buf, start_lnum + i, false)) + 1;
}
if (end_lnum > max_lnum) {
return deleted_bytes;
diff --git a/src/nvim/option.c b/src/nvim/option.c
index ab4db30aaf..de9510cf8a 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -1266,7 +1266,7 @@ int do_set(char *arg, int opt_flags)
// we need to remove the backslashes.
// get a bit too much
- newlen = (unsigned)STRLEN(arg) + 1;
+ newlen = (unsigned)strlen(arg) + 1;
if (adding || prepending || removing) {
newlen += (unsigned)STRLEN(origval) + 1;
}
@@ -1312,7 +1312,7 @@ int do_set(char *arg, int opt_flags)
s = option_expand(opt_idx, newval);
if (s != NULL) {
xfree(newval);
- newlen = (unsigned)STRLEN(s) + 1;
+ newlen = (unsigned)strlen(s) + 1;
if (adding || prepending || removing) {
newlen += (unsigned)STRLEN(origval) + 1;
}
@@ -1357,10 +1357,10 @@ int do_set(char *arg, int opt_flags)
i--;
}
memmove(newval + i + comma, newval,
- STRLEN(newval) + 1);
+ strlen(newval) + 1);
memmove(newval, origval, (size_t)i);
} else {
- i = (int)STRLEN(newval);
+ i = (int)strlen(newval);
STRMOVE(newval + i + comma, origval);
}
if (comma) {
@@ -1507,7 +1507,7 @@ skip:
if (errmsg != NULL) {
STRLCPY(IObuff, _(errmsg), IOSIZE);
- i = (int)STRLEN(IObuff) + 2;
+ i = (int)strlen(IObuff) + 2;
if (i + (arg - startarg) < IOSIZE) {
// append the argument with the error
STRCAT(IObuff, ": ");
@@ -1694,7 +1694,7 @@ static char *option_expand(int opt_idx, char *val)
// If val is longer than MAXPATHL no meaningful expansion can be done,
// expand_env() would truncate the string.
- if (val == NULL || STRLEN(val) > MAXPATHL) {
+ if (val == NULL || strlen(val) > MAXPATHL) {
return NULL;
}
@@ -2753,7 +2753,7 @@ int findoption_len(const char *const arg, const size_t len)
} else {
// Nvim: handle option aliases.
if (STRNCMP(options[opt_idx].fullname, "viminfo", 7) == 0) {
- if (STRLEN(options[opt_idx].fullname) == 7) {
+ if (strlen(options[opt_idx].fullname) == 7) {
return findoption_len("shada", 5);
}
assert(strcmp(options[opt_idx].fullname, "viminfofile") == 0);
@@ -3274,7 +3274,7 @@ static void showoptions(int all, int opt_flags)
len = 1; // a toggle option fits always
} else {
option_value2string(p, opt_flags);
- len = (int)STRLEN(p->fullname) + vim_strsize((char *)NameBuff) + 1;
+ len = (int)strlen(p->fullname) + vim_strsize((char *)NameBuff) + 1;
}
if ((len <= INC - GAP && run == 1)
|| (len > INC - GAP && run == 2)) {
@@ -3565,7 +3565,7 @@ static int put_setstring(FILE *fd, char *cmd, char *name, char **valuep, uint64_
}
}
} else if ((flags & P_EXPAND) != 0) {
- size_t size = (size_t)STRLEN(*valuep) + 1;
+ size_t size = (size_t)strlen(*valuep) + 1;
// replace home directory in the whole option value into "buf"
buf = xmalloc(size);
diff --git a/src/nvim/optionstr.c b/src/nvim/optionstr.c
index 9d21603754..7278b1a12d 100644
--- a/src/nvim/optionstr.c
+++ b/src/nvim/optionstr.c
@@ -464,7 +464,7 @@ static char *check_mousescroll(char *string)
for (;;) {
char *end = vim_strchr(string, ',');
- size_t length = end ? (size_t)(end - string) : STRLEN(string);
+ size_t length = end ? (size_t)(end - string) : strlen(string);
// Both "ver:" and "hor:" are 4 bytes long.
// They should be followed by at least one digit.
@@ -532,7 +532,7 @@ static int check_signcolumn(char *val)
}
// check for 'auto:<NUMBER>-<NUMBER>'
- if (STRLEN(val) == 8
+ if (strlen(val) == 8
&& !STRNCMP(val, "auto:", 5)
&& ascii_isdigit(val[5])
&& val[6] == '-'
@@ -1258,7 +1258,7 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
if (*p_pt) {
p = NULL;
(void)replace_termcodes(p_pt,
- STRLEN(p_pt),
+ strlen(p_pt),
&p, REPTERM_FROM_PART | REPTERM_DO_LT, NULL,
CPO_TO_CPO_FLAGS);
if (p != NULL) {
@@ -1641,7 +1641,7 @@ static int opt_strings_flags(char *val, char **values, unsigned *flagp, bool lis
return FAIL;
}
- size_t len = STRLEN(values[i]);
+ size_t len = strlen(values[i]);
if (STRNCMP(values[i], val, len) == 0
&& ((list && val[len] == ',') || val[len] == NUL)) {
val += len + (val[len] == ',');
diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c
index 34ed3aaf6e..bcc0fba8d0 100644
--- a/src/nvim/os/env.c
+++ b/src/nvim/os/env.c
@@ -451,7 +451,7 @@ void init_homedir(void)
var = NULL;
const char *exp = os_getenv(os_buf);
if (exp != NULL && *exp != NUL
- && STRLEN(exp) + STRLEN(p) < MAXPATHL) {
+ && strlen(exp) + strlen(p) < MAXPATHL) {
vim_snprintf(os_buf, MAXPATHL, "%s%s", exp, p + 1);
var = os_buf;
}
@@ -800,7 +800,7 @@ static char *vim_version_dir(const char *vimdir)
/// @return The new pend including dirname or just pend
static char *remove_tail(char *path, char *pend, char *dirname)
{
- size_t len = STRLEN(dirname);
+ size_t len = strlen(dirname);
char *new_tail = pend - len - 1;
if (new_tail >= path
@@ -1146,7 +1146,7 @@ char *home_replace_save(buf_T *buf, const char *src)
{
size_t len = 3; // space for "~/" and trailing NUL
if (src != NULL) { // just in case
- len += STRLEN(src);
+ len += strlen(src);
}
char *dst = xmalloc(len);
home_replace(buf, src, dst, len, true);
diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c
index cf66899493..ca3e32e871 100644
--- a/src/nvim/os/shell.c
+++ b/src/nvim/os/shell.c
@@ -178,7 +178,7 @@ int os_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, in
// STYLE_ECHO: space separated.
// A shell we don't know, stay safe and use "echo".
if (num_pat == 1 && *pat[0] == '`'
- && (len = STRLEN(pat[0])) > 2
+ && (len = strlen(pat[0])) > 2
&& *(pat[0] + len - 1) == '`') {
shell_style = STYLE_BT;
} else if ((len = STRLEN(p_sh)) >= 3) {
@@ -198,7 +198,7 @@ int os_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, in
// Worst case: "unset nonomatch; print -N >" plus two is 29
len = STRLEN(tempname) + 29;
if (shell_style == STYLE_VIMGLOB) {
- len += STRLEN(sh_vimglob_func);
+ len += strlen(sh_vimglob_func);
}
for (i = 0; i < num_pat; i++) {
@@ -519,7 +519,7 @@ int os_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, in
continue;
}
- p = xmalloc(STRLEN((*file)[i]) + 1 + dir);
+ p = xmalloc(strlen((*file)[i]) + 1 + dir);
STRCPY(p, (*file)[i]);
if (dir) {
add_pathsep((char *)p); // add '/' to a directory name
@@ -1319,7 +1319,7 @@ static char *shell_xescape_xquote(const char *cmd)
if (*p_sxe != NUL && strcmp(p_sxq, "(") == 0) {
ecmd = (char *)vim_strsave_escaped_ext((char_u *)cmd, p_sxe, '^', false);
}
- size_t ncmd_size = strlen(ecmd) + STRLEN(p_sxq) * 2 + 1;
+ size_t ncmd_size = strlen(ecmd) + strlen(p_sxq) * 2 + 1;
char *ncmd = xmalloc(ncmd_size);
// When 'shellxquote' is ( append ).
diff --git a/src/nvim/os/users.c b/src/nvim/os/users.c
index 0c662e8843..7b0f3ddaed 100644
--- a/src/nvim/os/users.c
+++ b/src/nvim/os/users.c
@@ -210,7 +210,7 @@ char *get_users(expand_T *xp, int idx)
/// 2 is name fully matches a user name.
int match_user(char *name)
{
- int n = (int)STRLEN(name);
+ int n = (int)strlen(name);
int result = 0;
init_users();
diff --git a/src/nvim/path.c b/src/nvim/path.c
index 38112be3ce..d02525c3ff 100644
--- a/src/nvim/path.c
+++ b/src/nvim/path.c
@@ -811,8 +811,8 @@ static bool is_unique(char *maybe_unique, garray_T *gap, int i)
if (j == i) {
continue; // don't compare it with itself
}
- size_t candidate_len = STRLEN(maybe_unique);
- size_t other_path_len = STRLEN(other_paths[j]);
+ size_t candidate_len = strlen(maybe_unique);
+ size_t other_path_len = strlen(other_paths[j]);
if (other_path_len < candidate_len) {
continue; // it's different when it's shorter
}
@@ -849,7 +849,7 @@ static void expand_path_option(char_u *curdir, garray_T *gap)
}
char_u *p = (char_u *)path_tail(curbuf->b_ffname);
size_t len = (size_t)(p - (char_u *)curbuf->b_ffname);
- if (len + STRLEN(buf) >= MAXPATHL) {
+ if (len + strlen(buf) >= MAXPATHL) {
continue;
}
if (buf[1] == NUL) {
@@ -866,7 +866,7 @@ static void expand_path_option(char_u *curdir, garray_T *gap)
} else if (!path_is_absolute((char_u *)buf)) {
// Expand relative path to their full path equivalent
size_t len = STRLEN(curdir);
- if (len + STRLEN(buf) + 3 > MAXPATHL) {
+ if (len + strlen(buf) + 3 > MAXPATHL) {
continue;
}
STRMOVE(buf + len + 1, buf);
@@ -988,7 +988,7 @@ static void uniquefy_paths(garray_T *gap, char_u *pattern)
&& vim_regexec(&regmatch, path_cutoff, (colnr_T)0)
&& is_unique(path_cutoff, gap, i)) {
sort_again = true;
- memmove(path, path_cutoff, STRLEN(path_cutoff) + 1);
+ memmove(path, path_cutoff, strlen(path_cutoff) + 1);
} else {
// Here all files can be reached without path, so get shortest
// unique path. We start at the end of the path. */
@@ -998,7 +998,7 @@ static void uniquefy_paths(garray_T *gap, char_u *pattern)
&& is_unique(pathsep_p + 1, gap, i)
&& path_cutoff != NULL && pathsep_p + 1 >= path_cutoff) {
sort_again = true;
- memmove(path, pathsep_p + 1, STRLEN(pathsep_p));
+ memmove(path, pathsep_p + 1, strlen(pathsep_p));
break;
}
}
@@ -1045,7 +1045,7 @@ static void uniquefy_paths(garray_T *gap, char_u *pattern)
continue;
}
- rel_path = xmalloc(STRLEN(short_name) + STRLEN(PATHSEPSTR) + 2);
+ rel_path = xmalloc(strlen(short_name) + strlen(PATHSEPSTR) + 2);
STRCPY(rel_path, ".");
add_pathsep(rel_path);
STRCAT(rel_path, short_name);
@@ -1360,7 +1360,7 @@ static int expand_backtick(garray_T *gap, char *pat, int flags)
int cnt = 0;
// Create the command: lop off the backticks.
- char *cmd = xstrnsave(pat + 1, STRLEN(pat) - 2);
+ char *cmd = xstrnsave(pat + 1, strlen(pat) - 2);
if (*cmd == '=') { // `={expr}`: Expand expression
buffer = eval_to_string(cmd + 1, &p, true);
@@ -1415,7 +1415,7 @@ void slash_adjust(char_u *p)
if (*p == '`') {
// don't replace backslash in backtick quoted strings
- const size_t len = STRLEN(p);
+ const size_t len = strlen(p);
if (len > 2 && *(p + len - 1) == '`') {
return;
}
@@ -1678,7 +1678,7 @@ char *find_file_name_in_path(char *ptr, size_t len, int options, long count, cha
tofree = eval_includeexpr(ptr, len);
if (tofree != NULL) {
ptr = tofree;
- len = STRLEN(ptr);
+ len = strlen(ptr);
}
}
@@ -1693,7 +1693,7 @@ char *find_file_name_in_path(char *ptr, size_t len, int options, long count, cha
tofree = eval_includeexpr(ptr, len);
if (tofree != NULL) {
ptr = tofree;
- len = STRLEN(ptr);
+ len = strlen(ptr);
file_name = (char *)find_file_in_path((char_u *)ptr, len, options & ~FNAME_MESS,
true, (char_u *)rel_fname);
}
@@ -2066,7 +2066,7 @@ char *path_shorten_fname(char *full_path, char *dir_name)
}
assert(dir_name != NULL);
- size_t len = STRLEN(dir_name);
+ size_t len = strlen(dir_name);
// If dir_name is a path head, full_path can always be made relative.
if (len == (size_t)path_head_length() && is_path_head((char_u *)dir_name)) {
@@ -2232,7 +2232,7 @@ int match_suffix(char *fname)
#define MAXSUFLEN 30 // maximum length of a file suffix
char suf_buf[MAXSUFLEN];
- size_t fnamelen = STRLEN(fname);
+ size_t fnamelen = strlen(fname);
size_t setsuflen = 0;
for (char_u *setsuf = p_su; *setsuf;) {
setsuflen = copy_option_part((char **)&setsuf, (char *)suf_buf, MAXSUFLEN, ".,");
diff --git a/src/nvim/popupmenu.c b/src/nvim/popupmenu.c
index 4de3713f4f..5483c9cb94 100644
--- a/src/nvim/popupmenu.c
+++ b/src/nvim/popupmenu.c
@@ -542,7 +542,7 @@ void pum_redraw(void)
size++;
}
}
- grid_puts_len(&pum_grid, rt, (int)STRLEN(rt), row, grid_col - size + 1, attr);
+ grid_puts_len(&pum_grid, rt, (int)strlen(rt), row, grid_col - size + 1, attr);
xfree(rt_start);
xfree(st);
grid_col -= width;
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c
index 9494308ef0..eeba7fe3c3 100644
--- a/src/nvim/quickfix.c
+++ b/src/nvim/quickfix.c
@@ -548,9 +548,9 @@ static void free_efm_list(efm_T **efm_first)
/// a regular expression pattern.
static size_t efm_regpat_bufsz(char *efm)
{
- size_t sz = (FMT_PATTERNS * 3) + (STRLEN(efm) << 2);
+ size_t sz = (FMT_PATTERNS * 3) + (strlen(efm) << 2);
for (int i = FMT_PATTERNS - 1; i >= 0;) {
- sz += STRLEN(fmt_pat[i--].pattern);
+ sz += strlen(fmt_pat[i--].pattern);
}
#ifdef BACKSLASH_IN_FILENAME
sz += 12; // "%f" can become twelve chars longer (see efm_to_regpat)
@@ -652,7 +652,7 @@ static int qf_get_next_str_line(qfstate_T *state)
}
char *p = vim_strchr(p_str, '\n');
- size_t len = (p != NULL) ? (size_t)(p - p_str) + 1 : STRLEN(p_str);
+ size_t len = (p != NULL) ? (size_t)(p - p_str) + 1 : strlen(p_str);
if (len > IOSIZE - 2) {
state->linebuf = qf_grow_linebuf(state, len);
@@ -688,7 +688,7 @@ static int qf_get_next_list_line(qfstate_T *state)
return QF_END_OF_INPUT;
}
- size_t len = STRLEN(TV_LIST_ITEM_TV(p_li)->vval.v_string);
+ size_t len = strlen(TV_LIST_ITEM_TV(p_li)->vval.v_string);
if (len > IOSIZE - 2) {
state->linebuf = qf_grow_linebuf(state, len);
} else {
@@ -713,7 +713,7 @@ static int qf_get_next_buf_line(qfstate_T *state)
char *p_buf = ml_get_buf(state->buf, state->buflnum, false);
state->buflnum += 1;
- size_t len = STRLEN(p_buf);
+ size_t len = strlen(p_buf);
if (len > IOSIZE - 2) {
state->linebuf = qf_grow_linebuf(state, len);
} else {
@@ -738,7 +738,7 @@ retry:
}
bool discard = false;
- state->linelen = STRLEN(IObuff);
+ state->linelen = strlen(IObuff);
if (state->linelen == IOSIZE - 1
&& !(IObuff[state->linelen - 1] == '\n')) {
// The current line exceeds IObuff, continue reading using growbuf
@@ -761,7 +761,7 @@ retry:
}
break;
}
- state->linelen = STRLEN(state->growbuf + growbuflen);
+ state->linelen = strlen(state->growbuf + growbuflen);
growbuflen += state->linelen;
if (state->growbuf[growbuflen - 1] == '\n') {
break;
@@ -786,7 +786,7 @@ retry:
}
break;
}
- if (STRLEN(IObuff) < IOSIZE - 1 || IObuff[IOSIZE - 2] == '\n') {
+ if (strlen(IObuff) < IOSIZE - 1 || IObuff[IOSIZE - 2] == '\n') {
break;
}
}
@@ -1175,7 +1175,7 @@ static void qf_store_title(qf_list_T *qfl, const char *title)
XFREE_CLEAR(qfl->qf_title);
if (title != NULL) {
- size_t len = STRLEN(title) + 1;
+ size_t len = strlen(title) + 1;
char *p = xmallocz(len);
qfl->qf_title = p;
@@ -1424,7 +1424,7 @@ static int qf_parse_fmt_o(regmatch_T *rmp, int midx, qffields_T *fields)
return QF_FAIL;
}
size_t len = (size_t)(rmp->endp[midx] - rmp->startp[midx]);
- size_t dsize = STRLEN(fields->module) + len + 1;
+ size_t dsize = strlen(fields->module) + len + 1;
if (dsize > CMDBUFFSIZE) {
dsize = CMDBUFFSIZE;
}
@@ -1609,8 +1609,8 @@ static int qf_parse_multiline_pfx(int idx, qf_list_T *qfl, qffields_T *fields)
return QF_FAIL;
}
if (*fields->errmsg) {
- size_t textlen = STRLEN(qfprev->qf_text);
- size_t errlen = STRLEN(fields->errmsg);
+ size_t textlen = strlen(qfprev->qf_text);
+ size_t errlen = strlen(fields->errmsg);
qfprev->qf_text = xrealloc(qfprev->qf_text, textlen + errlen + 2);
qfprev->qf_text[textlen] = '\n';
STRCPY(qfprev->qf_text + textlen + 1, fields->errmsg);
@@ -2791,7 +2791,7 @@ static void qf_jump_print_msg(qf_info_T *qi, int qf_index, qfline_T *qf_ptr, buf
qf_ptr->qf_cleared ? _(" (line deleted)") : "",
qf_types(qf_ptr->qf_type, qf_ptr->qf_nr));
// Add the message, skipping leading whitespace and newlines.
- int len = (int)STRLEN(IObuff);
+ int len = (int)strlen(IObuff);
qf_fmt_text(skipwhite(qf_ptr->qf_text), (char *)IObuff + len, IOSIZE - len);
// Output the message. Overwrite to avoid scrolling when the 'O'
@@ -3064,7 +3064,7 @@ static void qf_list_entry(qfline_T *qfp, int qf_idx, bool cursel)
} else {
qf_range_text(qfp, (char *)IObuff, IOSIZE);
}
- vim_snprintf((char *)IObuff + STRLEN(IObuff), IOSIZE, "%s", qf_types(qfp->qf_type, qfp->qf_nr));
+ vim_snprintf((char *)IObuff + strlen(IObuff), IOSIZE, "%s", qf_types(qfp->qf_type, qfp->qf_nr));
msg_puts_attr((const char *)IObuff, qfLineAttr);
msg_puts_attr(":", qfSepAttr);
if (qfp->qf_pattern != NULL) {
@@ -3076,7 +3076,7 @@ static void qf_list_entry(qfline_T *qfp, int qf_idx, bool cursel)
char *tbuf = IObuff;
size_t tbuflen = IOSIZE;
- size_t len = STRLEN(qfp->qf_text) + 3;
+ size_t len = strlen(qfp->qf_text) + 3;
if (len > IOSIZE) {
tbuf = xmalloc(len);
@@ -3198,18 +3198,18 @@ static void qf_fmt_text(const char *restrict text, char *restrict buf, int bufsi
static void qf_range_text(const qfline_T *qfp, char *buf, int bufsize)
{
vim_snprintf(buf, (size_t)bufsize, "%" PRIdLINENR, qfp->qf_lnum);
- int len = (int)STRLEN(buf);
+ int len = (int)strlen(buf);
if (qfp->qf_end_lnum > 0 && qfp->qf_lnum != qfp->qf_end_lnum) {
vim_snprintf(buf + len, (size_t)(bufsize - len), "-%" PRIdLINENR, qfp->qf_end_lnum);
- len += (int)STRLEN(buf + len);
+ len += (int)strlen(buf + len);
}
if (qfp->qf_col > 0) {
vim_snprintf(buf + len, (size_t)(bufsize - len), " col %d", qfp->qf_col);
- len += (int)STRLEN(buf + len);
+ len += (int)strlen(buf + len);
if (qfp->qf_end_col > 0 && qfp->qf_col != qfp->qf_end_col) {
vim_snprintf(buf + len, (size_t)(bufsize - len), "-%d", qfp->qf_end_col);
- len += (int)STRLEN(buf + len);
+ len += (int)strlen(buf + len);
}
}
buf[len] = NUL;
@@ -3230,7 +3230,7 @@ static void qf_msg(qf_info_T *qi, int which, char *lead)
count);
if (title != NULL) {
- size_t len = STRLEN(buf);
+ size_t len = strlen(buf);
if (len < 34) {
memset(buf + len, ' ', 34 - len);
@@ -3915,7 +3915,7 @@ static int qf_buf_add_line(qf_list_T *qfl, buf_T *buf, linenr_T lnum, const qfli
int len;
if (qfp->qf_module != NULL) {
STRLCPY(IObuff, qfp->qf_module, IOSIZE);
- len = (int)STRLEN(IObuff);
+ len = (int)strlen(IObuff);
} else if (qfp->qf_fnum != 0
&& (errbuf = buflist_findnr(qfp->qf_fnum)) != NULL
&& errbuf->b_fname != NULL) {
@@ -3935,7 +3935,7 @@ static int qf_buf_add_line(qf_list_T *qfl, buf_T *buf, linenr_T lnum, const qfli
}
STRLCPY(IObuff, errbuf->b_fname, IOSIZE);
}
- len = (int)STRLEN(IObuff);
+ len = (int)strlen(IObuff);
} else {
len = 0;
}
@@ -3944,14 +3944,14 @@ static int qf_buf_add_line(qf_list_T *qfl, buf_T *buf, linenr_T lnum, const qfli
}
if (qfp->qf_lnum > 0) {
qf_range_text(qfp, (char *)IObuff + len, IOSIZE - len);
- len += (int)STRLEN(IObuff + len);
+ len += (int)strlen(IObuff + len);
snprintf((char *)IObuff + len, (size_t)(IOSIZE - len), "%s", qf_types(qfp->qf_type,
qfp->qf_nr));
- len += (int)STRLEN(IObuff + len);
+ len += (int)strlen(IObuff + len);
} else if (qfp->qf_pattern != NULL) {
qf_fmt_text(qfp->qf_pattern, (char *)IObuff + len, IOSIZE - len);
- len += (int)STRLEN(IObuff + len);
+ len += (int)strlen(IObuff + len);
}
if (len < IOSIZE - 2) {
IObuff[len++] = '|';
@@ -4210,9 +4210,9 @@ static char *make_get_auname(cmdidx_T cmdidx)
static char *make_get_fullcmd(const char *makecmd, const char *fname)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_RET
{
- size_t len = STRLEN(p_shq) * 2 + STRLEN(makecmd) + 1;
+ size_t len = STRLEN(p_shq) * 2 + strlen(makecmd) + 1;
if (*p_sp != NUL) {
- len += STRLEN(p_sp) + STRLEN(fname) + 3;
+ len += strlen(p_sp) + strlen(fname) + 3;
}
char *const cmd = xmalloc(len);
snprintf(cmd, len, "%s%s%s", (char *)p_shq, (char *)makecmd, (char *)p_shq);
@@ -4342,9 +4342,9 @@ static char *get_mef_name(void)
} else {
off += 19;
}
- name = xmalloc(STRLEN(p_mef) + 30);
+ name = xmalloc(strlen(p_mef) + 30);
STRCPY(name, p_mef);
- snprintf(name + (p - p_mef), STRLEN(name), "%d%d", start, off);
+ snprintf(name + (p - p_mef), strlen(name), "%d%d", start, off);
STRCAT(name, p + 2);
// Don't accept a symbolic link, it's a security risk.
FileInfo file_info;
@@ -5137,7 +5137,7 @@ static bool vgr_match_buflines(qf_list_T *qfl, char *fname, buf_T *buf, char *sp
FUNC_ATTR_NONNULL_ARG(1, 3, 4, 5, 6)
{
bool found_match = false;
- const size_t pat_len = STRLEN(spat);
+ const size_t pat_len = strlen(spat);
for (linenr_T lnum = 1; lnum <= buf->b_ml.ml_line_count && *tomatch > 0; lnum++) {
colnr_T col = 0;
@@ -5174,7 +5174,7 @@ static bool vgr_match_buflines(qf_list_T *qfl, char *fname, buf_T *buf, char *sp
break;
}
col = regmatch->endpos[0].col + (col == regmatch->endpos[0].col);
- if (col > (colnr_T)STRLEN(ml_get_buf(buf, lnum, false))) {
+ if (col > (colnr_T)strlen(ml_get_buf(buf, lnum, false))) {
break;
}
}
@@ -5217,7 +5217,7 @@ static bool vgr_match_buflines(qf_list_T *qfl, char *fname, buf_T *buf, char *sp
break;
}
col = (colnr_T)matches[pat_len - 1] + col + 1;
- if (col > (colnr_T)STRLEN(str)) {
+ if (col > (colnr_T)strlen(str)) {
break;
}
}
@@ -6952,7 +6952,7 @@ static void hgr_search_file(qf_list_T *qfl, char *fname, regmatch_T *p_regmatch)
char *line = (char *)IObuff;
if (vim_regexec(p_regmatch, line, (colnr_T)0)) {
- int l = (int)STRLEN(line);
+ int l = (int)strlen(line);
// remove trailing CR, LF, spaces, etc.
while (l > 0 && line[l - 1] <= ' ') {
@@ -7009,9 +7009,9 @@ static void hgr_search_files_in_dir(qf_list_T *qfl, char *dirname, regmatch_T *p
for (int fi = 0; fi < fcount && !got_int; fi++) {
// Skip files for a different language.
if (lang != NULL
- && STRNICMP(lang, fnames[fi] + STRLEN(fnames[fi]) - 3, 2) != 0
+ && STRNICMP(lang, fnames[fi] + strlen(fnames[fi]) - 3, 2) != 0
&& !(STRNICMP(lang, "en", 2) == 0
- && STRNICMP("txt", fnames[fi] + STRLEN(fnames[fi]) - 3, 3)
+ && STRNICMP("txt", fnames[fi] + strlen(fnames[fi]) - 3, 3)
== 0)) {
continue;
}
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c
index 9a8890a28a..a2ea096cb9 100644
--- a/src/nvim/regexp.c
+++ b/src/nvim/regexp.c
@@ -227,8 +227,8 @@ static int get_char_class(char **pp)
if ((*pp)[1] == ':') {
for (i = 0; i < (int)ARRAY_SIZE(class_names); i++) {
- if (STRNCMP(*pp + 2, class_names[i], STRLEN(class_names[i])) == 0) {
- *pp += STRLEN(class_names[i]) + 2;
+ if (STRNCMP(*pp + 2, class_names[i], strlen(class_names[i])) == 0) {
+ *pp += strlen(class_names[i]) + 2;
return i;
}
}
@@ -1545,8 +1545,8 @@ char *regtilde(char *source, int magic, bool preview)
if ((*p == '~' && magic) || (*p == '\\' && *(p + 1) == '~' && !magic)) {
if (reg_prev_sub != NULL) {
// length = len(newsub) - 1 + len(prev_sub) + 1
- prevlen = (int)STRLEN(reg_prev_sub);
- tmpsub = xmalloc(STRLEN(newsub) + (size_t)prevlen);
+ prevlen = (int)strlen(reg_prev_sub);
+ tmpsub = xmalloc(strlen(newsub) + (size_t)prevlen);
// copy prefix
len = (int)(p - newsub); // not including ~
memmove(tmpsub, newsub, (size_t)len);
@@ -1767,7 +1767,7 @@ static int vim_regsub_both(char_u *source, typval_T *expr, char_u *dest, int des
if (copy) {
if (eval_result[nested] != NULL) {
STRCPY(dest, eval_result[nested]);
- dst += STRLEN(eval_result[nested]);
+ dst += strlen(eval_result[nested]);
XFREE_CLEAR(eval_result[nested]);
}
} else {
@@ -1865,7 +1865,7 @@ static int vim_regsub_both(char_u *source, typval_T *expr, char_u *dest, int des
eval_result[nested] = (char *)s;
}
- dst += STRLEN(eval_result[nested]);
+ dst += strlen(eval_result[nested]);
}
can_f_submatch = prev_can_f_submatch;
@@ -2172,7 +2172,7 @@ char *reg_submatch(int no)
} else {
// Multiple lines: take start line from start col, middle
// lines completely and end line up to end col.
- len = (ssize_t)STRLEN(s);
+ len = (ssize_t)strlen(s);
if (round == 2) {
STRCPY(retval, s);
retval[len] = '\n';
@@ -2184,7 +2184,7 @@ char *reg_submatch(int no)
if (round == 2) {
STRCPY(retval + len, s);
}
- len += (ssize_t)STRLEN(s);
+ len += (ssize_t)strlen(s);
if (round == 2) {
retval[len] = '\n';
}
diff --git a/src/nvim/regexp_bt.c b/src/nvim/regexp_bt.c
index 59a6ed28af..ac33fc0f13 100644
--- a/src/nvim/regexp_bt.c
+++ b/src/nvim/regexp_bt.c
@@ -5594,7 +5594,7 @@ static char_u *regprop(char_u *op)
case MOPEN + 7:
case MOPEN + 8:
case MOPEN + 9:
- sprintf(buf + STRLEN(buf), "MOPEN%d", OP(op) - MOPEN);
+ snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "MOPEN%d", OP(op) - MOPEN);
p = NULL;
break;
case MCLOSE + 0:
@@ -5609,7 +5609,7 @@ static char_u *regprop(char_u *op)
case MCLOSE + 7:
case MCLOSE + 8:
case MCLOSE + 9:
- sprintf(buf + STRLEN(buf), "MCLOSE%d", OP(op) - MCLOSE);
+ snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "MCLOSE%d", OP(op) - MCLOSE);
p = NULL;
break;
case BACKREF + 1:
@@ -5621,7 +5621,7 @@ static char_u *regprop(char_u *op)
case BACKREF + 7:
case BACKREF + 8:
case BACKREF + 9:
- sprintf(buf + STRLEN(buf), "BACKREF%d", OP(op) - BACKREF);
+ snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "BACKREF%d", OP(op) - BACKREF);
p = NULL;
break;
case NOPEN:
@@ -5639,7 +5639,7 @@ static char_u *regprop(char_u *op)
case ZOPEN + 7:
case ZOPEN + 8:
case ZOPEN + 9:
- sprintf(buf + STRLEN(buf), "ZOPEN%d", OP(op) - ZOPEN);
+ snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "ZOPEN%d", OP(op) - ZOPEN);
p = NULL;
break;
case ZCLOSE + 1:
@@ -5651,7 +5651,7 @@ static char_u *regprop(char_u *op)
case ZCLOSE + 7:
case ZCLOSE + 8:
case ZCLOSE + 9:
- sprintf(buf + STRLEN(buf), "ZCLOSE%d", OP(op) - ZCLOSE);
+ snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "ZCLOSE%d", OP(op) - ZCLOSE);
p = NULL;
break;
case ZREF + 1:
@@ -5663,7 +5663,7 @@ static char_u *regprop(char_u *op)
case ZREF + 7:
case ZREF + 8:
case ZREF + 9:
- sprintf(buf + STRLEN(buf), "ZREF%d", OP(op) - ZREF);
+ snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "ZREF%d", OP(op) - ZREF);
p = NULL;
break;
case STAR:
@@ -5703,7 +5703,8 @@ static char_u *regprop(char_u *op)
case BRACE_COMPLEX + 7:
case BRACE_COMPLEX + 8:
case BRACE_COMPLEX + 9:
- sprintf(buf + STRLEN(buf), "BRACE_COMPLEX%d", OP(op) - BRACE_COMPLEX);
+ snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "BRACE_COMPLEX%d",
+ OP(op) - BRACE_COMPLEX);
p = NULL;
break;
case MULTIBYTECODE:
@@ -5713,7 +5714,7 @@ static char_u *regprop(char_u *op)
p = "NEWL";
break;
default:
- sprintf(buf + STRLEN(buf), "corrupt %d", OP(op));
+ snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "corrupt %d", OP(op));
p = NULL;
break;
}
diff --git a/src/nvim/runtime.c b/src/nvim/runtime.c
index 78a157f9fb..223865b918 100644
--- a/src/nvim/runtime.c
+++ b/src/nvim/runtime.c
@@ -250,7 +250,7 @@ int do_in_path(char *path, char *name, int flags, DoInRuntimepathCB callback, vo
while (*rtp != NUL && ((flags & DIP_ALL) || !did_one)) {
// Copy the path from 'runtimepath' to buf[].
copy_option_part(&rtp, buf, MAXPATHL, ",");
- size_t buflen = STRLEN(buf);
+ size_t buflen = strlen(buf);
// Skip after or non-after directories.
if (flags & (DIP_NOAFTER | DIP_AFTER)) {
@@ -265,9 +265,9 @@ int do_in_path(char *path, char *name, int flags, DoInRuntimepathCB callback, vo
if (name == NULL) {
(*callback)(buf, cookie);
did_one = true;
- } else if (buflen + STRLEN(name) + 2 < MAXPATHL) {
+ } else if (buflen + strlen(name) + 2 < MAXPATHL) {
add_pathsep(buf);
- tail = buf + STRLEN(buf);
+ tail = buf + strlen(buf);
// Loop over all patterns in "name"
char *np = name;
@@ -397,10 +397,10 @@ int do_in_cached_path(char *name, int flags, DoInRuntimepathCB callback, void *c
if (name == NULL) {
(*callback)(item.path, cookie);
- } else if (buflen + STRLEN(name) + 2 < MAXPATHL) {
+ } else if (buflen + strlen(name) + 2 < MAXPATHL) {
STRCPY(buf, item.path);
add_pathsep(buf);
- tail = buf + STRLEN(buf);
+ tail = buf + strlen(buf);
// Loop over all patterns in "name"
char *np = name;
@@ -545,7 +545,7 @@ int do_in_path_and_pp(char *path, char *name, int flags, DoInRuntimepathCB callb
if ((done == FAIL || (flags & DIP_ALL)) && (flags & DIP_START)) {
char *start_dir = "pack/*/start/*/%s%s"; // NOLINT
- size_t len = STRLEN(start_dir) + STRLEN(name) + 6;
+ size_t len = strlen(start_dir) + strlen(name) + 6;
char *s = xmallocz(len); // TODO(bfredl): get rid of random allocations
char *suffix = (flags & DIP_AFTER) ? "after/" : "";
@@ -556,7 +556,7 @@ int do_in_path_and_pp(char *path, char *name, int flags, DoInRuntimepathCB callb
if (done == FAIL || (flags & DIP_ALL)) {
start_dir = "start/*/%s%s"; // NOLINT
- len = STRLEN(start_dir) + STRLEN(name) + 6;
+ len = strlen(start_dir) + strlen(name) + 6;
s = xmallocz(len);
vim_snprintf(s, len, start_dir, suffix, name);
@@ -568,7 +568,7 @@ int do_in_path_and_pp(char *path, char *name, int flags, DoInRuntimepathCB callb
if ((done == FAIL || (flags & DIP_ALL)) && (flags & DIP_OPT)) {
char *opt_dir = "pack/*/opt/*/%s"; // NOLINT
- size_t len = STRLEN(opt_dir) + STRLEN(name);
+ size_t len = strlen(opt_dir) + strlen(name);
char *s = xmallocz(len);
vim_snprintf(s, len, opt_dir, name);
@@ -578,7 +578,7 @@ int do_in_path_and_pp(char *path, char *name, int flags, DoInRuntimepathCB callb
if (done == FAIL || (flags & DIP_ALL)) {
opt_dir = "opt/*/%s"; // NOLINT
- len = STRLEN(opt_dir) + STRLEN(name);
+ len = strlen(opt_dir) + strlen(name);
s = xmallocz(len);
vim_snprintf(s, len, opt_dir, name);
@@ -630,13 +630,13 @@ static void expand_pack_entry(RuntimeSearchPath *search_path, Map(String, handle
static char buf[MAXPATHL];
char *(start_pat[]) = { "/pack/*/start/*", "/start/*" }; // NOLINT
for (int i = 0; i < 2; i++) {
- if (pack_entry_len + STRLEN(start_pat[i]) + 1 > sizeof buf) {
+ if (pack_entry_len + strlen(start_pat[i]) + 1 > sizeof buf) {
continue;
}
STRLCPY(buf, pack_entry, sizeof buf);
STRLCPY(buf + pack_entry_len, start_pat[i], sizeof buf - pack_entry_len);
expand_rtp_entry(search_path, rtp_used, buf, false);
- size_t after_size = STRLEN(buf) + 7;
+ size_t after_size = strlen(buf) + 7;
char *after = xmallocz(after_size);
xstrlcpy(after, buf, after_size);
xstrlcat(after, "/after", after_size);
@@ -669,7 +669,7 @@ RuntimeSearchPath runtime_search_path_build(void)
char *cur_entry = entry;
copy_option_part(&entry, buf, MAXPATHL, ",");
- String the_entry = { .data = cur_entry, .size = STRLEN(buf) };
+ String the_entry = { .data = cur_entry, .size = strlen(buf) };
kv_push(pack_entries, the_entry);
map_put(String, handle_T)(&pack_used, the_entry, 0);
@@ -679,7 +679,7 @@ RuntimeSearchPath runtime_search_path_build(void)
for (rtp_entry = p_rtp; *rtp_entry != NUL;) {
char *cur_entry = rtp_entry;
copy_option_part(&rtp_entry, buf, MAXPATHL, ",");
- size_t buflen = STRLEN(buf);
+ size_t buflen = strlen(buf);
if (path_is_after(buf, buflen)) {
rtp_entry = cur_entry;
@@ -713,7 +713,7 @@ RuntimeSearchPath runtime_search_path_build(void)
// "after" dirs in rtp
for (; *rtp_entry != NUL;) {
copy_option_part(&rtp_entry, buf, MAXPATHL, ",");
- expand_rtp_entry(&search_path, &rtp_used, buf, path_is_after(buf, STRLEN(buf)));
+ expand_rtp_entry(&search_path, &rtp_used, buf, path_is_after(buf, strlen(buf)));
}
// strings are not owned
@@ -891,7 +891,7 @@ static int add_pack_dir_to_rtp(char *fname, bool is_pack)
if (insp == NULL) {
// Both "fname" and "after" not found, append at the end.
- insp = (const char *)p_rtp + STRLEN(p_rtp);
+ insp = (const char *)p_rtp + strlen(p_rtp);
}
// check if rtp/pack/name/start/name/after exists
@@ -901,8 +901,8 @@ static int add_pack_dir_to_rtp(char *fname, bool is_pack)
afterlen = strlen(afterdir) + 1; // add one for comma
}
- const size_t oldlen = STRLEN(p_rtp);
- const size_t addlen = STRLEN(fname) + 1; // add one for comma
+ const size_t oldlen = strlen(p_rtp);
+ const size_t addlen = strlen(fname) + 1; // add one for comma
const size_t new_rtp_capacity = oldlen + addlen + afterlen + 1;
// add one for NUL ------------------------------------------^
char *const new_rtp = try_malloc(new_rtp_capacity);
@@ -969,7 +969,7 @@ static int load_pack_plugin(bool opt, char *fname)
static const char *ftpat = "%s/ftdetect/*.vim"; // NOLINT
char *const ffname = fix_fname(fname);
- size_t len = strlen(ffname) + STRLEN(ftpat);
+ size_t len = strlen(ffname) + strlen(ftpat);
char *pat = xmallocz(len);
vim_snprintf(pat, len, "%s/plugin/**/*.vim", ffname); // NOLINT
@@ -1061,7 +1061,7 @@ static void add_pack_start_dir(char *fname, void *cookie)
static char buf[MAXPATHL];
char *(start_pat[]) = { "/start/*", "/pack/*/start/*" }; // NOLINT
for (int i = 0; i < 2; i++) {
- if (STRLEN(fname) + STRLEN(start_pat[i]) + 1 > MAXPATHL) {
+ if (strlen(fname) + strlen(start_pat[i]) + 1 > MAXPATHL) {
continue;
}
STRLCPY(buf, fname, MAXPATHL);
@@ -1140,7 +1140,7 @@ void ex_packadd(exarg_T *eap)
continue;
}
- const size_t len = STRLEN(plugpat) + STRLEN(eap->arg) + 5;
+ const size_t len = strlen(plugpat) + strlen(eap->arg) + 5;
char *pat = xmallocz(len);
vim_snprintf(pat, len, plugpat, round == 1 ? "start" : "opt", eap->arg);
// The first round don't give a "not found" error, in the second round
@@ -1166,14 +1166,14 @@ int ExpandRTDir(char *pat, int flags, int *num_file, char ***file, char *dirname
{
*num_file = 0;
*file = NULL;
- size_t pat_len = STRLEN(pat);
+ size_t pat_len = strlen(pat);
garray_T ga;
ga_init(&ga, (int)sizeof(char *), 10);
// TODO(bfredl): this is bullshit, exandpath should not reinvent path logic.
for (int i = 0; dirnames[i] != NULL; i++) {
- size_t size = STRLEN(dirnames[i]) + pat_len + 7;
+ size_t size = strlen(dirnames[i]) + pat_len + 7;
char *s = xmalloc(size);
snprintf(s, size, "%s/%s*.vim", dirnames[i], pat);
globpath(p_rtp, s, &ga, 0);
@@ -1186,7 +1186,7 @@ int ExpandRTDir(char *pat, int flags, int *num_file, char ***file, char *dirname
if (flags & DIP_START) {
for (int i = 0; dirnames[i] != NULL; i++) {
- size_t size = STRLEN(dirnames[i]) + pat_len + 22;
+ size_t size = strlen(dirnames[i]) + pat_len + 22;
char *s = xmalloc(size);
snprintf(s, size, "pack/*/start/*/%s/%s*.vim", dirnames[i], pat); // NOLINT
globpath(p_pp, s, &ga, 0);
@@ -1198,7 +1198,7 @@ int ExpandRTDir(char *pat, int flags, int *num_file, char ***file, char *dirname
}
for (int i = 0; dirnames[i] != NULL; i++) {
- size_t size = STRLEN(dirnames[i]) + pat_len + 22;
+ size_t size = strlen(dirnames[i]) + pat_len + 22;
char *s = xmalloc(size);
snprintf(s, size, "start/*/%s/%s*.vim", dirnames[i], pat); // NOLINT
globpath(p_pp, s, &ga, 0);
@@ -1212,7 +1212,7 @@ int ExpandRTDir(char *pat, int flags, int *num_file, char ***file, char *dirname
if (flags & DIP_OPT) {
for (int i = 0; dirnames[i] != NULL; i++) {
- size_t size = STRLEN(dirnames[i]) + pat_len + 20;
+ size_t size = strlen(dirnames[i]) + pat_len + 20;
char *s = xmalloc(size);
snprintf(s, size, "pack/*/opt/*/%s/%s*.vim", dirnames[i], pat); // NOLINT
globpath(p_pp, s, &ga, 0);
@@ -1224,7 +1224,7 @@ int ExpandRTDir(char *pat, int flags, int *num_file, char ***file, char *dirname
}
for (int i = 0; dirnames[i] != NULL; i++) {
- size_t size = STRLEN(dirnames[i]) + pat_len + 20;
+ size_t size = strlen(dirnames[i]) + pat_len + 20;
char *s = xmalloc(size);
snprintf(s, size, "opt/*/%s/%s*.vim", dirnames[i], pat); // NOLINT
globpath(p_pp, s, &ga, 0);
@@ -1239,7 +1239,7 @@ int ExpandRTDir(char *pat, int flags, int *num_file, char ***file, char *dirname
for (int i = 0; i < ga.ga_len; i++) {
char *match = ((char **)ga.ga_data)[i];
char *s = match;
- char *e = s + STRLEN(s);
+ char *e = s + strlen(s);
if (e - s > 4 && (STRNICMP(e - 4, ".vim", 4) == 0
|| ((flags & DIP_LUA)
&& STRNICMP(e - 4, ".lua", 4) == 0))) {
@@ -1277,7 +1277,7 @@ int ExpandPackAddDir(char *pat, int *num_file, char ***file)
*num_file = 0;
*file = NULL;
- size_t pat_len = STRLEN(pat);
+ size_t pat_len = strlen(pat);
ga_init(&ga, (int)sizeof(char *), 10);
size_t buflen = pat_len + 26;
@@ -1291,7 +1291,7 @@ int ExpandPackAddDir(char *pat, int *num_file, char ***file)
for (int i = 0; i < ga.ga_len; i++) {
char *match = ((char **)ga.ga_data)[i];
s = path_tail(match);
- memmove(match, s, STRLEN(s) + 1);
+ memmove(match, s, strlen(s) + 1);
}
if (GA_EMPTY(&ga)) {
@@ -1728,7 +1728,7 @@ typedef struct {
static char *get_str_line(int c, void *cookie, int indent, bool do_concat)
{
GetStrLineCookie *p = cookie;
- if (STRLEN(p->buf) <= p->offset) {
+ if (strlen(p->buf) <= p->offset) {
return NULL;
}
const char *line = p->buf + p->offset;
@@ -2290,7 +2290,7 @@ char *getsourceline(int c, void *cookie, int indent, bool do_concat)
ga_init(&ga, (int)sizeof(char), 400);
ga_concat(&ga, line);
while (sp->nextline != NULL
- && concat_continued_line(&ga, 400, sp->nextline, STRLEN(sp->nextline))) {
+ && concat_continued_line(&ga, 400, sp->nextline, strlen(sp->nextline))) {
xfree(sp->nextline);
sp->nextline = get_one_sourceline(sp);
}
@@ -2353,7 +2353,7 @@ retry:
break;
}
- len = ga.ga_len + (int)STRLEN(buf + ga.ga_len);
+ len = ga.ga_len + (int)strlen(buf + ga.ga_len);
#ifdef USE_CRNL
// Ignore a trailing CTRL-Z, when in Dos mode. Only recognize the
// CTRL-Z by its own, or after a NL.
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 8e10f2d62d..0ec6834364 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -1022,7 +1022,7 @@ void draw_tabline(void)
if (modified || wincount > 1) {
if (wincount > 1) {
vim_snprintf((char *)NameBuff, MAXPATHL, "%d", wincount);
- len = (int)STRLEN(NameBuff);
+ len = (int)strlen(NameBuff);
if (col + len >= Columns - 3) {
break;
}
@@ -1394,7 +1394,7 @@ char *set_chars_option(win_T *wp, char **varp, bool apply)
while (*p) {
int i;
for (i = 0; i < entries; i++) {
- const size_t len = STRLEN(tab[i].name);
+ const size_t len = strlen(tab[i].name);
if (STRNCMP(p, tab[i].name, len) == 0
&& p[len] == ':'
&& p[len + 1] != NUL) {
@@ -1436,8 +1436,8 @@ char *set_chars_option(win_T *wp, char **varp, bool apply)
}
if (i == entries) {
- const size_t len = STRLEN("multispace");
- const size_t len2 = STRLEN("leadmultispace");
+ const size_t len = strlen("multispace");
+ const size_t len2 = strlen("leadmultispace");
if (is_listchars
&& STRNCMP(p, "multispace", len) == 0
&& p[len] == ':'
diff --git a/src/nvim/search.c b/src/nvim/search.c
index 8477efed92..336dd50292 100644
--- a/src/nvim/search.c
+++ b/src/nvim/search.c
@@ -817,7 +817,7 @@ int searchit(win_T *win, buf_T *buf, pos_T *pos, pos_T *end_pos, Direction dir,
if (endpos.col == 0) {
if (pos->lnum > 1) { // just in case
pos->lnum--;
- pos->col = (colnr_T)STRLEN(ml_get_buf(buf, pos->lnum, false));
+ pos->col = (colnr_T)strlen(ml_get_buf(buf, pos->lnum, false));
}
} else {
pos->col--;
@@ -934,7 +934,7 @@ int searchit(win_T *win, buf_T *buf, pos_T *pos, pos_T *end_pos, Direction dir,
// A pattern like "\n\zs" may go past the last line.
if (pos->lnum > buf->b_ml.ml_line_count) {
pos->lnum = buf->b_ml.ml_line_count;
- pos->col = (int)STRLEN(ml_get_buf(buf, pos->lnum, false));
+ pos->col = (int)strlen(ml_get_buf(buf, pos->lnum, false));
if (pos->col > 0) {
pos->col--;
}
@@ -1085,7 +1085,7 @@ int do_search(oparg_T *oap, int dirc, int search_delim, char_u *pat, long count,
p = (char_u *)skip_regexp((char *)pat, search_delim, p_magic, &strcopy);
if (strcopy != (char *)ps) {
// made a copy of "pat" to change "\?" to "?"
- searchcmdlen += (int)(STRLEN(pat) - STRLEN(strcopy));
+ searchcmdlen += (int)(STRLEN(pat) - strlen(strcopy));
pat = (char_u *)strcopy;
searchstr = (char_u *)strcopy;
}
@@ -2444,7 +2444,7 @@ int current_search(long count, bool forward)
} else { // try again from end of buffer
// searching backwards, so set pos to last line and col
pos.lnum = curwin->w_buffer->b_ml.ml_line_count;
- pos.col = (colnr_T)STRLEN(ml_get(curwin->w_buffer->b_ml.ml_line_count));
+ pos.col = (colnr_T)strlen(ml_get(curwin->w_buffer->b_ml.ml_line_count));
}
}
}
diff --git a/src/nvim/sha256.c b/src/nvim/sha256.c
index 53c9cb7c81..012f145875 100644
--- a/src/nvim/sha256.c
+++ b/src/nvim/sha256.c
@@ -17,7 +17,7 @@
#include <stdio.h> // for snprintf().
#include "nvim/sha256.h" // for context_sha256_T
-#include "nvim/vim.h" // for STRCPY()/STRLEN().
+#include "nvim/vim.h" // for STRCPY()/strlen().
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "sha256.c.generated.h"
diff --git a/src/nvim/shada.c b/src/nvim/shada.c
index 74d8b30347..f735829030 100644
--- a/src/nvim/shada.c
+++ b/src/nvim/shada.c
@@ -884,7 +884,7 @@ static const void *shada_hist_iter(const void *const iter, const uint8_t history
.histtype = history_type,
.string = hist_he.hisstr,
.sep = (char)(history_type == HIST_SEARCH
- ? hist_he.hisstr[STRLEN(hist_he.hisstr) + 1]
+ ? hist_he.hisstr[strlen(hist_he.hisstr) + 1]
: 0),
.additional_elements = hist_he.additional_elements,
}
@@ -4000,7 +4000,7 @@ static bool shada_removable(const char *name)
(void)copy_option_part(&p, part, ARRAY_SIZE(part), ", ");
if (part[0] == 'r') {
home_replace(NULL, part + 1, (char *)NameBuff, MAXPATHL, true);
- size_t n = STRLEN(NameBuff);
+ size_t n = strlen(NameBuff);
if (mb_strnicmp(NameBuff, new_name, n) == 0) {
retval = true;
break;
diff --git a/src/nvim/sign.c b/src/nvim/sign.c
index ed546cf303..5ce9ee4546 100644
--- a/src/nvim/sign.c
+++ b/src/nvim/sign.c
@@ -78,10 +78,10 @@ static signgroup_T *sign_group_ref(const char *groupname)
signgroup_T *group;
hash = hash_hash((char_u *)groupname);
- hi = hash_lookup(&sg_table, (char *)groupname, STRLEN(groupname), hash);
+ hi = hash_lookup(&sg_table, (char *)groupname, strlen(groupname), hash);
if (HASHITEM_EMPTY(hi)) {
// new group
- group = xmalloc(sizeof(signgroup_T) + STRLEN(groupname));
+ group = xmalloc(sizeof(signgroup_T) + strlen(groupname));
STRCPY(group->sg_name, groupname);
group->sg_refcount = 1;
@@ -868,7 +868,7 @@ static int sign_define_init_text(sign_T *sp, char *text)
int cells;
size_t len;
- endp = text + (int)STRLEN(text);
+ endp = text + (int)strlen(text);
for (s = text; s + 1 < endp; s++) {
if (*s == '\\') {
// Remove a backslash, so that it is possible
@@ -951,7 +951,7 @@ static int sign_define_by_name(char *name, char *icon, char *linehl, char *text,
if (*linehl == NUL) {
sp->sn_line_hl = 0;
} else {
- sp->sn_line_hl = syn_check_group(linehl, STRLEN(linehl));
+ sp->sn_line_hl = syn_check_group(linehl, strlen(linehl));
}
}
@@ -959,7 +959,7 @@ static int sign_define_by_name(char *name, char *icon, char *linehl, char *text,
if (*texthl == NUL) {
sp->sn_text_hl = 0;
} else {
- sp->sn_text_hl = syn_check_group(texthl, STRLEN(texthl));
+ sp->sn_text_hl = syn_check_group(texthl, strlen(texthl));
}
}
@@ -967,7 +967,7 @@ static int sign_define_by_name(char *name, char *icon, char *linehl, char *text,
if (*culhl == NUL) {
sp->sn_cul_hl = 0;
} else {
- sp->sn_cul_hl = syn_check_group(culhl, STRLEN(culhl));
+ sp->sn_cul_hl = syn_check_group(culhl, strlen(culhl));
}
}
@@ -975,7 +975,7 @@ static int sign_define_by_name(char *name, char *icon, char *linehl, char *text,
if (*numhl == NUL) {
sp->sn_num_hl = 0;
} else {
- sp->sn_num_hl = syn_check_group(numhl, STRLEN(numhl));
+ sp->sn_num_hl = syn_check_group(numhl, strlen(numhl));
}
}
@@ -1139,7 +1139,7 @@ static linenr_T sign_jump(int sign_id, char *sign_group, buf_T *buf)
emsg(_("E934: Cannot jump to a buffer that does not have a name"));
return -1;
}
- size_t cmdlen = STRLEN(buf->b_fname) + 24;
+ size_t cmdlen = strlen(buf->b_fname) + 24;
char *cmd = xmallocz(cmdlen);
snprintf(cmd, cmdlen, "e +%" PRId64 " %s",
(int64_t)lnum, buf->b_fname);
diff --git a/src/nvim/spell.c b/src/nvim/spell.c
index 42891fd3fb..53fa920358 100644
--- a/src/nvim/spell.c
+++ b/src/nvim/spell.c
@@ -109,7 +109,7 @@
#include "nvim/syntax.h" // for syn_get_id, syntax_present
#include "nvim/types.h" // for char_u
#include "nvim/undo.h" // for u_save_cursor
-#include "nvim/vim.h" // for curwin, STRLEN, STRLCPY, STRNCMP
+#include "nvim/vim.h" // for curwin, strlen, STRLCPY, STRNCMP
// Result values. Lower number is accepted over higher one.
#define SP_BANNED (-1)
@@ -1550,7 +1550,7 @@ static void spell_load_lang(char_u *lang)
}
} else if (sl.sl_slang != NULL) {
// At least one file was loaded, now load ALL the additions.
- STRCPY(fname_enc + STRLEN(fname_enc) - 3, "add.spl");
+ STRCPY(fname_enc + strlen(fname_enc) - 3, "add.spl");
do_in_runtimepath((char *)fname_enc, DIP_ALL, spell_load_cb, &sl);
}
}
@@ -1888,7 +1888,7 @@ char *did_set_spelllang(win_T *wp)
// Get one language name.
copy_option_part(&splp, (char *)lang, MAXWLEN, ",");
region = NULL;
- len = (int)STRLEN(lang);
+ len = (int)strlen(lang);
if (!valid_spelllang((char *)lang)) {
continue;
@@ -2165,7 +2165,7 @@ static void use_midword(slang_T *lp, win_T *wp)
wp->w_s->b_spell_ismw_mb = xstrnsave(p, (size_t)l);
} else {
// Append multi-byte chars to "b_spell_ismw_mb".
- const int n = (int)STRLEN(wp->w_s->b_spell_ismw_mb);
+ const int n = (int)strlen(wp->w_s->b_spell_ismw_mb);
char *bp = xstrnsave(wp->w_s->b_spell_ismw_mb, (size_t)n + (size_t)l);
xfree(wp->w_s->b_spell_ismw_mb);
wp->w_s->b_spell_ismw_mb = bp;
@@ -2572,9 +2572,9 @@ void ex_spellrepall(exarg_T *eap)
emsg(_("E752: No previous spell replacement"));
return;
}
- int addlen = (int)(STRLEN(repl_to) - STRLEN(repl_from));
+ int addlen = (int)(strlen(repl_to) - strlen(repl_from));
- size_t frompatlen = STRLEN(repl_from) + 7;
+ size_t frompatlen = strlen(repl_from) + 7;
char_u *frompat = xmalloc(frompatlen);
snprintf((char *)frompat, frompatlen, "\\V\\<%s\\>", repl_from);
p_ws = false;
@@ -2592,11 +2592,11 @@ void ex_spellrepall(exarg_T *eap)
// when changing "etc" to "etc.".
char_u *line = (char_u *)get_cursor_line_ptr();
if (addlen <= 0 || STRNCMP(line + curwin->w_cursor.col,
- repl_to, STRLEN(repl_to)) != 0) {
+ repl_to, strlen(repl_to)) != 0) {
char_u *p = xmalloc(STRLEN(line) + (size_t)addlen + 1);
memmove(p, line, (size_t)curwin->w_cursor.col);
STRCPY(p + curwin->w_cursor.col, repl_to);
- STRCAT(p, line + curwin->w_cursor.col + STRLEN(repl_from));
+ STRCAT(p, line + curwin->w_cursor.col + strlen(repl_from));
ml_replace(curwin->w_cursor.lnum, (char *)p, false);
changed_bytes(curwin->w_cursor.lnum, curwin->w_cursor.col);
@@ -2606,7 +2606,7 @@ void ex_spellrepall(exarg_T *eap)
}
sub_nsubs++;
}
- curwin->w_cursor.col += (colnr_T)STRLEN(repl_to);
+ curwin->w_cursor.col += (colnr_T)strlen(repl_to);
}
p_ws = save_ws;
@@ -3247,7 +3247,7 @@ void spell_dump_compl(char *pat, int ic, Direction *dir, int dumpflags_arg)
// When matching with a pattern and there are no prefixes only use
// parts of the tree that match "pat".
if (pat != NULL && slang->sl_pbyts == NULL) {
- patlen = (int)STRLEN(pat);
+ patlen = (int)strlen(pat);
} else {
patlen = -1;
}
@@ -3611,7 +3611,7 @@ char *did_set_spell_option(bool is_spellfile)
char *errmsg = NULL;
if (is_spellfile) {
- int l = (int)STRLEN(curwin->w_s->b_p_spf);
+ int l = (int)strlen(curwin->w_s->b_p_spf);
if (l > 0
&& (l < 4 || strcmp(curwin->w_s->b_p_spf + l - 4, ".add") != 0)) {
errmsg = e_invarg;
diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c
index 7da5a7ca4f..611c43e85e 100644
--- a/src/nvim/spellfile.c
+++ b/src/nvim/spellfile.c
@@ -2157,8 +2157,8 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
} else if (spell_info_item(items[0]) && itemcnt > 1) {
p = getroom(spin,
(spin->si_info == NULL ? 0 : STRLEN(spin->si_info))
- + STRLEN(items[0])
- + STRLEN(items[1]) + 3, false);
+ + strlen(items[0])
+ + strlen(items[1]) + 3, false);
if (spin->si_info != NULL) {
STRCPY(p, spin->si_info);
STRCAT(p, "\n");
@@ -2231,7 +2231,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
&& compflags == NULL) {
// Turn flag "c" into COMPOUNDRULE compatible string "c+",
// "Na" into "Na+", "1234" into "1234+".
- p = getroom(spin, STRLEN(items[1]) + 2, false);
+ p = getroom(spin, strlen(items[1]) + 2, false);
STRCPY(p, items[1]);
STRCAT(p, "+");
compflags = (char_u *)p;
@@ -2247,7 +2247,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
if (compflags != NULL || *skipdigits((char *)items[1]) != NUL) {
// Concatenate this string to previously defined ones,
// using a slash to separate them.
- l = (int)STRLEN(items[1]) + 1;
+ l = (int)strlen(items[1]) + 1;
if (compflags != NULL) {
l += (int)STRLEN(compflags) + 1;
}
@@ -2358,7 +2358,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
cur_aff = getroom(spin, sizeof(*cur_aff), true);
cur_aff->ah_flag = affitem2flag(aff->af_flagtype, (char_u *)items[1],
fname, lnum);
- if (cur_aff->ah_flag == 0 || STRLEN(items[1]) >= AH_KEY_LEN) {
+ if (cur_aff->ah_flag == 0 || strlen(items[1]) >= AH_KEY_LEN) {
break;
}
if (cur_aff->ah_flag == aff->af_bad
@@ -4640,7 +4640,7 @@ static int write_vim_spell(spellinfo_T *spin, char *fname)
size_t l = STRLEN(spin->si_compflags);
assert(spin->si_comppat.ga_len >= 0);
for (size_t i = 0; i < (size_t)spin->si_comppat.ga_len; i++) {
- l += STRLEN(((char **)(spin->si_comppat.ga_data))[i]) + 1;
+ l += strlen(((char **)(spin->si_comppat.ga_data))[i]) + 1;
}
put_bytes(fd, l + 7, 4); // <sectionlen>
@@ -4652,9 +4652,9 @@ static int write_vim_spell(spellinfo_T *spin, char *fname)
put_bytes(fd, (uintmax_t)spin->si_comppat.ga_len, 2); // <comppatcount>
for (size_t i = 0; i < (size_t)spin->si_comppat.ga_len; i++) {
char *p = ((char **)(spin->si_comppat.ga_data))[i];
- assert(STRLEN(p) < INT_MAX);
- putc((int)STRLEN(p), fd); // <comppatlen>
- fwv &= fwrite(p, STRLEN(p), 1, fd); // <comppattext>
+ assert(strlen(p) < INT_MAX);
+ putc((int)strlen(p), fd); // <comppatlen>
+ fwv &= fwrite(p, strlen(p), 1, fd); // <comppattext>
}
// <compflags>
fwv &= fwrite(spin->si_compflags, STRLEN(spin->si_compflags), 1, fd);
@@ -5355,8 +5355,8 @@ static void mkspell(int fcount, char **fnames, bool ascii, bool over_write, bool
afile[i] = NULL;
if (incount > 1) {
- len = (int)STRLEN(innames[i]);
- if (STRLEN(path_tail((char *)innames[i])) < 5
+ len = (int)strlen(innames[i]);
+ if (strlen(path_tail(innames[i])) < 5
|| innames[i][len - 3] != '_') {
semsg(_("E755: Invalid region in %s"), innames[i]);
goto theend;
diff --git a/src/nvim/spellsuggest.c b/src/nvim/spellsuggest.c
index 16af1b72a3..f2a0da188e 100644
--- a/src/nvim/spellsuggest.c
+++ b/src/nvim/spellsuggest.c
@@ -66,7 +66,7 @@ typedef struct suginfo_S {
/// One word suggestion. Used in "si_ga".
typedef struct {
char *st_word; ///< suggested word, allocated string
- int st_wordlen; ///< STRLEN(st_word)
+ int st_wordlen; ///< strlen(st_word)
int st_orglen; ///< length of replaced text
int st_score; ///< lower is better
int st_altscore; ///< used when st_score compares equal
@@ -1633,7 +1633,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
if (!try_compound && !fword_ends) {
STRCAT(preword, " ");
}
- sp->ts_prewordlen = (char_u)STRLEN(preword);
+ sp->ts_prewordlen = (char_u)strlen(preword);
sp->ts_splitoff = sp->ts_twordlen;
sp->ts_splitfidx = sp->ts_fidx;
@@ -3070,7 +3070,7 @@ static void add_suggestion(suginfo_T *su, garray_T *gap, const char *goodword, i
// Minimize "badlen" for consistency. Avoids that changing "the the" to
// "thee the" is added next to changing the first "the" the "thee".
- const char *pgood = goodword + STRLEN(goodword);
+ const char *pgood = goodword + strlen(goodword);
char_u *pbad = su->su_badptr + badlenarg;
for (;;) {
goodlen = (int)(pgood - goodword);
@@ -3345,8 +3345,8 @@ static int soundalike_score(char *goodstart, char *badstart)
}
}
- goodlen = (int)STRLEN(goodsound);
- badlen = (int)STRLEN(badsound);
+ goodlen = (int)strlen(goodsound);
+ badlen = (int)strlen(badsound);
// Return quickly if the lengths are too different to be fixed by two
// changes.
diff --git a/src/nvim/statusline.c b/src/nvim/statusline.c
index 5f686ef96f..94462d4073 100644
--- a/src/nvim/statusline.c
+++ b/src/nvim/statusline.c
@@ -100,7 +100,7 @@ void win_redr_status(win_T *wp)
}
if (wp->w_buffer->b_p_ro) {
snprintf((char *)p + len, MAXPATHL - (size_t)len, "%s", _("[RO]"));
- // len += (int)STRLEN(p + len); // dead assignment
+ // len += (int)strlen(p + len); // dead assignment
}
this_ru_col = ru_col - (Columns - width);
@@ -137,9 +137,9 @@ void win_redr_status(win_T *wp)
this_ru_col + col, fillchar, fillchar, attr);
if (get_keymap_str(wp, "<%s>", (char *)NameBuff, MAXPATHL)
- && this_ru_col - len > (int)(STRLEN(NameBuff) + 1)) {
+ && this_ru_col - len > (int)(strlen(NameBuff) + 1)) {
grid_puts(&default_grid, NameBuff, row,
- (int)((size_t)this_ru_col - STRLEN(NameBuff) - 1), attr);
+ (int)((size_t)this_ru_col - strlen(NameBuff) - 1), attr);
}
win_redr_ruler(wp, true);
@@ -286,7 +286,7 @@ void win_redr_ruler(win_T *wp, bool always)
vim_snprintf(buffer, RULER_BUF_LEN, "%" PRId64 ",",
(wp->w_buffer->b_ml.ml_flags &
ML_EMPTY) ? (int64_t)0L : (int64_t)wp->w_cursor.lnum);
- size_t len = STRLEN(buffer);
+ size_t len = strlen(buffer);
col_print(buffer + len, RULER_BUF_LEN - len,
empty_line ? 0 : (int)wp->w_cursor.col + 1,
(int)virtcol + 1);
@@ -294,7 +294,7 @@ void win_redr_ruler(win_T *wp, bool always)
// Add a "50%" if there is room for it.
// On the last line, don't print in the last column (scrolls the
// screen up on some terminals).
- int i = (int)STRLEN(buffer);
+ int i = (int)strlen(buffer);
get_rel_pos(wp, buffer + i + 1, RULER_BUF_LEN - i - 1);
int o = i + vim_strsize(buffer + i + 1);
if (wp->w_status_height == 0 && !is_stl_global) { // can't use last char of screen
@@ -344,7 +344,7 @@ void win_redr_ruler(win_T *wp, bool always)
ScreenGrid *grid = part_of_status ? &default_grid : &msg_grid_adj;
grid_puts(grid, buffer, row, this_ru_col + off, attr);
grid_fill(grid, row, row + 1,
- this_ru_col + off + (int)STRLEN(buffer), off + width, fillchar,
+ this_ru_col + off + (int)strlen(buffer), off + width, fillchar,
fillchar, attr);
}
@@ -717,7 +717,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
// Get the byte value now, in case we need it below. This is more
// efficient than making a copy of the line.
int byteval;
- const size_t len = STRLEN(line_ptr);
+ const size_t len = strlen(line_ptr);
if (wp->w_cursor.col > (colnr_T)len) {
// Line may have changed since checking the cursor column, or the lnum
// was adjusted above.
@@ -1190,8 +1190,8 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
&& strchr((const char *)str, '%') != NULL
&& evaldepth < MAX_STL_EVAL_DEPTH) {
size_t parsed_usefmt = (size_t)(block_start - usefmt);
- size_t str_length = STRLEN(str);
- size_t fmt_length = STRLEN(fmt_p);
+ size_t str_length = strlen(str);
+ size_t fmt_length = strlen(fmt_p);
size_t new_fmt_len = parsed_usefmt + str_length + fmt_length + 3;
char *new_fmt = xmalloc(new_fmt_len * sizeof(char));
char *new_fmt_p = new_fmt;
@@ -1328,7 +1328,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
// in the temporary buffer
// (including the brackets and null terminating character)
if (*wp->w_buffer->b_p_ft != NUL
- && STRLEN(wp->w_buffer->b_p_ft) < TMPLEN - 3) {
+ && strlen(wp->w_buffer->b_p_ft) < TMPLEN - 3) {
vim_snprintf(buf_tmp, sizeof(buf_tmp), "[%s]",
wp->w_buffer->b_p_ft);
str = buf_tmp;
@@ -1341,7 +1341,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
// in the temporary buffer
// (including the comma and null terminating character)
if (*wp->w_buffer->b_p_ft != NUL
- && STRLEN(wp->w_buffer->b_p_ft) < TMPLEN - 2) {
+ && strlen(wp->w_buffer->b_p_ft) < TMPLEN - 2) {
vim_snprintf(buf_tmp, sizeof(buf_tmp), ",%s", wp->w_buffer->b_p_ft);
// Uppercase the file extension
for (char *t = buf_tmp; *t != 0; t++) {
@@ -1561,7 +1561,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
// Advance the output buffer position to the end of the
// number we just printed
- out_p += STRLEN(out_p);
+ out_p += strlen(out_p);
// Otherwise, there was nothing to print so mark the item as empty
} else {
@@ -1669,7 +1669,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
if (width + 1 < maxwidth) {
// Advance the pointer to the end of the string
- trunc_p = trunc_p + STRLEN(trunc_p);
+ trunc_p = trunc_p + strlen(trunc_p);
}
// Fill up for half a double-wide character.
@@ -1705,7 +1705,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
// add characters at the separate marker (if there is one) to
// fill up the available space.
} else if (width < maxwidth
- && STRLEN(out) + (size_t)(maxwidth - width) + 1 < outlen) {
+ && strlen(out) + (size_t)(maxwidth - width) + 1 < outlen) {
// Find how many separators there are, which we will use when
// figuring out how many groups there are.
int num_separators = 0;
diff --git a/src/nvim/strings.c b/src/nvim/strings.c
index ee6172e7fc..b73221d4da 100644
--- a/src/nvim/strings.c
+++ b/src/nvim/strings.c
@@ -341,7 +341,7 @@ char *strcase_save(const char *const orig, bool upper)
int newl = utf_char2len(uc);
if (newl != l) {
// TODO(philix): use xrealloc() in strcase_save()
- char *s = xmalloc(STRLEN(res) + (size_t)(1 + newl - l));
+ char *s = xmalloc(strlen(res) + (size_t)(1 + newl - l));
memcpy(s, res, (size_t)(p - res));
STRCPY(s + (p - res) + newl, p + l);
p = s + (p - res);
@@ -504,8 +504,8 @@ bool has_non_ascii_len(const char *const s, const size_t len)
char *concat_str(const char *restrict str1, const char *restrict str2)
FUNC_ATTR_NONNULL_RET FUNC_ATTR_MALLOC FUNC_ATTR_NONNULL_ALL
{
- size_t l = STRLEN(str1);
- char *dest = xmalloc(l + STRLEN(str2) + 1);
+ size_t l = strlen(str1);
+ char *dest = xmalloc(l + strlen(str2) + 1);
STRCPY(dest, str1);
STRCPY(dest + l, str2);
return dest;
@@ -1473,7 +1473,7 @@ char *reverse_text(char *s)
FUNC_ATTR_NONNULL_RET
{
// Reverse the pattern.
- size_t len = STRLEN(s);
+ size_t len = strlen(s);
char *rev = xmalloc(len + 1);
size_t rev_i = len;
for (size_t s_i = 0; s_i < len; s_i++) {
@@ -1498,7 +1498,7 @@ char *reverse_text(char *s)
char *strrep(const char *src, const char *what, const char *rep)
{
char *pos = (char *)src;
- size_t whatlen = STRLEN(what);
+ size_t whatlen = strlen(what);
// Count occurrences
size_t count = 0;
@@ -1511,8 +1511,8 @@ char *strrep(const char *src, const char *what, const char *rep)
return NULL;
}
- size_t replen = STRLEN(rep);
- char *ret = xmalloc(STRLEN(src) + count * (replen - whatlen) + 1);
+ size_t replen = strlen(rep);
+ char *ret = xmalloc(strlen(src) + count * (replen - whatlen) + 1);
char *ptr = ret;
while ((pos = strstr(src, what)) != NULL) {
size_t idx = (size_t)(pos - src);
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index ce952147f7..575d475b87 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -2295,7 +2295,7 @@ static void update_si_end(stateitem_T *sip, int startcol, bool force)
// a "oneline" never continues in the next line
sip->si_ends = true;
sip->si_m_endpos.lnum = current_lnum;
- sip->si_m_endpos.col = (colnr_T)STRLEN(syn_getcurline());
+ sip->si_m_endpos.col = (colnr_T)strlen(syn_getcurline());
} else {
// continues in the next line
sip->si_ends = false;
@@ -2646,7 +2646,7 @@ static void syn_add_start_off(lpos_T *result, regmmatch_T *regmatch, synpat_T *s
if (result->lnum > syn_buf->b_ml.ml_line_count) {
// a "\n" at the end of the pattern may take us below the last line
result->lnum = syn_buf->b_ml.ml_line_count;
- col = (int)STRLEN(ml_get_buf(syn_buf, result->lnum, false));
+ col = (int)strlen(ml_get_buf(syn_buf, result->lnum, false));
}
if (off != 0) {
base = (char_u *)ml_get_buf(syn_buf, result->lnum, false);
@@ -3734,11 +3734,11 @@ static void add_keyword(char *const name, const int id, const int flags,
{
char name_folded[MAXKEYWLEN + 1];
const char *const name_ic = (curwin->w_s->b_syn_ic)
- ? (char *)str_foldcase((char_u *)name, (int)STRLEN(name), (char_u *)name_folded,
+ ? (char *)str_foldcase((char_u *)name, (int)strlen(name), (char_u *)name_folded,
sizeof(name_folded))
: name;
- keyentry_T *const kp = xmalloc(sizeof(keyentry_T) + STRLEN(name_ic));
+ keyentry_T *const kp = xmalloc(sizeof(keyentry_T) + strlen(name_ic));
STRCPY(kp->keyword, name_ic);
kp->k_syn.id = (int16_t)id;
kp->k_syn.inc_tag = current_syn_inc_tag;
@@ -4063,7 +4063,7 @@ static void syn_cmd_keyword(exarg_T *eap, int syncing)
}
if (syn_id != 0) {
// Allocate a buffer, for removing backslashes in the keyword.
- keyword_copy = xmalloc(STRLEN(rest) + 1);
+ keyword_copy = xmalloc(strlen(rest) + 1);
}
if (keyword_copy != NULL) {
syn_opt_arg.flags = 0;
@@ -4099,7 +4099,7 @@ static void syn_cmd_keyword(exarg_T *eap, int syncing)
syn_incl_toplevel(syn_id, &syn_opt_arg.flags);
// 2: Add an entry for each keyword.
- for (kw = keyword_copy; --cnt >= 0; kw += STRLEN(kw) + 1) {
+ for (kw = keyword_copy; --cnt >= 0; kw += strlen(kw) + 1) {
for (p = vim_strchr(kw, '[');;) {
if (p != NULL) {
*p = NUL;
diff --git a/src/nvim/tag.c b/src/nvim/tag.c
index 36f797da06..a8d8eebb0d 100644
--- a/src/nvim/tag.c
+++ b/src/nvim/tag.c
@@ -1217,7 +1217,7 @@ static int find_tagfunc_tags(char_u *pat, garray_T *ga, int *match_count, int fl
}
// Other elements will be stored as "\tKEY:VALUE"
// Allocate space for the key and the colon
- len += STRLEN(dict_key) + 1;
+ len += strlen(dict_key) + 1;
});
if (has_extra) {
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c
index 46f141492b..326c868be8 100644
--- a/src/nvim/terminal.c
+++ b/src/nvim/terminal.c
@@ -693,7 +693,7 @@ void terminal_paste(long count, char **y_array, size_t y_size)
return;
}
vterm_keyboard_start_paste(curbuf->terminal->vt);
- size_t buff_len = STRLEN(y_array[0]);
+ size_t buff_len = strlen(y_array[0]);
char_u *buff = xmalloc(buff_len);
for (int i = 0; i < count; i++) { // -V756
// feed the lines to the terminal
@@ -702,7 +702,7 @@ void terminal_paste(long count, char **y_array, size_t y_size)
// terminate the previous line
terminal_send(curbuf->terminal, "\n", 1);
}
- size_t len = STRLEN(y_array[j]);
+ size_t len = strlen(y_array[j]);
if (len > buff_len) {
buff = xrealloc(buff, len);
buff_len = len;
diff --git a/src/nvim/textformat.c b/src/nvim/textformat.c
index 5c53f84700..25728ef0f1 100644
--- a/src/nvim/textformat.c
+++ b/src/nvim/textformat.c
@@ -431,7 +431,7 @@ void internal_format(int textwidth, int second_indent, int flags, bool format_on
// Check if cursor is not past the NUL off the line, cindent
// may have added or removed indent.
curwin->w_cursor.col += startcol;
- len = (colnr_T)STRLEN(get_cursor_line_ptr());
+ len = (colnr_T)strlen(get_cursor_line_ptr());
if (curwin->w_cursor.col > len) {
curwin->w_cursor.col = len;
}
@@ -644,7 +644,7 @@ void auto_format(bool trailblank, bool prev_line)
// in 'formatoptions' and there is a single character before the cursor.
// Otherwise the line would be broken and when typing another non-white
// next they are not joined back together.
- wasatend = (pos.col == (colnr_T)STRLEN(old));
+ wasatend = (pos.col == (colnr_T)strlen(old));
if (*old != NUL && !trailblank && wasatend) {
dec_cursor();
cc = gchar_cursor();
@@ -698,7 +698,7 @@ void auto_format(bool trailblank, bool prev_line)
// formatted.
if (!wasatend && has_format_option(FO_WHITE_PAR)) {
new = get_cursor_line_ptr();
- len = (colnr_T)STRLEN(new);
+ len = (colnr_T)strlen(new);
if (curwin->w_cursor.col == len) {
pnew = xstrnsave(new, (size_t)len + 2);
pnew[len] = ' ';
@@ -1115,7 +1115,7 @@ void format_lines(linenr_T line_count, bool avoid_fex)
}
first_par_line = false;
// If the line is getting long, format it next time
- if (STRLEN(get_cursor_line_ptr()) > (size_t)max_len) {
+ if (strlen(get_cursor_line_ptr()) > (size_t)max_len) {
force_format = true;
} else {
force_format = false;
diff --git a/src/nvim/undo.c b/src/nvim/undo.c
index 891a42380e..0a5a3133df 100644
--- a/src/nvim/undo.c
+++ b/src/nvim/undo.c
@@ -771,7 +771,7 @@ static bool serialize_header(bufinfo_T *bi, char_u *hash)
// Write buffer-specific data.
undo_write_bytes(bi, (uintmax_t)buf->b_ml.ml_line_count, 4);
- size_t len = buf->b_u_line_ptr ? STRLEN(buf->b_u_line_ptr) : 0;
+ size_t len = buf->b_u_line_ptr ? strlen(buf->b_u_line_ptr) : 0;
undo_write_bytes(bi, len, 4);
if (len > 0 && !undo_write(bi, (char_u *)buf->b_u_line_ptr, len)) {
return false;
@@ -1034,7 +1034,7 @@ static bool serialize_uep(bufinfo_T *bi, u_entry_T *uep)
undo_write_bytes(bi, (uintmax_t)uep->ue_size, 4);
for (size_t i = 0; i < (size_t)uep->ue_size; i++) {
- size_t len = STRLEN(uep->ue_array[i]);
+ size_t len = strlen(uep->ue_array[i]);
if (!undo_write_bytes(bi, len, 4)) {
return false;
}
@@ -2638,7 +2638,7 @@ void ex_undolist(exarg_T *eap)
vim_snprintf((char *)IObuff, IOSIZE, "%6ld %7d ", uhp->uh_seq, changes);
undo_fmt_time((char_u *)IObuff + STRLEN(IObuff), IOSIZE - STRLEN(IObuff), uhp->uh_time);
if (uhp->uh_save_nr > 0) {
- while (STRLEN(IObuff) < 33) {
+ while (strlen(IObuff) < 33) {
STRCAT(IObuff, " ");
}
vim_snprintf_add((char *)IObuff, IOSIZE, " %3ld", uhp->uh_save_nr);
@@ -2995,7 +2995,7 @@ void u_undoline(void)
ml_replace(curbuf->b_u_line_lnum, curbuf->b_u_line_ptr, true);
changed_bytes(curbuf->b_u_line_lnum, 0);
extmark_splice_cols(curbuf, (int)curbuf->b_u_line_lnum - 1, 0, (colnr_T)STRLEN(oldp),
- (colnr_T)STRLEN(curbuf->b_u_line_ptr), kExtmarkUndo);
+ (colnr_T)strlen(curbuf->b_u_line_ptr), kExtmarkUndo);
xfree(curbuf->b_u_line_ptr);
curbuf->b_u_line_ptr = (char *)oldp;
diff --git a/src/nvim/usercmd.c b/src/nvim/usercmd.c
index 6d6ba2466e..c3cf0b6df8 100644
--- a/src/nvim/usercmd.c
+++ b/src/nvim/usercmd.c
@@ -435,7 +435,7 @@ static void uc_list(char *name, size_t name_len)
}
msg_outtrans_attr(cmd->uc_name, HL_ATTR(HLF_D));
- len = (int)STRLEN(cmd->uc_name) + 4;
+ len = (int)strlen(cmd->uc_name) + 4;
do {
msg_putchar(' ');
@@ -476,14 +476,14 @@ static void uc_list(char *name, size_t name_len)
// -count=N
snprintf((char *)IObuff + len, IOSIZE, "%" PRId64 "c",
(int64_t)cmd->uc_def);
- len += (int)STRLEN(IObuff + len);
+ len += (int)strlen(IObuff + len);
} else if (a & EX_DFLALL) {
IObuff[len++] = '%';
} else if (cmd->uc_def >= 0) {
// -range=N
snprintf((char *)IObuff + len, IOSIZE, "%" PRId64 "",
(int64_t)cmd->uc_def);
- len += (int)STRLEN(IObuff + len);
+ len += (int)strlen(IObuff + len);
} else {
IObuff[len++] = '.';
}
@@ -498,7 +498,7 @@ static void uc_list(char *name, size_t name_len)
if (addr_type_complete[j].expand != ADDR_LINES
&& addr_type_complete[j].expand == cmd->uc_addr_type) {
STRCPY(IObuff + len, addr_type_complete[j].shortname);
- len += (int)STRLEN(IObuff + len);
+ len += (int)strlen(IObuff + len);
break;
}
}
@@ -511,7 +511,7 @@ static void uc_list(char *name, size_t name_len)
char *cmd_compl = get_command_complete(cmd->uc_compl);
if (cmd_compl != NULL) {
STRCPY(IObuff + len, get_command_complete(cmd->uc_compl));
- len += (int)STRLEN(IObuff + len);
+ len += (int)strlen(IObuff + len);
}
do {
@@ -559,7 +559,7 @@ int parse_addr_type_arg(char *value, int vallen, cmd_addr_T *addr_type_arg)
int i, a, b;
for (i = 0; addr_type_complete[i].expand != ADDR_NONE; i++) {
- a = (int)STRLEN(addr_type_complete[i].name) == vallen;
+ a = (int)strlen(addr_type_complete[i].name) == vallen;
b = STRNCMP(value, addr_type_complete[i].name, vallen) == 0;
if (a && b) {
*addr_type_arg = addr_type_complete[i].expand;
@@ -607,7 +607,7 @@ int parse_compl_arg(const char *value, int vallen, int *complp, uint32_t *argt,
if (get_command_complete(i) == NULL) {
continue;
}
- if ((int)STRLEN(command_complete[i]) == valend
+ if ((int)strlen(command_complete[i]) == valend
&& STRNCMP(value, command_complete[i], valend) == 0) {
*complp = i;
if (i == EXPAND_BUFFERS) {
@@ -816,7 +816,7 @@ int uc_add_command(char *name, size_t name_len, const char *rep, uint32_t argt,
char *rep_buf = NULL;
garray_T *gap;
- replace_termcodes(rep, STRLEN(rep), &rep_buf, 0, NULL, CPO_TO_CPO_FLAGS);
+ replace_termcodes(rep, strlen(rep), &rep_buf, 0, NULL, CPO_TO_CPO_FLAGS);
if (rep_buf == NULL) {
// Can't replace termcodes - try using the string as is
rep_buf = xstrdup(rep);
@@ -837,7 +837,7 @@ int uc_add_command(char *name, size_t name_len, const char *rep, uint32_t argt,
size_t len;
cmd = USER_CMD_GA(gap, i);
- len = STRLEN(cmd->uc_name);
+ len = strlen(cmd->uc_name);
cmp = STRNCMP(name, cmd->uc_name, name_len);
if (cmp == 0) {
if (name_len < len) {
@@ -1198,7 +1198,7 @@ static char *uc_split_args(char *arg, char **args, size_t *arglens, size_t argc,
static size_t add_cmd_modifier(char *buf, char *mod_str, bool *multi_mods)
{
- size_t result = STRLEN(mod_str);
+ size_t result = strlen(mod_str);
if (*multi_mods) {
result++;
}
@@ -1405,13 +1405,13 @@ static size_t uc_check_code(char *code, size_t len, char *buf, ucmd_T *cmd, exar
switch (quote) {
case 0: // No quoting, no splitting
- result = STRLEN(eap->arg);
+ result = strlen(eap->arg);
if (buf != NULL) {
STRCPY(buf, eap->arg);
}
break;
case 1: // Quote, but don't split
- result = STRLEN(eap->arg) + 2;
+ result = strlen(eap->arg) + 2;
for (p = eap->arg; *p; p++) {
if (*p == '\\' || *p == '"') {
result++;
@@ -1475,7 +1475,7 @@ static size_t uc_check_code(char *code, size_t len, char *buf, ucmd_T *cmd, exar
size_t num_len;
snprintf(num_buf, sizeof(num_buf), "%" PRId64, (int64_t)num);
- num_len = STRLEN(num_buf);
+ num_len = strlen(num_buf);
result = num_len;
if (quote) {
@@ -1637,7 +1637,7 @@ int do_ucmd(exarg_T *eap, bool preview)
break;
}
- totlen += STRLEN(p); // Add on the trailing characters
+ totlen += strlen(p); // Add on the trailing characters
buf = xmalloc(totlen + 1);
}
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 63a6eb9fb6..f6301457f3 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -746,7 +746,7 @@ void win_set_minimal_style(win_T *wp)
parse_winhl_opt(wp);
// signcolumn: use 'auto'
- if (wp->w_p_scl[0] != 'a' || STRLEN(wp->w_p_scl) >= 8) {
+ if (wp->w_p_scl[0] != 'a' || strlen(wp->w_p_scl) >= 8) {
free_string_option(wp->w_p_scl);
wp->w_p_scl = xstrdup("auto");
}
@@ -6467,10 +6467,10 @@ char_u *file_name_in_line(char_u *line, int col, int options, long count, char_u
// Also accept " line 999" with and without the same translation as
// used in last_set_msg().
p = ptr + len;
- if (STRNCMP(p, line_english, STRLEN(line_english)) == 0) {
- p += STRLEN(line_english);
- } else if (STRNCMP(p, line_transl, STRLEN(line_transl)) == 0) {
- p += STRLEN(line_transl);
+ if (STRNCMP(p, line_english, strlen(line_english)) == 0) {
+ p += strlen(line_english);
+ } else if (STRNCMP(p, line_transl, strlen(line_transl)) == 0) {
+ p += strlen(line_transl);
} else {
p = skipwhite(p);
}