29 #include "cx/map.h" |
29 #include "cx/map.h" |
30 #include <string.h> |
30 #include <string.h> |
31 |
31 |
32 // <editor-fold desc="empty map implementation"> |
32 // <editor-fold desc="empty map implementation"> |
33 |
33 |
34 static void cx_empty_map_noop(__attribute__((__unused__)) CxMap *map) { |
34 static void cx_empty_map_noop(cx_attr_unused CxMap *map) { |
35 // this is a noop, but MUST be implemented |
35 // this is a noop, but MUST be implemented |
36 } |
36 } |
37 |
37 |
38 static void *cx_empty_map_get( |
38 static void *cx_empty_map_get( |
39 __attribute__((__unused__)) CxMap const *map, |
39 cx_attr_unused const CxMap *map, |
40 __attribute__((__unused__)) CxHashKey key |
40 cx_attr_unused CxHashKey key |
41 ) { |
41 ) { |
42 return NULL; |
42 return NULL; |
43 } |
43 } |
44 |
44 |
45 static bool cx_empty_map_iter_valid(__attribute__((__unused__)) void const *iter) { |
45 static bool cx_empty_map_iter_valid(cx_attr_unused const void *iter) { |
46 return false; |
46 return false; |
47 } |
47 } |
48 |
48 |
49 static CxIterator cx_empty_map_iterator( |
49 static CxIterator cx_empty_map_iterator( |
50 struct cx_map_s const *map, |
50 const struct cx_map_s *map, |
51 __attribute__((__unused__)) enum cx_map_iterator_type type |
51 cx_attr_unused enum cx_map_iterator_type type |
52 ) { |
52 ) { |
53 CxIterator iter = {0}; |
53 CxIterator iter = {0}; |
54 iter.src_handle.c = map; |
54 iter.src_handle.c = map; |
55 iter.base.valid = cx_empty_map_iter_valid; |
55 iter.base.valid = cx_empty_map_iter_valid; |
56 return iter; |
56 return iter; |
98 CxIterator cxMapMutIterator(CxMap *map) { |
98 CxIterator cxMapMutIterator(CxMap *map) { |
99 CxIterator it = map->cl->iterator(map, CX_MAP_ITERATOR_PAIRS); |
99 CxIterator it = map->cl->iterator(map, CX_MAP_ITERATOR_PAIRS); |
100 it.base.mutating = true; |
100 it.base.mutating = true; |
101 return it; |
101 return it; |
102 } |
102 } |
|
103 |
|
104 void cxMapFree(CxMap *map) { |
|
105 if (map == NULL) return; |
|
106 map->cl->deallocate(map); |
|
107 } |