forked from github/server
fix cb_insert comparison (new return value for success)
This commit is contained in:
parent
dcc819491f
commit
797eee025d
2 changed files with 2 additions and 1 deletions
|
@ -38,6 +38,7 @@ static void test_readwrite_unit(CuTest * tc)
|
||||||
f = test_create_faction(0);
|
f = test_create_faction(0);
|
||||||
fno = f->no;
|
fno = f->no;
|
||||||
u = test_create_unit(f, r);
|
u = test_create_unit(f, r);
|
||||||
|
_mkdir(datapath());
|
||||||
sprintf(path, "%s/%s", datapath(), filename);
|
sprintf(path, "%s/%s", datapath(), filename);
|
||||||
|
|
||||||
data = gamedata_open(path, "wb");
|
data = gamedata_open(path, "wb");
|
||||||
|
|
|
@ -73,7 +73,7 @@ spell * create_spell(const char * name, unsigned int id)
|
||||||
}
|
}
|
||||||
sp = (spell *)calloc(1, sizeof(spell));
|
sp = (spell *)calloc(1, sizeof(spell));
|
||||||
len = cb_new_kv(name, len, &sp, sizeof(sp), buffer);
|
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->id = id ? id : hashstring(name);
|
||||||
sp->sname = _strdup(name);
|
sp->sname = _strdup(name);
|
||||||
add_spell(&spells, sp);
|
add_spell(&spells, sp);
|
||||||
|
|
Loading…
Reference in a new issue