mirror of
https://github.com/neovim/neovim.git
synced 2025-10-17 15:21:47 +00:00
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:
@@ -3940,9 +3940,9 @@ int build_stl_str_hl(
|
|||||||
|
|
||||||
// Store the current buffer number as a string variable
|
// Store the current buffer number as a string variable
|
||||||
vim_snprintf((char *)buf_tmp, sizeof(buf_tmp), "%d", curbuf->b_fnum);
|
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);
|
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;
|
buf_T *const save_curbuf = curbuf;
|
||||||
win_T *const save_curwin = curwin;
|
win_T *const save_curwin = curwin;
|
||||||
|
@@ -455,14 +455,15 @@ void eval_clear(void)
|
|||||||
* Set an internal variable to a string value. Creates the variable if it does
|
* Set an internal variable to a string value. Creates the variable if it does
|
||||||
* not already exist.
|
* 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,
|
.v_type = VAR_STRING,
|
||||||
.vval.v_string = value,
|
.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;
|
static lval_T *redir_lval = NULL;
|
||||||
|
@@ -2375,13 +2375,13 @@ void ex_compiler(exarg_T *eap)
|
|||||||
// Set "b:current_compiler" from "current_compiler".
|
// Set "b:current_compiler" from "current_compiler".
|
||||||
p = get_var_value("g:current_compiler");
|
p = get_var_value("g:current_compiler");
|
||||||
if (p != NULL) {
|
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}".
|
// Restore "current_compiler" for ":compiler {name}".
|
||||||
if (!eap->forceit) {
|
if (!eap->forceit) {
|
||||||
if (old_cur_comp != NULL) {
|
if (old_cur_comp != NULL) {
|
||||||
set_internal_string_var((char_u *)"g:current_compiler",
|
set_internal_string_var("g:current_compiler",
|
||||||
old_cur_comp);
|
old_cur_comp);
|
||||||
xfree(old_cur_comp);
|
xfree(old_cur_comp);
|
||||||
} else {
|
} else {
|
||||||
|
@@ -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)
|
static void qf_set_title_var(qf_list_T *qfl)
|
||||||
{
|
{
|
||||||
if (qfl->qf_title != NULL) {
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -3419,7 +3419,7 @@ static void syn_cmd_on(exarg_T *eap, int syncing)
|
|||||||
*/
|
*/
|
||||||
static void syn_cmd_enable(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");
|
syn_cmd_onoff(eap, "syntax");
|
||||||
do_unlet(S_LEN("g:syntax_cmd"), true);
|
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);
|
eap->nextcmd = check_nextcmd(eap->arg);
|
||||||
if (!eap->skip) {
|
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_cmdline_cmd("runtime! syntax/syncolor.vim");
|
||||||
do_unlet(S_LEN("g:syntax_cmd"), true);
|
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.
|
// Move value of b:current_syntax to w:current_syntax.
|
||||||
new_value = get_var_value("b:current_syntax");
|
new_value = get_var_value("b:current_syntax");
|
||||||
if (new_value != NULL) {
|
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.
|
// Restore value of b:current_syntax.
|
||||||
if (old_value == NULL) {
|
if (old_value == NULL) {
|
||||||
do_unlet(S_LEN("b:current_syntax"), true);
|
do_unlet(S_LEN("b:current_syntax"), true);
|
||||||
} else {
|
} else {
|
||||||
set_internal_string_var((char_u *)"b:current_syntax", old_value);
|
set_internal_string_var("b:current_syntax", old_value);
|
||||||
xfree(old_value);
|
xfree(old_value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user