aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/mapping.c
diff options
context:
space:
mode:
authordundargoc <33953936+dundargoc@users.noreply.github.com>2023-01-09 14:13:06 +0100
committerGitHub <noreply@github.com>2023-01-09 21:13:06 +0800
commit149209400383c673fdb4fdd1c9a7639139f17936 (patch)
treed2c4e5fa69fc302ec3050978a303f6a479f30291 /src/nvim/mapping.c
parentfc2cd28547954e64ef429c83733f06fa3ee75d50 (diff)
downloadrneovim-149209400383c673fdb4fdd1c9a7639139f17936.tar.gz
rneovim-149209400383c673fdb4fdd1c9a7639139f17936.tar.bz2
rneovim-149209400383c673fdb4fdd1c9a7639139f17936.zip
refactor: replace char_u with char 17 - remove STRLCPY (#21235)
refactor: replace char_u with char Work on https://github.com/neovim/neovim/issues/459
Diffstat (limited to 'src/nvim/mapping.c')
-rw-r--r--src/nvim/mapping.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/nvim/mapping.c b/src/nvim/mapping.c
index 5fffc72056..199cc7b369 100644
--- a/src/nvim/mapping.c
+++ b/src/nvim/mapping.c
@@ -271,7 +271,7 @@ static bool set_maparg_lhs_rhs(const char *const orig_lhs, const size_t orig_lhs
return false;
}
mapargs->lhs_len = strlen(replaced);
- STRLCPY(mapargs->lhs, replaced, sizeof(mapargs->lhs));
+ xstrlcpy(mapargs->lhs, replaced, sizeof(mapargs->lhs));
if (did_simplify) {
replaced = replace_termcodes(orig_lhs, orig_lhs_len, &bufarg, flags | REPTERM_NO_SIMPLIFY,
NULL, cpo_flags);
@@ -279,7 +279,7 @@ static bool set_maparg_lhs_rhs(const char *const orig_lhs, const size_t orig_lhs
return false;
}
mapargs->alt_lhs_len = strlen(replaced);
- STRLCPY(mapargs->alt_lhs, replaced, sizeof(mapargs->alt_lhs));
+ xstrlcpy(mapargs->alt_lhs, replaced, sizeof(mapargs->alt_lhs));
} else {
mapargs->alt_lhs_len = 0;
}
@@ -298,7 +298,7 @@ static void set_maparg_rhs(const char *const orig_rhs, const size_t orig_rhs_len
if (rhs_lua == LUA_NOREF) {
mapargs->orig_rhs_len = orig_rhs_len;
mapargs->orig_rhs = xcalloc(mapargs->orig_rhs_len + 1, sizeof(char_u));
- STRLCPY(mapargs->orig_rhs, orig_rhs, mapargs->orig_rhs_len + 1);
+ xstrlcpy(mapargs->orig_rhs, orig_rhs, mapargs->orig_rhs_len + 1);
if (STRICMP(orig_rhs, "<nop>") == 0) { // "<Nop>" means nothing
mapargs->rhs = xcalloc(1, sizeof(char_u)); // single NUL-char
mapargs->rhs_len = 0;
@@ -427,11 +427,11 @@ static int str_to_mapargs(const char_u *strargs, bool is_unmap, MapArguments *ma
if (orig_lhs_len >= 256) {
return 1;
}
- char_u lhs_to_replace[256];
- STRLCPY(lhs_to_replace, to_parse, orig_lhs_len + 1);
+ char lhs_to_replace[256];
+ xstrlcpy(lhs_to_replace, to_parse, orig_lhs_len + 1);
size_t orig_rhs_len = strlen(rhs_start);
- if (!set_maparg_lhs_rhs((char *)lhs_to_replace, orig_lhs_len,
+ if (!set_maparg_lhs_rhs(lhs_to_replace, orig_lhs_len,
rhs_start, orig_rhs_len, LUA_NOREF,
CPO_TO_CPO_FLAGS, mapargs)) {
return 1;
@@ -464,7 +464,7 @@ static void map_add(buf_T *buf, mapblock_T **map_table, mapblock_T **abbr_table,
mp->m_keys = xstrdup(keys);
mp->m_str = args->rhs;
- mp->m_orig_str = (char *)args->orig_rhs;
+ mp->m_orig_str = args->orig_rhs;
mp->m_luaref = args->rhs_lua;
if (!simplified) {
args->rhs = NULL;
@@ -776,7 +776,7 @@ static int buf_do_map(int maptype, MapArguments *args, int mode, bool is_abbrev,
XFREE_CLEAR(mp->m_orig_str);
}
mp->m_str = args->rhs;
- mp->m_orig_str = (char *)args->orig_rhs;
+ mp->m_orig_str = args->orig_rhs;
mp->m_luaref = args->rhs_lua;
if (!keyround1_simplified) {
args->rhs = NULL;