fix gcc build, ebable new test.

This commit is contained in:
Enno Rehling 2014-10-31 16:51:57 +01:00
parent 9848ba08d0
commit 6e24fe9be2
2 changed files with 5 additions and 6 deletions

View file

@ -12,13 +12,11 @@ ally * ally_find(ally *al, const struct faction *f) {
ally * ally_add(ally **al_p, struct faction *f) { ally * ally_add(ally **al_p, struct faction *f) {
ally * al; ally * al;
if (f) {
while (*al_p) { while (*al_p) {
al = *al_p; al = *al_p;
if (al->faction == f) return al; if (f && al->faction == f) return al;
al_p = &al->next; al_p = &al->next;
} }
}
al = (ally *)malloc(sizeof(ally)); al = (ally *)malloc(sizeof(ally));
al->faction = f; al->faction = f;
al->status = 0; al->status = 0;

View file

@ -37,6 +37,7 @@ CuSuite *get_ally_suite(void)
{ {
CuSuite *suite = CuSuiteNew(); CuSuite *suite = CuSuiteNew();
SUITE_ADD_TEST(suite, test_ally); SUITE_ADD_TEST(suite, test_ally);
SUITE_ADD_TEST(suite, test_ally_null);
return suite; return suite;
} }