From 797eee025d25b24a902d4edfe9cb1505fa681304 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Thu, 5 Nov 2015 13:01:48 +0100 Subject: [PATCH] fix cb_insert comparison (new return value for success) --- src/kernel/save.test.c | 1 + src/kernel/spell.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/kernel/save.test.c b/src/kernel/save.test.c index fd8ff48ea..403eaa059 100644 --- a/src/kernel/save.test.c +++ b/src/kernel/save.test.c @@ -38,6 +38,7 @@ static void test_readwrite_unit(CuTest * tc) f = test_create_faction(0); fno = f->no; u = test_create_unit(f, r); + _mkdir(datapath()); sprintf(path, "%s/%s", datapath(), filename); data = gamedata_open(path, "wb"); diff --git a/src/kernel/spell.c b/src/kernel/spell.c index 05e1ab8e8..ebd5d44ef 100644 --- a/src/kernel/spell.c +++ b/src/kernel/spell.c @@ -73,7 +73,7 @@ spell * create_spell(const char * name, unsigned int id) } sp = (spell *)calloc(1, sizeof(spell)); len = cb_new_kv(name, len, &sp, sizeof(sp), buffer); - if (cb_insert(&cb_spells, buffer, len)) { + if (cb_insert(&cb_spells, buffer, len) == CB_SUCCESS) { sp->id = id ? id : hashstring(name); sp->sname = _strdup(name); add_spell(&spells, sp);