From 6e24fe9be29c213d816b87fc907fc1600f5af480 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 31 Oct 2014 16:51:57 +0100 Subject: [PATCH] fix gcc build, ebable new test. --- src/kernel/ally.c | 10 ++++------ src/kernel/ally.test.c | 1 + 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/kernel/ally.c b/src/kernel/ally.c index 3ebc7c1ce..ed53cbce4 100644 --- a/src/kernel/ally.c +++ b/src/kernel/ally.c @@ -12,12 +12,10 @@ ally * ally_find(ally *al, const struct faction *f) { ally * ally_add(ally **al_p, struct faction *f) { ally * al; - if (f) { - while (*al_p) { - al = *al_p; - if (al->faction == f) return al; - al_p = &al->next; - } + while (*al_p) { + al = *al_p; + if (f && al->faction == f) return al; + al_p = &al->next; } al = (ally *)malloc(sizeof(ally)); al->faction = f; diff --git a/src/kernel/ally.test.c b/src/kernel/ally.test.c index fb35d25f7..c5c47298f 100644 --- a/src/kernel/ally.test.c +++ b/src/kernel/ally.test.c @@ -37,6 +37,7 @@ CuSuite *get_ally_suite(void) { CuSuite *suite = CuSuiteNew(); SUITE_ADD_TEST(suite, test_ally); + SUITE_ADD_TEST(suite, test_ally_null); return suite; }