Changes in uspace/lib/c/include/adt/generic_char_map.h [5fe7692:61bfc370] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/adt/generic_char_map.h
r5fe7692 r61bfc370 47 47 #define GENERIC_CHAR_MAP_MAGIC_VALUE 0x12345622 48 48 49 /** Generic destructor function pointer. */50 #define DTOR_T(identifier) \51 void (*identifier)(const void *)52 53 49 /** Character string to generic type map declaration. 54 50 * @param[in] name Name of the map. … … 68 64 int name##_add(name##_t *, const uint8_t *, const size_t, type *); \ 69 65 int name##_count(name##_t *); \ 70 void name##_destroy(name##_t * , DTOR_T()); \71 void name##_exclude(name##_t *, const uint8_t *, const size_t , DTOR_T()); \66 void name##_destroy(name##_t *); \ 67 void name##_exclude(name##_t *, const uint8_t *, const size_t); \ 72 68 type *name##_find(name##_t *, const uint8_t *, const size_t); \ 73 69 int name##_initialize(name##_t *); \ … … 88 84 type *value) \ 89 85 { \ 86 int rc; \ 90 87 int index; \ 91 88 if (!name##_is_valid(map)) \ … … 94 91 if (index < 0) \ 95 92 return index; \ 96 return char_map_add(&map->names, name, length, index); \ 93 rc = char_map_add(&map->names, name, length, index); \ 94 if (rc != EOK) { \ 95 name##_items_exclude_index(&map->values, index); \ 96 return rc; \ 97 } \ 98 return EOK; \ 97 99 } \ 98 100 \ … … 103 105 } \ 104 106 \ 105 void name##_destroy(name##_t *map , DTOR_T(dtor)) \107 void name##_destroy(name##_t *map) \ 106 108 { \ 107 109 if (name##_is_valid(map)) { \ 108 110 char_map_destroy(&map->names); \ 109 name##_items_destroy(&map->values , dtor); \111 name##_items_destroy(&map->values); \ 110 112 } \ 111 113 } \ 112 114 \ 113 115 void name##_exclude(name##_t *map, const uint8_t *name, \ 114 const size_t length , DTOR_T(dtor)) \116 const size_t length) \ 115 117 { \ 116 118 if (name##_is_valid(map)) { \ … … 119 121 if (index != CHAR_MAP_NULL) \ 120 122 name##_items_exclude_index(&map->values, \ 121 index , dtor); \123 index); \ 122 124 } \ 123 125 } \
Note:
See TracChangeset
for help on using the changeset viewer.