vim-patch:9.0.1614: strlen() called too often for :spellrepall (#23940)

Problem:    strlen() called too often for :spellrepall.
Solution:   Store the result in a variable. (closes vim/vim#12497)

59f7038536
This commit is contained in:
zeertzjq
2023-06-06 23:31:29 +08:00
committed by GitHub
parent c48b1421af
commit 9d9af4fe27
2 changed files with 2 additions and 2 deletions

View File

@@ -2606,7 +2606,7 @@ void ex_spellrepall(exarg_T *eap)
}
const size_t repl_from_len = strlen(repl_from);
const size_t repl_to_len = strlen(repl_to);
int addlen = (int)(repl_to_len - repl_from_len);
const int addlen = (int)(repl_to_len - repl_from_len);
const size_t frompatlen = repl_from_len + 7;
char *frompat = xmalloc(frompatlen);

View File

@@ -281,7 +281,7 @@ func Test_compl_with_CTRL_X_CTRL_K_using_spell()
set spell& spelllang& dictionary& ignorecase&
endfunc
func Test_spellreall()
func Test_spellrepall()
new
set spell
call assert_fails('spellrepall', 'E752:')