ucx/map.h

changeset 67
27e67e725d35
parent 53
e533c170bfb8
child 69
fb59270b1de3
equal deleted inserted replaced
66:fcfe8c5e9fe1 67:27e67e725d35
56 56
57 57
58 UcxMap *ucx_map_new(size_t size); 58 UcxMap *ucx_map_new(size_t size);
59 void ucx_map_free(UcxMap *map); 59 void ucx_map_free(UcxMap *map);
60 /* you cannot clone maps with more than 390 mio entries */ 60 /* you cannot clone maps with more than 390 mio entries */
61 int ucx_map_copy(UcxMap *from, UcxMap *to, copy_func fnc, void *data); 61 int ucx_map_copy(UcxMap *restrict from, UcxMap *restrict to,
62 copy_func fnc, void *data);
62 UcxMap *ucx_map_clone(UcxMap *map, copy_func fnc, void *data); 63 UcxMap *ucx_map_clone(UcxMap *map, copy_func fnc, void *data);
63 int ucx_map_rehash(UcxMap *map); 64 int ucx_map_rehash(UcxMap *map);
64 65
65 int ucx_map_put(UcxMap *map, UcxKey key, void *data); 66 int ucx_map_put(UcxMap *map, UcxKey key, void *data);
66 void* ucx_map_get(UcxMap *map, UcxKey key); 67 void* ucx_map_get(UcxMap *map, UcxKey key);
73 #define ucx_map_sstr_remove(m, s) ucx_map_remove(m, ucx_key(s.ptr, s.length)) 74 #define ucx_map_sstr_remove(m, s) ucx_map_remove(m, ucx_key(s.ptr, s.length))
74 #define ucx_map_cstr_remove(m, s) ucx_map_remove(m, ucx_key(s, 1+strlen(s))) 75 #define ucx_map_cstr_remove(m, s) ucx_map_remove(m, ucx_key(s, 1+strlen(s)))
75 76
76 UcxKey ucx_key(void *data, size_t len); 77 UcxKey ucx_key(void *data, size_t len);
77 78
78 int ucx_hash(char *data, size_t len); 79 int ucx_hash(const char *data, size_t len);
79 80
80 UcxMapIterator ucx_map_iterator(UcxMap *map); 81 UcxMapIterator ucx_map_iterator(UcxMap *map);
81 82
82 int ucx_map_iter_next(UcxMapIterator *i, void **elm); 83 int ucx_map_iter_next(UcxMapIterator *i, void **elm);
83 84

mercurial