forked from github/server
fix compilation.
eliminate the last order-related memory leak.
This commit is contained in:
parent
270c12b6d8
commit
133bef1041
|
@ -288,7 +288,7 @@ static void perform_join(void)
|
|||
static syntaxtree * build_syntax(void) {
|
||||
syntaxtree *slang, *stree = stree_create();
|
||||
for (slang = stree; slang; slang = slang->next) {
|
||||
void *leaf = 0;
|
||||
struct tnode *leaf = 0;
|
||||
add_command(&leaf, NULL, LOC(slang->lang, alliance_kwd[ALLIANCE_KICK]), &cmd_kick);
|
||||
add_command(&leaf, NULL, LOC(slang->lang, alliance_kwd[ALLIANCE_LEAVE]), &cmd_leave);
|
||||
add_command(&leaf, NULL, LOC(slang->lang, alliance_kwd[ALLIANCE_TRANSFER]), &cmd_transfer);
|
||||
|
|
|
@ -68,7 +68,7 @@ syntaxtree *stree_create(void)
|
|||
}
|
||||
|
||||
void
|
||||
add_command(void **keys, void *tnext,
|
||||
add_command(struct tnode **keys, void *tnext,
|
||||
const char *str, parser fun)
|
||||
{
|
||||
command *cmd = (command *)malloc(sizeof(command));
|
||||
|
@ -78,10 +78,10 @@ const char *str, parser fun)
|
|||
cmd->fun = fun;
|
||||
cmd->nodes = tnext;
|
||||
var.v = cmd;
|
||||
addtoken((struct tnode **)keys, str, var);
|
||||
addtoken(keys, str, var);
|
||||
}
|
||||
|
||||
static int do_command_i(const void *keys, struct unit *u, struct order *ord)
|
||||
static int do_command_i(const struct tnode *keys, struct unit *u, struct order *ord)
|
||||
{
|
||||
char token[128];
|
||||
const char *c;
|
||||
|
@ -102,7 +102,7 @@ static int do_command_i(const void *keys, struct unit *u, struct order *ord)
|
|||
return E_TOK_NOMATCH;
|
||||
}
|
||||
|
||||
void do_command(const void *keys, struct unit *u, struct order *ord)
|
||||
void do_command(const struct tnode *keys, struct unit *u, struct order *ord)
|
||||
{
|
||||
init_order(ord);
|
||||
if (do_command_i(keys, u, ord) != E_TOK_SUCCESS) {
|
||||
|
|
|
@ -28,9 +28,9 @@ extern "C" {
|
|||
} syntaxtree;
|
||||
|
||||
typedef void(*parser) (const void *nodes, struct unit * u, struct order *);
|
||||
void add_command(void **troot, void *tnext,
|
||||
void add_command(struct tnode **troot, void *tnext,
|
||||
const char *str, parser fun);
|
||||
void do_command(const void *troot, struct unit *u, struct order *);
|
||||
void do_command(const struct tnode *troot, struct unit *u, struct order *);
|
||||
|
||||
struct syntaxtree *stree_create(void);
|
||||
void stree_free(struct syntaxtree *);
|
||||
|
|
|
@ -186,7 +186,6 @@ static void test_default_order(CuTest *tc) {
|
|||
ord = default_order(loc);
|
||||
CuAssertPtrNotNull(tc, ord);
|
||||
CuAssertIntEquals(tc, K_WORK, getkeyword(ord));
|
||||
CuAssertPtrEquals(tc, ord->data, default_order(loc)->data);
|
||||
free_order(ord);
|
||||
test_cleanup();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue