Merge branch 'develop' into #28-issue

This commit is contained in:
Gregory Lirent 2022-08-16 18:41:34 +03:00
commit cdbe0fe4a6
5 changed files with 10 additions and 8 deletions

View File

@ -21,7 +21,7 @@ extern void array_reverse(vtype_array* x) Nonnull__(1);
#define array_pop(x, value, data, callback) _LIBCDSB_Generic(libcdsb_array, find, value)(x, value, data, callback, 0, 1)
#define array_find(x, value, data, callback) _LIBCDSB_Generic(libcdsb_array, find, value)(x, value, data, callback, 0, 0)
#define array_rfind(x, value, data, callback) _LIBCDSB_Generic(libcdsb_array, find, value)(x, value, data, callback, 1, 0)
#define list_countof(x, value) _LIBCDSB_Generic(libcdsb_array, count, value)(x, value)
#define array_countof(x, value) _LIBCDSB_Generic(libcdsb_array, count, value)(x, value)
#define array_remove(x, value) array_pop(x, value, 0, 0)
#define in_array(x, value) (array_find(x, value, 0, 0) == 0)

View File

@ -8,9 +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) LIBCDSB_nn12__;
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) LIBCDSB_nn13__;
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

@ -32,9 +32,9 @@ extern rbnode_t* libcdsb_rbtree_node_delete(rbnode_t** root, rbnode_t* node)
extern void* libcdsb_rbtree_duplicate(const rbnode_t* s, void* (*node_duplicate)(void* src, void* parent, void* info), void* info) wur__ Nonnull__(1);
extern int libcdsb_rbtree_compare (const rbnode_t* s0, const rbnode_t* s1, int (*node_compare)(const rbnode_t* s0, const rbnode_t* s1, void* info), void* info) pure__ wur__ Nonnull__(1,2);
extern hash_t libcdsb_rbtree_hash(const void* s, hash_t (*node_hash)(const void* s, void* info), void* info) pure__ wur__ Nonnull__(1,2);
extern size_t libcdsb_rbtree_size(const void* s) pure__ wur__ Nonnull__(1);
extern void libcdsb_rbtree_free(void* x, void (*node_free)(void* x, void* info), void* info) Nonnull__(1);
extern hash_t libcdsb_rbtree_hash(const void* s, hash_t (*node_hash)(const void* s, void* info), void* info) pure__ wur__ Nonnull__(1);
extern size_t libcdsb_rbtree_size(const void* s) pure__ wur__ Nonnull__(1);
extern void libcdsb_rbtree_free(void* x, void (*node_free)(void* x, void* info), void* info) Nonnull__(1);
#define rbtree_duplicate libcdsb_rbtree_duplicate
#define rbtree_compare libcdsb_rbtree_compare

View File

@ -11,7 +11,7 @@
typedef union {
void* ptr; bool b;
str_t s; arr_t a; list_t l;
map_t m; set_t vs;
map_t m; set_t vs; dict_t vd;
u8_t u8; u16_t u16; u32_t u32; u64_t u64;
fl_t f; dbl_t d; ldbl_t ld;
} var_t;

View File

@ -55,6 +55,9 @@ char* libcdsb_strdup(const char* s) {
void* x;
size_t n;
if (is_null(s))
return nullptr;
if ((x = malloc(n = strlen(s) + 1)))
return memcpy(x, s, n);
abort();