patch 9.0.1330: handling new value of an option has a long "else if" chain
Problem: Handling new value of an option has a long "else if" chain.
Solution: Use a function pointer. (Yegappan Lakshmanan, closes #12015)
diff --git a/src/spell.c b/src/spell.c
index 072740c..071ac9c 100644
--- a/src/spell.c
+++ b/src/spell.c
@@ -1987,7 +1987,7 @@
* Returns NULL if it's OK, an untranslated error message otherwise.
*/
char *
-did_set_spelllang(win_T *wp)
+parse_spelllang(win_T *wp)
{
garray_T ga;
char_u *splp;
@@ -2503,7 +2503,7 @@
{
if (wp->w_p_spell)
{
- (void)did_set_spelllang(wp);
+ (void)parse_spelllang(wp);
break;
}
}
@@ -4410,7 +4410,7 @@
FOR_ALL_WINDOWS(wp)
if (wp->w_buffer == curbuf && wp->w_p_spell)
{
- errmsg = did_set_spelllang(wp);
+ errmsg = parse_spelllang(wp);
break;
}
return errmsg;