comparison src/option.c @ 29509:d61007cc39b3 v9.0.0096

patch 9.0.0096: flag "new_value_alloced" is always true Commit: https://github.com/vim/vim/commit/f6782732ab4acd02211923fbdccb457dacaf277e Author: zeertzjq <zeertzjq@outlook.com> Date: Wed Jul 27 18:26:03 2022 +0100 patch 9.0.0096: flag "new_value_alloced" is always true Problem: Flag "new_value_alloced" is always true. Solution: Remove "new_value_alloced". (closes https://github.com/vim/vim/issues/10792)
author Bram Moolenaar <Bram@vim.org>
date Wed, 27 Jul 2022 19:30:03 +0200
parents 9908c07ccb56
children 8a243ecfe2dd
comparison
equal deleted inserted replaced
29508:10d69d910f49 29509:d61007cc39b3
1714 char_u *saved_origval_g = NULL; 1714 char_u *saved_origval_g = NULL;
1715 char_u *saved_newval = NULL; 1715 char_u *saved_newval = NULL;
1716 #endif 1716 #endif
1717 unsigned newlen; 1717 unsigned newlen;
1718 int comma; 1718 int comma;
1719 int new_value_alloced; // new string option
1720 // was allocated
1721 1719
1722 // When using ":set opt=val" for a global option 1720 // When using ":set opt=val" for a global option
1723 // with a local value the local value will be 1721 // with a local value the local value will be
1724 // reset, use the global value here. 1722 // reset, use the global value here.
1725 if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0 1723 if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0
1783 s = option_expand(opt_idx, newval); 1781 s = option_expand(opt_idx, newval);
1784 if (s == NULL) 1782 if (s == NULL)
1785 s = newval; 1783 s = newval;
1786 newval = vim_strsave(s); 1784 newval = vim_strsave(s);
1787 } 1785 }
1788 new_value_alloced = TRUE;
1789 } 1786 }
1790 else if (nextchar == '<') // set to global val 1787 else if (nextchar == '<') // set to global val
1791 { 1788 {
1792 newval = vim_strsave(*(char_u **)get_varp_scope( 1789 newval = vim_strsave(*(char_u **)get_varp_scope(
1793 &(options[opt_idx]), OPT_GLOBAL)); 1790 &(options[opt_idx]), OPT_GLOBAL));
1794 new_value_alloced = TRUE;
1795 } 1791 }
1796 else 1792 else
1797 { 1793 {
1798 ++arg; // jump to after the '=' or ':' 1794 ++arg; // jump to after the '=' or ':'
1799 1795
2058 } 2054 }
2059 } 2055 }
2060 2056
2061 if (save_arg != NULL) // number for 'whichwrap' 2057 if (save_arg != NULL) // number for 'whichwrap'
2062 arg = save_arg; 2058 arg = save_arg;
2063 new_value_alloced = TRUE;
2064 } 2059 }
2065 2060
2066 /* 2061 /*
2067 * Set the new value. 2062 * Set the new value.
2068 */ 2063 */
2107 // Handle side effects, and set the global value 2102 // Handle side effects, and set the global value
2108 // for ":set" on local options. Note: when setting 2103 // for ":set" on local options. Note: when setting
2109 // 'syntax' or 'filetype' autocommands may be 2104 // 'syntax' or 'filetype' autocommands may be
2110 // triggered that can cause havoc. 2105 // triggered that can cause havoc.
2111 errmsg = did_set_string_option( 2106 errmsg = did_set_string_option(
2112 opt_idx, (char_u **)varp, 2107 opt_idx, (char_u **)varp, oldval, errbuf,
2113 new_value_alloced, oldval, errbuf,
2114 opt_flags, &value_checked); 2108 opt_flags, &value_checked);
2115 2109
2116 secure = secure_saved; 2110 secure = secure_saved;
2117 } 2111 }
2118 2112