aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/normal.c
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2022-10-15 18:17:07 +0200
committerGitHub <noreply@github.com>2022-10-15 18:17:07 +0200
commitd4841e24dac9a16b8b90b212df20872badc4468e (patch)
tree921d79e13daf44adbfbc5585f7dc405b6429ed19 /src/nvim/normal.c
parent0434f732a696248c24e111b558406f9534db6ca3 (diff)
parent04cdea5f4ac49fa62cc4091a5c26791b80b4cc4c (diff)
downloadrneovim-d4841e24dac9a16b8b90b212df20872badc4468e.tar.gz
rneovim-d4841e24dac9a16b8b90b212df20872badc4468e.tar.bz2
rneovim-d4841e24dac9a16b8b90b212df20872badc4468e.zip
Merge pull request #20140 from dundargoc/refactor/char_u/12
refactor: replace char_u with char 12: remove `STRLEN` part 2
Diffstat (limited to 'src/nvim/normal.c')
-rw-r--r--src/nvim/normal.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index 0ef7b76de3..1ac8d7013e 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -2622,7 +2622,7 @@ void may_clear_cmdline(void)
// Routines for displaying a partly typed command
#define SHOWCMD_BUFLEN (SHOWCMD_COLS + 1 + 30)
-static char_u showcmd_buf[SHOWCMD_BUFLEN];
+static char showcmd_buf[SHOWCMD_BUFLEN];
static char_u old_showcmd_buf[SHOWCMD_BUFLEN]; // For push_showcmd()
static bool showcmd_is_clear = true;
static bool showcmd_visual = false;
@@ -2662,10 +2662,10 @@ void clear_showcmd(void)
getvcols(curwin, &curwin->w_cursor, &VIsual, &leftcol, &rightcol);
p_sbr = saved_sbr;
curwin->w_p_sbr = saved_w_sbr;
- snprintf((char *)showcmd_buf, SHOWCMD_BUFLEN, "%" PRId64 "x%" PRId64,
+ snprintf(showcmd_buf, SHOWCMD_BUFLEN, "%" PRId64 "x%" PRId64,
(int64_t)lines, (int64_t)rightcol - leftcol + 1);
} else if (VIsual_mode == 'V' || VIsual.lnum != curwin->w_cursor.lnum) {
- snprintf((char *)showcmd_buf, SHOWCMD_BUFLEN, "%" PRId64, (int64_t)lines);
+ snprintf(showcmd_buf, SHOWCMD_BUFLEN, "%" PRId64, (int64_t)lines);
} else {
char_u *s, *e;
int l;
@@ -2691,9 +2691,9 @@ void clear_showcmd(void)
s += l;
}
if (bytes == chars) {
- sprintf((char *)showcmd_buf, "%d", chars);
+ snprintf(showcmd_buf, SHOWCMD_BUFLEN, "%d", chars);
} else {
- sprintf((char *)showcmd_buf, "%d-%d", chars, bytes);
+ snprintf(showcmd_buf, SHOWCMD_BUFLEN, "%d-%d", chars, bytes);
}
}
int limit = ui_has(kUIMessages) ? SHOWCMD_BUFLEN - 1 : SHOWCMD_COLS;
@@ -2783,7 +2783,7 @@ static void del_from_showcmd(int len)
return;
}
- old_len = (int)STRLEN(showcmd_buf);
+ old_len = (int)strlen(showcmd_buf);
if (len > old_len) {
len = old_len;
}
@@ -2822,7 +2822,7 @@ static void display_showcmd(void)
}
int len;
- len = (int)STRLEN(showcmd_buf);
+ len = (int)strlen(showcmd_buf);
showcmd_is_clear = (len == 0);
if (ui_has(kUIMessages)) {
@@ -2831,7 +2831,7 @@ static void display_showcmd(void)
if (len > 0) {
// placeholder for future highlight support
ADD_C(chunk, INTEGER_OBJ(0));
- ADD_C(chunk, STRING_OBJ(cstr_as_string((char *)showcmd_buf)));
+ ADD_C(chunk, STRING_OBJ(cstr_as_string(showcmd_buf)));
ADD_C(content, ARRAY_OBJ(chunk));
}
ui_call_msg_showcmd(content);
@@ -2843,7 +2843,7 @@ static void display_showcmd(void)
grid_puts_line_start(&msg_grid_adj, showcmd_row);
if (!showcmd_is_clear) {
- grid_puts(&msg_grid_adj, (char *)showcmd_buf, showcmd_row, sc_col,
+ grid_puts(&msg_grid_adj, showcmd_buf, showcmd_row, sc_col,
HL_ATTR(HLF_MSG));
}
@@ -4360,7 +4360,7 @@ static void nv_ident(cmdarg_T *cap)
aux_ptr = "\\|\"\n*?[";
}
- p = buf + STRLEN(buf);
+ p = buf + strlen(buf);
while (n-- > 0) {
// put a backslash before \ and some others
if (vim_strchr(aux_ptr, *ptr) != NULL) {
@@ -5295,7 +5295,7 @@ static void nv_kundo(cmdarg_T *cap)
/// Handle the "r" command.
static void nv_replace(cmdarg_T *cap)
{
- char_u *ptr;
+ char *ptr;
int had_ctrl_v;
if (checkclearop(cap->oap)) {
@@ -5358,9 +5358,9 @@ static void nv_replace(cmdarg_T *cap)
}
// Abort if not enough characters to replace.
- ptr = (char_u *)get_cursor_pos_ptr();
- if (STRLEN(ptr) < (unsigned)cap->count1
- || (mb_charlen(ptr) < cap->count1)) {
+ ptr = get_cursor_pos_ptr();
+ if (strlen(ptr) < (unsigned)cap->count1
+ || (mb_charlen((char_u *)ptr) < cap->count1)) {
clearopbeep(cap->oap);
return;
}