Unsetting CMDCHARS sets it back to the default

Previously you could unset CMDCHARS and the effect would be to treat it like it was set to DEFAULT_CMDCHARS,
except that some code was missing the fallback (eg. ignore_last_nick()) which would make it crash.

Instead of having the fallback everywhere, just make it so that you can't unset the variable - if you try, it
sets it to DEFAULT_CMDCHARS.  This reflects what the behaviour has always been, it just makes it explicit to
the user and the bonus is we don't have the test it for NULL everywhere.
This commit is contained in:
Kevin Easton
2017-02-16 23:42:52 +11:00
parent debfebf3a7
commit 686344314f
5 changed files with 44 additions and 54 deletions

View File

@@ -1183,12 +1183,9 @@ static char *alias_target (void)
static char *alias_cmdchar (void)
{
char *cmdchars, tmp[2];
const char *cmdchars = get_string_var(CMDCHARS_VAR);
char tmp[2] = { cmdchars[0], 0 };
if ((cmdchars = get_string_var(CMDCHARS_VAR)) == NULL)
cmdchars = DEFAULT_CMDCHARS;
tmp[0] = cmdchars[0];
tmp[1] = 0;
return m_strdup(tmp);
}