Improve coding style

This commit is contained in:
watiko
2015-12-01 23:35:37 +09:00
parent 8c00c34b91
commit 3a60f927b8

View File

@@ -1796,9 +1796,8 @@ do_set (
if (errmsg != NULL) if (errmsg != NULL)
goto skip; goto skip;
if (saved_origval != NULL) { if (saved_origval != NULL) {
char_u buf_type[7]; char buf_type[7];
vim_snprintf(buf_type, ARRAY_SIZE(buf_type), "%s",
vim_snprintf((char *)buf_type, 7, "%s",
(opt_flags & OPT_LOCAL) ? "local" : "global"); (opt_flags & OPT_LOCAL) ? "local" : "global");
set_vim_var_string(VV_OPTION_NEW, set_vim_var_string(VV_OPTION_NEW,
*(char_u **)varp, -1); *(char_u **)varp, -1);
@@ -2384,8 +2383,8 @@ set_string_option (
// call autocommand after handling side effects // call autocommand after handling side effects
if (saved_oldval != NULL) { if (saved_oldval != NULL) {
char_u buf_type[7]; char buf_type[7];
vim_snprintf((char *)buf_type, 7, "%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, *varp, -1); set_vim_var_string(VV_OPTION_NEW, *varp, -1);
set_vim_var_string(VV_OPTION_OLD, saved_oldval, -1); set_vim_var_string(VV_OPTION_OLD, saved_oldval, -1);
@@ -3870,10 +3869,14 @@ set_bool_option (
options[opt_idx].flags |= P_WAS_SET; options[opt_idx].flags |= P_WAS_SET;
if (!starting) { if (!starting) {
char_u buf_old[2], buf_new[2], buf_type[7]; char buf_old[2];
vim_snprintf((char *)buf_old, 2, "%d", old_value ? true: false); char buf_new[2];
vim_snprintf((char *)buf_new, 2, "%d", value ? true: false); char buf_type[7];
vim_snprintf((char *)buf_type, 7, "%s", vim_snprintf(buf_old, ARRAY_SIZE(buf_old), "%d",
old_value ? true: false);
vim_snprintf(buf_new, ARRAY_SIZE(buf_new), "%d",
value ? true: false);
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, buf_new, -1); set_vim_var_string(VV_OPTION_NEW, buf_new, -1);
set_vim_var_string(VV_OPTION_OLD, buf_old, -1); set_vim_var_string(VV_OPTION_OLD, buf_old, -1);
@@ -4256,10 +4259,12 @@ set_num_option (
options[opt_idx].flags |= P_WAS_SET; options[opt_idx].flags |= P_WAS_SET;
if (!starting && errmsg == NULL) { if (!starting && errmsg == NULL) {
char_u buf_old[11], buf_new[11], buf_type[7]; char buf_old[NUMBUFLEN];
vim_snprintf((char *)buf_old, 10, "%ld", old_value); char buf_new[NUMBUFLEN];
vim_snprintf((char *)buf_new, 10, "%ld", value); char buf_type[7];
vim_snprintf((char *)buf_type, 7, "%s", vim_snprintf(buf_old, ARRAY_SIZE(buf_old), "%ld", old_value);
vim_snprintf(buf_new, ARRAY_SIZE(buf_new), "%ld", value);
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, buf_new, -1); set_vim_var_string(VV_OPTION_NEW, buf_new, -1);
set_vim_var_string(VV_OPTION_OLD, buf_old, -1); set_vim_var_string(VV_OPTION_OLD, buf_old, -1);