36 |
36 |
37 #ifdef __cplusplus |
37 #ifdef __cplusplus |
38 extern "C" { |
38 extern "C" { |
39 #endif |
39 #endif |
40 |
40 |
41 #define UCX_MAP_FOREACH(elm,iter) \ |
41 #define UCX_MAP_FOREACH(key,elm,iter) \ |
42 for(;ucx_map_iter_next(&iter,(void**)&elm)==0;) |
42 for(UcxKey key;ucx_map_iter_next(&iter,&key, (void**)&elm)==0;) |
43 |
43 |
44 typedef struct UcxMap UcxMap; |
44 typedef struct UcxMap UcxMap; |
45 typedef struct UcxKey UcxKey; |
45 typedef struct UcxKey UcxKey; |
46 typedef struct UcxMapElement UcxMapElement; |
46 typedef struct UcxMapElement UcxMapElement; |
47 typedef struct UcxMapIterator UcxMapIterator; |
47 typedef struct UcxMapIterator UcxMapIterator; |
118 |
118 |
119 int ucx_hash(const char *data, size_t len); |
119 int ucx_hash(const char *data, size_t len); |
120 |
120 |
121 UcxMapIterator ucx_map_iterator(UcxMap *map); |
121 UcxMapIterator ucx_map_iterator(UcxMap *map); |
122 |
122 |
123 int ucx_map_iter_next(UcxMapIterator *i, void **elm); |
123 int ucx_map_iter_next(UcxMapIterator *i, UcxKey *key, void **elm); |
124 |
124 |
125 /* use macros for string maps only, values are not encoded */ |
125 /* use macros for string maps only, values are not encoded */ |
126 #define ucx_map_load(map, f, alloc) ucx_map_load_enc(map, f, alloc, NULL, NULL) |
126 #define ucx_map_load(map, f, alloc) ucx_map_load_enc(map, f, alloc, NULL, NULL) |
127 #define ucx_map_store(map, f) ucx_map_store_enc(map, f, NULL, NULL) |
127 #define ucx_map_store(map, f) ucx_map_store_enc(map, f, NULL, NULL) |
128 |
128 |