From b71cf98ec784fc5658f124724a1b40ce1794e260 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sat, 28 Jun 2014 15:22:41 +0000 Subject: [PATCH] Using a single assignment of do_toggle_void. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5031 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 1 + src/global.c | 96 +++++++++++++++++++++++----------------------------- 2 files changed, 43 insertions(+), 54 deletions(-) diff --git a/ChangeLog b/ChangeLog index 52439549..8d952068 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,7 @@ 'do_gotolinecolumn_void'. The first is handled specially, so do that too for the second and then get to drop 140 parameters. * src/global.c (strtosc): Move recognition of the toggles to the end. + * src/global.c (strtosc): Use a single assignment of do_toggle_void. 2014-06-27 Benno Schulenberg * src/global.c (shortcut_init): Add default keybindings for Cut, diff --git a/src/global.c b/src/global.c index e025907f..dd286d31 100644 --- a/src/global.c +++ b/src/global.c @@ -1422,70 +1422,58 @@ sc *strtosc(char *input) s->scfunc = do_last_file; #endif #ifndef NANO_TINY - } else if (!strcasecmp(input, "nohelp")) { - s->scfunc = do_toggle_void; - s->toggle = NO_HELP; - } else if (!strcasecmp(input, "constupdate")) { - s->scfunc = do_toggle_void; - s->toggle = CONST_UPDATE; - } else if (!strcasecmp(input, "morespace")) { - s->scfunc = do_toggle_void; - s->toggle = MORE_SPACE; - } else if (!strcasecmp(input, "smoothscroll")) { - s->scfunc = do_toggle_void; - s->toggle = SMOOTH_SCROLL; - } else if (!strcasecmp(input, "softwrap")) { - s->scfunc = do_toggle_void; - s->toggle = SOFTWRAP; - } else if (!strcasecmp(input, "whitespacedisplay")) { + } else { s->scfunc = do_toggle_void; - s->toggle = WHITESPACE_DISPLAY; + if (!strcasecmp(input, "nohelp")) { + s->toggle = NO_HELP; + } else if (!strcasecmp(input, "constupdate")) { + s->toggle = CONST_UPDATE; + } else if (!strcasecmp(input, "morespace")) { + s->toggle = MORE_SPACE; + } else if (!strcasecmp(input, "smoothscroll")) { + s->toggle = SMOOTH_SCROLL; + } else if (!strcasecmp(input, "softwrap")) { + s->toggle = SOFTWRAP; + } else if (!strcasecmp(input, "whitespacedisplay")) { + s->toggle = WHITESPACE_DISPLAY; #ifndef DISABLE_COLOR - } else if (!strcasecmp(input, "nosyntax")) { - s->scfunc = do_toggle_void; - s->toggle = NO_COLOR_SYNTAX; -#endif - } else if (!strcasecmp(input, "smarthome")) { - s->scfunc = do_toggle_void; - s->toggle = SMART_HOME; - } else if (!strcasecmp(input, "autoindent")) { - s->scfunc = do_toggle_void; - s->toggle = AUTOINDENT; - } else if (!strcasecmp(input, "cuttoend")) { - s->scfunc = do_toggle_void; - s->toggle = CUT_TO_END; + } else if (!strcasecmp(input, "nosyntax")) { + s->toggle = NO_COLOR_SYNTAX; +#endif + } else if (!strcasecmp(input, "smarthome")) { + s->toggle = SMART_HOME; + } else if (!strcasecmp(input, "autoindent")) { + s->toggle = AUTOINDENT; + } else if (!strcasecmp(input, "cuttoend")) { + s->toggle = CUT_TO_END; #ifndef DISABLE_WRAPPING - } else if (!strcasecmp(input, "nowrap")) { - s->scfunc = do_toggle_void; - s->toggle = NO_WRAP; + } else if (!strcasecmp(input, "nowrap")) { + s->toggle = NO_WRAP; #endif - } else if (!strcasecmp(input, "tabstospaces")) { - s->scfunc = do_toggle_void; - s->toggle = TABS_TO_SPACES; - } else if (!strcasecmp(input, "backupfile")) { - s->scfunc = do_toggle_void; - s->toggle = BACKUP_FILE; + } else if (!strcasecmp(input, "tabstospaces")) { + s->toggle = TABS_TO_SPACES; + } else if (!strcasecmp(input, "backupfile")) { + s->toggle = BACKUP_FILE; #ifndef DISABLE_MULTIBUFFER - } else if (!strcasecmp(input, "multibuffer")) { - s->scfunc = do_toggle_void; - s->toggle = MULTIBUFFER; + } else if (!strcasecmp(input, "multibuffer")) { + s->toggle = MULTIBUFFER; #endif #ifndef DISABLE_MOUSE - } else if (!strcasecmp(input, "mouse")) { - s->scfunc = do_toggle_void; - s->toggle = USE_MOUSE; + } else if (!strcasecmp(input, "mouse")) { + s->toggle = USE_MOUSE; #endif - } else if (!strcasecmp(input, "noconvert")) { - s->scfunc = do_toggle_void; - s->toggle = NO_CONVERT; - } else if (!strcasecmp(input, "suspendenable")) { - s->scfunc = do_toggle_void; - s->toggle = SUSPEND; + } else if (!strcasecmp(input, "noconvert")) { + s->toggle = NO_CONVERT; + } else if (!strcasecmp(input, "suspendenable")) { + s->toggle = SUSPEND; #endif /* !NANO_TINY */ - } else { - free(s); - return NULL; + } else { + free(s); + return NULL; + } +#ifndef NANO_TINY } +#endif return s; } -- 2.39.5