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/map.c b/src/map.c
index 9a6cdb1..92f7651 100644
--- a/src/map.c
+++ b/src/map.c
@@ -3034,8 +3034,8 @@
* Called when langmap option is set; the language map can be
* changed at any time!
*/
- void
-langmap_set(void)
+ char *
+did_set_langmap(optset_T *args UNUSED)
{
char_u *p;
char_u *p2;
@@ -3088,9 +3088,11 @@
}
if (to == NUL)
{
+ // TODO: Need to use errbuf argument for this error message
+ // and return it.
semsg(_(e_langmap_matching_character_missing_for_str),
transchar(from));
- return;
+ return NULL;
}
if (from >= 256)
@@ -3110,8 +3112,10 @@
{
if (p[0] != ',')
{
+ // TODO: Need to use errbuf argument for this error
+ // message and return it.
semsg(_(e_langmap_extra_characters_after_semicolon_str), p);
- return;
+ return NULL;
}
++p;
}
@@ -3120,6 +3124,8 @@
}
}
}
+
+ return NULL;
}
#endif