diff --git a/src/kernel/types.h b/src/kernel/types.h index e0521635e..e2a3923b5 100644 --- a/src/kernel/types.h +++ b/src/kernel/types.h @@ -144,7 +144,7 @@ typedef enum { P_TREES, P_ALLIANCE, MAXPARAMS, - NOPARAM = -1 + NOPARAM } param_t; typedef enum { /* Fehler und Meldungen im Report */ diff --git a/src/keyword.c b/src/keyword.c index 0bd699836..199811669 100644 --- a/src/keyword.c +++ b/src/keyword.c @@ -14,6 +14,9 @@ const char * keyword(keyword_t kwd) { static char result[32]; // FIXME: static return value + if (kwd==NOKEYWORD) { + return NULL; + } if (!result[0]) { strcpy(result, "keyword::"); } diff --git a/src/keyword.h b/src/keyword.h index 9d5e20f64..e60d0731f 100644 --- a/src/keyword.h +++ b/src/keyword.h @@ -70,7 +70,7 @@ extern "C" K_PAY, K_LOOT, MAXKEYWORDS, - NOKEYWORD = -1 + NOKEYWORD } keyword_t; extern const char *keywords[MAXKEYWORDS]; diff --git a/src/keyword.test.c b/src/keyword.test.c index 903eb0c13..75c31904a 100644 --- a/src/keyword.test.c +++ b/src/keyword.test.c @@ -11,11 +11,13 @@ static void test_init_keywords(CuTest *tc) { struct locale *lang; - test_cleanup(); + test_setup(); lang = get_or_create_locale("en"); locale_setstring(lang, "keyword::move", "MOVE"); init_keywords(lang); CuAssertIntEquals(tc, K_MOVE, get_keyword("move", lang)); + CuAssertStrEquals(tc, "keyword::move", keyword(K_MOVE)); + CuAssertPtrEquals(tc, NULL, (void *)keyword(NOKEYWORD)); test_cleanup(); }