eval: use char* for set_internal_string_var()

"name" param was cast to (const char *).
All calls to set_internal_string_var() cast from (char *) to (char_u *).
Remove these useless casts.
This commit is contained in:
Jan Edmund Lazo
2021-02-07 10:21:06 -05:00
parent f1fdeaf667
commit 7484c7de9a
5 changed files with 13 additions and 12 deletions

View File

@@ -3940,9 +3940,9 @@ int build_stl_str_hl(
// Store the current buffer number as a string variable
vim_snprintf((char *)buf_tmp, sizeof(buf_tmp), "%d", curbuf->b_fnum);
set_internal_string_var((char_u *)"g:actual_curbuf", buf_tmp);
set_internal_string_var("g:actual_curbuf", buf_tmp);
vim_snprintf((char *)win_tmp, sizeof(win_tmp), "%d", curwin->handle);
set_internal_string_var((char_u *)"g:actual_curwin", win_tmp);
set_internal_string_var("g:actual_curwin", win_tmp);
buf_T *const save_curbuf = curbuf;
win_T *const save_curwin = curwin;

View File

@@ -455,14 +455,15 @@ void eval_clear(void)
* Set an internal variable to a string value. Creates the variable if it does
* not already exist.
*/
void set_internal_string_var(char_u *name, char_u *value)
void set_internal_string_var(const char *name, char_u *value)
FUNC_ATTR_NONNULL_ARG(1)
{
const typval_T tv = {
typval_T tv = {
.v_type = VAR_STRING,
.vval.v_string = value,
};
set_var((const char *)name, STRLEN(name), (typval_T *)&tv, true);
set_var(name, strlen(name), &tv, true);
}
static lval_T *redir_lval = NULL;

View File

@@ -2375,13 +2375,13 @@ void ex_compiler(exarg_T *eap)
// Set "b:current_compiler" from "current_compiler".
p = get_var_value("g:current_compiler");
if (p != NULL) {
set_internal_string_var((char_u *)"b:current_compiler", p);
set_internal_string_var("b:current_compiler", p);
}
// Restore "current_compiler" for ":compiler {name}".
if (!eap->forceit) {
if (old_cur_comp != NULL) {
set_internal_string_var((char_u *)"g:current_compiler",
set_internal_string_var("g:current_compiler",
old_cur_comp);
xfree(old_cur_comp);
} else {

View File

@@ -3665,7 +3665,7 @@ static int qf_open_new_cwindow(qf_info_T *qi, int height)
static void qf_set_title_var(qf_list_T *qfl)
{
if (qfl->qf_title != NULL) {
set_internal_string_var((char_u *)"w:quickfix_title", qfl->qf_title);
set_internal_string_var("w:quickfix_title", qfl->qf_title);
}
}

View File

@@ -3419,7 +3419,7 @@ static void syn_cmd_on(exarg_T *eap, int syncing)
*/
static void syn_cmd_enable(exarg_T *eap, int syncing)
{
set_internal_string_var((char_u *)"syntax_cmd", (char_u *)"enable");
set_internal_string_var("syntax_cmd", (char_u *)"enable");
syn_cmd_onoff(eap, "syntax");
do_unlet(S_LEN("g:syntax_cmd"), true);
}
@@ -3432,7 +3432,7 @@ static void syn_cmd_reset(exarg_T *eap, int syncing)
{
eap->nextcmd = check_nextcmd(eap->arg);
if (!eap->skip) {
set_internal_string_var((char_u *)"syntax_cmd", (char_u *)"reset");
set_internal_string_var("syntax_cmd", (char_u *)"reset");
do_cmdline_cmd("runtime! syntax/syncolor.vim");
do_unlet(S_LEN("g:syntax_cmd"), true);
}
@@ -5614,14 +5614,14 @@ void ex_ownsyntax(exarg_T *eap)
// Move value of b:current_syntax to w:current_syntax.
new_value = get_var_value("b:current_syntax");
if (new_value != NULL) {
set_internal_string_var((char_u *)"w:current_syntax", new_value);
set_internal_string_var("w:current_syntax", new_value);
}
// Restore value of b:current_syntax.
if (old_value == NULL) {
do_unlet(S_LEN("b:current_syntax"), true);
} else {
set_internal_string_var((char_u *)"b:current_syntax", old_value);
set_internal_string_var("b:current_syntax", old_value);
xfree(old_value);
}
}