mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
option: use char* for set_string_option_direct()
"name" param was cast to (const char *). All calls to set_string_option_direct() cast 1st arg from (char *) to (char_u *). Remove these useless casts.
This commit is contained in:
parent
a7d9df996d
commit
f1fdeaf667
@ -544,7 +544,7 @@ char_u *au_event_disable(char *what)
|
||||
} else {
|
||||
STRCAT(new_ei, what);
|
||||
}
|
||||
set_string_option_direct((char_u *)"ei", -1, new_ei, OPT_FREE, SID_NONE);
|
||||
set_string_option_direct("ei", -1, new_ei, OPT_FREE, SID_NONE);
|
||||
xfree(new_ei);
|
||||
|
||||
return save_ei;
|
||||
@ -553,7 +553,7 @@ char_u *au_event_disable(char *what)
|
||||
void au_event_restore(char_u *old_ei)
|
||||
{
|
||||
if (old_ei != NULL) {
|
||||
set_string_option_direct((char_u *)"ei", -1, old_ei, OPT_FREE, SID_NONE);
|
||||
set_string_option_direct("ei", -1, old_ei, OPT_FREE, SID_NONE);
|
||||
xfree(old_ei);
|
||||
}
|
||||
}
|
||||
|
@ -3236,7 +3236,7 @@ void maketitle(void)
|
||||
0, maxlen, NULL, NULL);
|
||||
title_str = (char_u *)buf;
|
||||
if (called_emsg) {
|
||||
set_string_option_direct((char_u *)"titlestring", -1, (char_u *)"",
|
||||
set_string_option_direct("titlestring", -1, (char_u *)"",
|
||||
OPT_FREE, SID_ERROR);
|
||||
}
|
||||
called_emsg |= save_called_emsg;
|
||||
@ -3346,7 +3346,7 @@ void maketitle(void)
|
||||
p_iconstring, use_sandbox,
|
||||
0, 0, NULL, NULL);
|
||||
if (called_emsg) {
|
||||
set_string_option_direct((char_u *)"iconstring", -1,
|
||||
set_string_option_direct("iconstring", -1,
|
||||
(char_u *)"", OPT_FREE, SID_ERROR);
|
||||
}
|
||||
called_emsg |= save_called_emsg;
|
||||
|
@ -1375,7 +1375,7 @@ void diff_win_options(win_T *wp, int addbuf)
|
||||
}
|
||||
wp->w_p_fdm_save = vim_strsave(wp->w_p_fdm);
|
||||
}
|
||||
set_string_option_direct((char_u *)"fdm", -1, (char_u *)"diff",
|
||||
set_string_option_direct("fdm", -1, (char_u *)"diff",
|
||||
OPT_LOCAL | OPT_FREE, 0);
|
||||
curwin = old_curwin;
|
||||
curbuf = curwin->w_buffer;
|
||||
|
@ -4227,7 +4227,7 @@ skip:
|
||||
size_t subsize = preview_lines.subresults.size;
|
||||
if (preview && !aborting()) {
|
||||
if (got_quit || profile_passed_limit(timeout)) { // Too slow, disable.
|
||||
set_string_option_direct((char_u *)"icm", -1, (char_u *)"", OPT_FREE,
|
||||
set_string_option_direct("icm", -1, (char_u *)"", OPT_FREE,
|
||||
SID_NONE);
|
||||
} else if (*p_icm != NUL && pat != NULL) {
|
||||
if (pre_src_id == 0) {
|
||||
@ -4528,7 +4528,7 @@ prepare_tagpreview (
|
||||
RESET_BINDING(curwin); /* don't take over 'scrollbind'
|
||||
and 'cursorbind' */
|
||||
curwin->w_p_diff = false; // no 'diff'
|
||||
set_string_option_direct((char_u *)"fdc", -1, // no 'foldcolumn'
|
||||
set_string_option_direct("fdc", -1, // no 'foldcolumn'
|
||||
(char_u *)"0", OPT_FREE, SID_NONE);
|
||||
return true;
|
||||
}
|
||||
@ -5023,7 +5023,7 @@ int find_help_tags(const char_u *arg, int *num_matches, char_u ***matches,
|
||||
static void prepare_help_buffer(void)
|
||||
{
|
||||
curbuf->b_help = true;
|
||||
set_string_option_direct((char_u *)"buftype", -1, (char_u *)"help",
|
||||
set_string_option_direct("buftype", -1, (char_u *)"help",
|
||||
OPT_FREE|OPT_LOCAL, 0);
|
||||
|
||||
// Always set these options after jumping to a help tag, because the
|
||||
@ -5033,13 +5033,13 @@ static void prepare_help_buffer(void)
|
||||
// Only set it when needed, buf_init_chartab() is some work.
|
||||
char_u *p = (char_u *)"!-~,^*,^|,^\",192-255";
|
||||
if (STRCMP(curbuf->b_p_isk, p) != 0) {
|
||||
set_string_option_direct((char_u *)"isk", -1, p, OPT_FREE|OPT_LOCAL, 0);
|
||||
set_string_option_direct("isk", -1, p, OPT_FREE|OPT_LOCAL, 0);
|
||||
check_buf_options(curbuf);
|
||||
(void)buf_init_chartab(curbuf, FALSE);
|
||||
}
|
||||
|
||||
// Don't use the global foldmethod.
|
||||
set_string_option_direct((char_u *)"fdm", -1, (char_u *)"manual",
|
||||
set_string_option_direct("fdm", -1, (char_u *)"manual",
|
||||
OPT_FREE|OPT_LOCAL, 0);
|
||||
|
||||
curbuf->b_p_ts = 8; // 'tabstop' is 8.
|
||||
@ -5659,7 +5659,7 @@ static buf_T *show_sub(exarg_T *eap, pos_T old_cusr,
|
||||
cmdmod.tab = 0; // disable :tab modifier
|
||||
cmdmod.noswapfile = true; // disable swap for preview buffer
|
||||
// disable file info message
|
||||
set_string_option_direct((char_u *)"shm", -1, (char_u *)"F", OPT_FREE,
|
||||
set_string_option_direct("shm", -1, (char_u *)"F", OPT_FREE,
|
||||
SID_NONE);
|
||||
|
||||
bool outside_curline = (eap->line1 != old_cusr.lnum
|
||||
@ -5782,7 +5782,7 @@ static buf_T *show_sub(exarg_T *eap, pos_T old_cusr,
|
||||
update_screen(SOME_VALID);
|
||||
RedrawingDisabled = save_rd;
|
||||
|
||||
set_string_option_direct((char_u *)"shm", -1, save_shm_p, OPT_FREE, SID_NONE);
|
||||
set_string_option_direct("shm", -1, save_shm_p, OPT_FREE, SID_NONE);
|
||||
xfree(save_shm_p);
|
||||
|
||||
cmdmod = save_cmdmod;
|
||||
|
@ -2179,7 +2179,7 @@ int parse_command_modifiers(exarg_T *eap, char_u **errormsg, bool skip_only)
|
||||
// Set 'eventignore' to "all". Restore the
|
||||
// existing option value later.
|
||||
cmdmod.save_ei = vim_strsave(p_ei);
|
||||
set_string_option_direct((char_u *)"ei", -1,
|
||||
set_string_option_direct("ei", -1,
|
||||
(char_u *)"all", OPT_FREE, SID_NONE);
|
||||
}
|
||||
continue;
|
||||
@ -2291,9 +2291,8 @@ static void undo_cmdmod(const exarg_T *eap, int save_msg_scroll)
|
||||
}
|
||||
|
||||
if (cmdmod.save_ei != NULL) {
|
||||
/* Restore 'eventignore' to the value before ":noautocmd". */
|
||||
set_string_option_direct((char_u *)"ei", -1, cmdmod.save_ei,
|
||||
OPT_FREE, SID_NONE);
|
||||
// Restore 'eventignore' to the value before ":noautocmd".
|
||||
set_string_option_direct("ei", -1, cmdmod.save_ei, OPT_FREE, SID_NONE);
|
||||
free_string_option(cmdmod.save_ei);
|
||||
}
|
||||
|
||||
|
@ -886,7 +886,7 @@ static uint8_t *command_line_enter(int firstc, long count, int indent)
|
||||
need_wait_return = false;
|
||||
}
|
||||
|
||||
set_string_option_direct((char_u *)"icm", -1, s->save_p_icm, OPT_FREE,
|
||||
set_string_option_direct("icm", -1, s->save_p_icm, OPT_FREE,
|
||||
SID_NONE);
|
||||
State = s->save_State;
|
||||
setmouse();
|
||||
|
@ -1644,8 +1644,7 @@ failed:
|
||||
save_file_ff(curbuf);
|
||||
// If editing a new file: set 'fenc' for the current buffer.
|
||||
// Also for ":read ++edit file".
|
||||
set_string_option_direct((char_u *)"fenc", -1, fenc,
|
||||
OPT_FREE | OPT_LOCAL, 0);
|
||||
set_string_option_direct("fenc", -1, fenc, OPT_FREE | OPT_LOCAL, 0);
|
||||
}
|
||||
if (fenc_alloced)
|
||||
xfree(fenc);
|
||||
@ -2002,7 +2001,7 @@ void set_forced_fenc(exarg_T *eap)
|
||||
{
|
||||
if (eap->force_enc != 0) {
|
||||
char_u *fenc = enc_canonize(eap->cmd + eap->force_enc);
|
||||
set_string_option_direct((char_u *)"fenc", -1, fenc, OPT_FREE|OPT_LOCAL, 0);
|
||||
set_string_option_direct("fenc", -1, fenc, OPT_FREE|OPT_LOCAL, 0);
|
||||
xfree(fenc);
|
||||
}
|
||||
}
|
||||
|
@ -1404,9 +1404,9 @@ static void load_plugins(void)
|
||||
static void handle_quickfix(mparm_T *paramp)
|
||||
{
|
||||
if (paramp->edit_type == EDIT_QF) {
|
||||
if (paramp->use_ef != NULL)
|
||||
set_string_option_direct((char_u *)"ef", -1,
|
||||
paramp->use_ef, OPT_FREE, SID_CARG);
|
||||
if (paramp->use_ef != NULL) {
|
||||
set_string_option_direct("ef", -1, paramp->use_ef, OPT_FREE, SID_CARG);
|
||||
}
|
||||
vim_snprintf((char *)IObuff, IOSIZE, "cfile %s", p_ef);
|
||||
if (qf_init(NULL, p_ef, p_efm, true, IObuff, p_menc) < 0) {
|
||||
msg_putchar('\n');
|
||||
|
@ -2120,9 +2120,9 @@ static int shada_idx = -1;
|
||||
// "set_sid".
|
||||
void
|
||||
set_string_option_direct(
|
||||
char_u *name,
|
||||
const char *name,
|
||||
int opt_idx,
|
||||
char_u *val,
|
||||
const char_u *val,
|
||||
int opt_flags, // OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL
|
||||
int set_sid
|
||||
)
|
||||
@ -2133,7 +2133,7 @@ set_string_option_direct(
|
||||
int idx = opt_idx;
|
||||
|
||||
if (idx == -1) { // Use name.
|
||||
idx = findoption((const char *)name);
|
||||
idx = findoption(name);
|
||||
if (idx < 0) { // Not found (should not happen).
|
||||
internal_error("set_string_option_direct()");
|
||||
IEMSG2(_("For option %s"), name);
|
||||
@ -3791,7 +3791,7 @@ static char *set_bool_option(const int opt_idx, char_u *const varp,
|
||||
if (p_terse && p == NULL) {
|
||||
STRCPY(IObuff, p_shm);
|
||||
STRCAT(IObuff, "s");
|
||||
set_string_option_direct((char_u *)"shm", -1, IObuff, OPT_FREE, 0);
|
||||
set_string_option_direct("shm", -1, IObuff, OPT_FREE, 0);
|
||||
} else if (!p_terse && p != NULL) { // remove 's' from p_shm
|
||||
STRMOVE(p, p + 1);
|
||||
}
|
||||
@ -4597,6 +4597,7 @@ bool set_tty_option(const char *name, char *value)
|
||||
///
|
||||
/// @return Option index or -1 if option was not found.
|
||||
static int findoption(const char *const arg)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
return findoption_len(arg, strlen(arg));
|
||||
}
|
||||
@ -7054,7 +7055,7 @@ void set_fileformat(int eol_style, int opt_flags)
|
||||
|
||||
// p is NULL if "eol_style" is EOL_UNKNOWN.
|
||||
if (p != NULL) {
|
||||
set_string_option_direct((char_u *)"ff",
|
||||
set_string_option_direct("ff",
|
||||
-1,
|
||||
(char_u *)p,
|
||||
OPT_FREE | opt_flags,
|
||||
|
@ -4951,7 +4951,7 @@ void ex_cfile(exarg_T *eap)
|
||||
}
|
||||
}
|
||||
if (*eap->arg != NUL) {
|
||||
set_string_option_direct((char_u *)"ef", -1, eap->arg, OPT_FREE, 0);
|
||||
set_string_option_direct("ef", -1, eap->arg, OPT_FREE, 0);
|
||||
}
|
||||
|
||||
char_u *enc = (*curbuf->b_p_menc != NUL) ? curbuf->b_p_menc : p_menc;
|
||||
|
@ -5092,9 +5092,9 @@ static void redraw_custom_statusline(win_T *wp)
|
||||
// When there is an error disable the statusline, otherwise the
|
||||
// display is messed up with errors and a redraw triggers the problem
|
||||
// again and again.
|
||||
set_string_option_direct((char_u *)"statusline", -1,
|
||||
(char_u *)"", OPT_FREE | (*wp->w_p_stl != NUL
|
||||
? OPT_LOCAL : OPT_GLOBAL), SID_ERROR);
|
||||
set_string_option_direct("statusline", -1, (char_u *)"",
|
||||
OPT_FREE | (*wp->w_p_stl != NUL
|
||||
? OPT_LOCAL : OPT_GLOBAL), SID_ERROR);
|
||||
}
|
||||
did_emsg |= saved_did_emsg;
|
||||
entered = false;
|
||||
@ -5175,7 +5175,7 @@ get_keymap_str (
|
||||
static void
|
||||
win_redr_custom (
|
||||
win_T *wp,
|
||||
int draw_ruler /* TRUE or FALSE */
|
||||
bool draw_ruler
|
||||
)
|
||||
{
|
||||
static int entered = FALSE;
|
||||
@ -6852,7 +6852,7 @@ void draw_tabline(void)
|
||||
did_emsg = false;
|
||||
win_redr_custom(NULL, false);
|
||||
if (did_emsg) {
|
||||
set_string_option_direct((char_u *)"tabline", -1,
|
||||
set_string_option_direct("tabline", -1,
|
||||
(char_u *)"", OPT_FREE, SID_ERROR);
|
||||
}
|
||||
did_emsg |= saved_did_emsg;
|
||||
@ -7114,11 +7114,12 @@ static void win_redr_ruler(win_T *wp, int always)
|
||||
if (*p_ruf) {
|
||||
int save_called_emsg = called_emsg;
|
||||
|
||||
called_emsg = FALSE;
|
||||
win_redr_custom(wp, TRUE);
|
||||
if (called_emsg)
|
||||
set_string_option_direct((char_u *)"rulerformat", -1,
|
||||
(char_u *)"", OPT_FREE, SID_ERROR);
|
||||
called_emsg = false;
|
||||
win_redr_custom(wp, true);
|
||||
if (called_emsg) {
|
||||
set_string_option_direct("rulerformat", -1, (char_u *)"",
|
||||
OPT_FREE, SID_ERROR);
|
||||
}
|
||||
called_emsg |= save_called_emsg;
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user