option: Make all pointers in set_string_option constant

This commit is contained in:
ZyX 2016-06-24 17:23:29 +03:00
parent 458a4d0444
commit 7900e38a8f

View File

@ -2340,15 +2340,11 @@ static char *set_string_option(const int opt_idx, const char *const value,
char *const oldval = *varp; char *const oldval = *varp;
*varp = s; *varp = s;
char *saved_oldval = NULL; char *const saved_oldval = (starting ? NULL : xstrdup(oldval));
if (!starting) {
saved_oldval = xstrdup(oldval);
}
char *r = NULL; char *const r = (char *)did_set_string_option(
if ((r = (char *)did_set_string_option(opt_idx, (char_u **)varp, (int)true, opt_idx, (char_u **)varp, (int)true, (char_u *)oldval, NULL, opt_flags);
(char_u *)oldval, NULL, opt_flags)) if (r == NULL) {
== NULL) {
did_set_option(opt_idx, opt_flags, true); did_set_option(opt_idx, opt_flags, true);
} }
@ -2357,7 +2353,7 @@ static char *set_string_option(const int opt_idx, const char *const value,
char buf_type[7]; char buf_type[7];
vim_snprintf(buf_type, ARRAY_SIZE(buf_type), "%s", vim_snprintf(buf_type, ARRAY_SIZE(buf_type), "%s",
(opt_flags & OPT_LOCAL) ? "local" : "global"); (opt_flags & OPT_LOCAL) ? "local" : "global");
set_vim_var_string(VV_OPTION_NEW, (char *) (*varp), -1); set_vim_var_string(VV_OPTION_NEW, (char *)(*varp), -1);
set_vim_var_string(VV_OPTION_OLD, saved_oldval, -1); set_vim_var_string(VV_OPTION_OLD, saved_oldval, -1);
set_vim_var_string(VV_OPTION_TYPE, buf_type, -1); set_vim_var_string(VV_OPTION_TYPE, buf_type, -1);
apply_autocmds(EVENT_OPTIONSET, apply_autocmds(EVENT_OPTIONSET,