forked from github/server
add_command has an unused argument
This commit is contained in:
parent
d962dd110a
commit
eed6e1d88d
1 changed files with 3 additions and 9 deletions
|
@ -30,7 +30,6 @@
|
||||||
|
|
||||||
typedef struct command {
|
typedef struct command {
|
||||||
parser fun;
|
parser fun;
|
||||||
struct tnode *nodes;
|
|
||||||
} command;
|
} command;
|
||||||
|
|
||||||
void *stree_find(const syntaxtree * stree, const struct locale *lang)
|
void *stree_find(const syntaxtree * stree, const struct locale *lang)
|
||||||
|
@ -69,14 +68,13 @@ syntaxtree *stree_create(void)
|
||||||
|
|
||||||
void
|
void
|
||||||
add_command(struct tnode **keys, void *tnext,
|
add_command(struct tnode **keys, void *tnext,
|
||||||
const char *str, parser fun)
|
const char *str, parser fun)
|
||||||
{
|
{
|
||||||
command *cmd = (command *)malloc(sizeof(command));
|
command *cmd = (command *)malloc(sizeof(command));
|
||||||
variant var;
|
variant var;
|
||||||
|
|
||||||
assert(str);
|
assert(str);
|
||||||
cmd->fun = fun;
|
cmd->fun = fun;
|
||||||
cmd->nodes = tnext;
|
|
||||||
var.v = cmd;
|
var.v = cmd;
|
||||||
addtoken(keys, str, var);
|
addtoken(keys, str, var);
|
||||||
}
|
}
|
||||||
|
@ -90,12 +88,8 @@ static int do_command_i(const struct tnode *keys, struct unit *u, struct order *
|
||||||
c = gettoken(token, sizeof(token));
|
c = gettoken(token, sizeof(token));
|
||||||
if (findtoken(keys, c, &var) == E_TOK_SUCCESS) {
|
if (findtoken(keys, c, &var) == E_TOK_SUCCESS) {
|
||||||
command *cmd = (command *)var.v;
|
command *cmd = (command *)var.v;
|
||||||
if (cmd->nodes && *c) {
|
if (cmd->fun) {
|
||||||
assert(!cmd->fun);
|
cmd->fun(0, u, ord);
|
||||||
return do_command_i(cmd->nodes, u, ord);
|
|
||||||
}
|
|
||||||
else if (cmd->fun) {
|
|
||||||
cmd->fun(cmd->nodes, u, ord);
|
|
||||||
return E_TOK_SUCCESS;
|
return E_TOK_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue