refactor: remove redundant const char * casts

This commit is contained in:
ii14
2023-04-07 19:40:57 +02:00
committed by GitHub
parent 1d2a29f75b
commit 9408f2dcf7
56 changed files with 302 additions and 350 deletions

View File

@@ -2947,7 +2947,7 @@ static void color_expr_cmdline(const CmdlineInfo *const colored_ccline,
{
ParserLine parser_lines[] = {
{
.data = (const char *)colored_ccline->cmdbuff,
.data = colored_ccline->cmdbuff,
.size = strlen(colored_ccline->cmdbuff),
.allocated = false,
},
@@ -3051,7 +3051,7 @@ static bool color_cmdline(CmdlineInfo *colored_ccline)
bool can_free_cb = false;
TryState tstate;
Error err = ERROR_INIT;
const char *err_errmsg = (const char *)e_intern2;
const char *err_errmsg = e_intern2;
bool dgc_ret = true;
bool tl_ret = true;
@@ -3084,8 +3084,7 @@ static bool color_cmdline(CmdlineInfo *colored_ccline)
}
if (colored_ccline->cmdbuff[colored_ccline->cmdlen] != NUL) {
arg_allocated = true;
arg.vval.v_string = xmemdupz((const char *)colored_ccline->cmdbuff,
(size_t)colored_ccline->cmdlen);
arg.vval.v_string = xmemdupz(colored_ccline->cmdbuff, (size_t)colored_ccline->cmdlen);
}
// msg_start() called by e.g. :echo may shift command-line to the first column
// even though msg_silent is here. Two ways to workaround this problem without
@@ -3204,8 +3203,7 @@ color_cmdline_end:
if (arg_allocated) {
ccline_colors->cmdbuff = arg.vval.v_string;
} else {
ccline_colors->cmdbuff = xmemdupz((const char *)colored_ccline->cmdbuff,
(size_t)colored_ccline->cmdlen);
ccline_colors->cmdbuff = xmemdupz(colored_ccline->cmdbuff, (size_t)colored_ccline->cmdlen);
}
tv_clear(&tv);
return ret;
@@ -4558,7 +4556,7 @@ bool is_in_cmdwin(void)
char *script_get(exarg_T *const eap, size_t *const lenp)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_MALLOC
{
const char *const cmd = (const char *)eap->arg;
const char *const cmd = eap->arg;
if (cmd[0] != '<' || cmd[1] != '<' || eap->getline == NULL) {
*lenp = strlen(eap->arg);
@@ -4570,7 +4568,7 @@ char *script_get(exarg_T *const eap, size_t *const lenp)
ga_init(&ga, 1, 0x400);
}
const char *const end_pattern = (cmd[2] != NUL ? (const char *)skipwhite(cmd + 2) : ".");
const char *const end_pattern = (cmd[2] != NUL ? skipwhite(cmd + 2) : ".");
for (;;) {
char *const theline = eap->getline(eap->cstack->cs_looplevel > 0 ? -1 : NUL, eap->cookie, 0,
true);