diff --git a/src/list/extra.c b/src/list/extra.c index a9941ac..6429bcd 100644 --- a/src/list/extra.c +++ b/src/list/extra.c @@ -39,7 +39,7 @@ ssize_t libcdsb_list_get(val_t* x, list_t* s, ssize_t i, _Bool cut) { c = ldir_dir((lnode_t*)s, dir); - memset(x, 0, sizeof(*x)); + if (!is_null(x)) memset(x, 0, sizeof(*x)); while (n && !is_null(c)) { c = ldir_dir(c, dir); @@ -68,10 +68,10 @@ ssize_t libcdsb_list_find(val_t* x, list_t* s, const void* v, vtype t, _Bool r, c = ldir_dir((lnode_t*)s, dir); i = 0; - memset(x, 0, sizeof(*x)); + if (!is_null(x)) memset(x, 0, sizeof(*x)); while (!is_null(c)) { - cmp = vtype_compare(vnode_peek(c->node, c->type), c->type, v, t); + cmp = vtype_compare(vnode_peek(&c->node, c->type), c->type, v, t); if (cmp == 0) { if (!cut && !is_null(x)) { @@ -99,7 +99,7 @@ size_t libcdsb_list_count(const list_t* s, const void* v, vtype t) { n = 0; while (!is_null(c)) { - cmp = vtype_compare(vnode_peek(c->node, c->type), c->type, v, t); + cmp = vtype_compare(vnode_peek(&c->node, c->type), c->type, v, t); if (cmp == 0) ++n;