Minor fix to /STACK to make it match /SET behaviour

Previously /STACK would not accept just the initial part of a /SET name
even if it wasn't ambiguous.  Now it uses the same matching behaviour
as /SET.

This also removes an unused variable in do_stack_set().
This commit is contained in:
Kevin Easton
2015-06-12 16:57:19 +10:00
parent 6ba8dc7426
commit 1883e2c0c3

View File

@@ -1006,7 +1006,7 @@ void do_stack_set(int type, char *args)
/* Dont need to unstub it, we're not actually using it. */ /* Dont need to unstub it, we're not actually using it. */
upper(copy); upper(copy);
find_fixed_array_item(irc_variable, sizeof(IrcVariable), NUMBER_OF_VARIABLES, copy, &cnt, (int *)&var_index); find_fixed_array_item(irc_variable, sizeof(IrcVariable), NUMBER_OF_VARIABLES, copy, &cnt, (int *)&var_index);
if (cnt < 0) if (cnt < 0 || cnt == 1)
{ {
aptr = (AliasStack1 *)new_malloc(sizeof(AliasStack1)); aptr = (AliasStack1 *)new_malloc(sizeof(AliasStack1));
aptr->next = aptrptr ? *aptrptr : NULL; aptr->next = aptrptr ? *aptrptr : NULL;
@@ -1053,8 +1053,7 @@ void do_stack_set(int type, char *args)
} }
if (STACK_LIST == type) if (STACK_LIST == type)
{ {
AliasStack1 *prev = NULL; for (aptr = *aptrptr; aptr; aptr = aptr->next)
for (aptr = *aptrptr; aptr; prev = aptr, aptr = aptr->next)
{ {
switch(aptr->set->type) switch(aptr->set->type)
{ {