From 6893248473d740557197b2f4d5405c5197f84c6f Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 12 Feb 2017 06:06:33 +0100 Subject: [PATCH] jsonconf should not need to create locales --- src/kernel/jsonconf.c | 8 ++++---- src/kernel/jsonconf.test.c | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/kernel/jsonconf.c b/src/kernel/jsonconf.c index 7a074a410..89219665e 100644 --- a/src/kernel/jsonconf.c +++ b/src/kernel/jsonconf.c @@ -654,7 +654,7 @@ static void json_strings(cJSON *json) { } for (child = json->child; child; child = child->next) { if (child->type == cJSON_Object) { - struct locale *lang = get_or_create_locale(child->string); + struct locale *lang = get_locale(child->string); json_locale(child, lang); } else { @@ -695,7 +695,7 @@ static void json_directions(cJSON *json) { return; } for (child = json->child; child; child = child->next) { - struct locale * lang = get_or_create_locale(child->string); + struct locale * lang = get_locale(child->string); json_direction(child, lang); } } @@ -771,7 +771,7 @@ static void json_skills(cJSON *json) { return; } for (child = json->child; child; child = child->next) { - struct locale * lang = get_or_create_locale(child->string); + struct locale * lang = get_locale(child->string); json_skill(child, lang); } } @@ -783,7 +783,7 @@ static void json_keywords(cJSON *json) { return; } for (child = json->child; child; child = child->next) { - struct locale * lang = get_or_create_locale(child->string); + struct locale * lang = get_locale(child->string); json_keyword(child, lang); } } diff --git a/src/kernel/jsonconf.test.c b/src/kernel/jsonconf.test.c index 7c591f075..abf64e7d5 100644 --- a/src/kernel/jsonconf.test.c +++ b/src/kernel/jsonconf.test.c @@ -600,9 +600,10 @@ static void test_infinitive_from_config(CuTest *tc) { cJSON *json = cJSON_Parse(data); CuAssertPtrNotNull(tc, json); + test_setup(); + lang = get_or_create_locale("de"); json_config(json); - lang = get_or_create_locale("de"); CuAssertIntEquals(tc, K_STUDY, get_keyword("LERN", lang)); CuAssertIntEquals(tc, K_STUDY, get_keyword("LERNE", lang)); CuAssertIntEquals(tc, K_STUDY, get_keyword("LERNEN", lang));