Minor fixes

This commit is contained in:
Gregory Lirent 2022-08-16 21:10:54 +03:00
parent cdbe0fe4a6
commit 125153076d
3 changed files with 8 additions and 7 deletions

View File

@ -8,8 +8,8 @@
#define vset_foreach(x, data, callback) libcdsb_vset_foreach(x, data, callback, 0)
extern bool libcdsb_vset_insert(vtype_set* x, const void* value, vtype type) Nonnull__(1);
extern int libcdsb_vset_find (vtype_set* x, const void* value, vtype type, void* data, vset_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_vset_foreach(vtype_set* x, void* data, vset_access_callback, bool flush) Nonnull__(1,3);
extern bool libcdsb_vset_insert (vtype_set* x, const void* value, vtype type) Nonnull__(1);
extern int libcdsb_vset_find (vtype_set* x, const void* value, vtype type, void* data, vset_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_vset_foreach(vtype_set* x, void* data, vset_access_callback, bool flush) Nonnull__(1,3);
#endif /* LIBCDSB_EXTRA_SET_H */

View File

@ -11,10 +11,11 @@ typedef int (*vset_access_callback)(const void* value, vtype type, void* data);
extern void vset_init(vtype_set* x, vtype type) Nonnull__(1);
#define vset_remove(x, value) _LIBCDSB_Generic (libcdsb_vset, touch, value)(x, value, 1)
#define vset_push(x, value) _LIBCDSB_Generic (libcdsb_vset, push, value)(x, value)
#define vset_pop(x, value, data, callback) _LIBCDSB_Generic (libcdsb_vset, find, value)(x, value, data, callback, 1)
#define vset_get(x, value, data, callback) _LIBCDSB_Generic (libcdsb_vset, find, value)(x, value, data, callback, 0)
#define vset_push(x, value) _LIBCDSB_Generic (libcdsb_vset, push, value)(x, value)
#define in_vset(x, value) _LIBCDSB_Generic (libcdsb_vset, touch, value)(x, value, 0)
#define in_vset(x, value) (vset_get(&x, value, 0, 0, 0) == 0)
extern bool libcdsb_vset_push_pointer(vtype_set* x, const void* value) Nonnull__(1);
extern bool libcdsb_vset_push_cstring(vtype_set* x, const char* value) Nonnull__(1,2);

View File

@ -165,7 +165,7 @@ int libcdsb_dict_get(dict_t* x, const void* k, vtype t, void* _, dict_access_cal
cmp = vtype_compare(k, t, key, c->key_type);
if (cmp == 0) {
cmp = (callback) ? callback(key, t, vnode_peek(&c->value, c->val_type), c->val_type, _) : 0;
cmp = (callback) ? callback(key, c->key_type, vnode_peek(&c->value, c->val_type), c->val_type, _) : 0;
if (cut) {
c = dnode_delete(x->nodes + index, c);