Changeset d011038 in mainline for uspace/lib/c/include/adt/generic_char_map.h
- Timestamp:
- 2011-03-29T20:12:44Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8f17503
- Parents:
- c4fb95d3 (diff), 93ebe4e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/adt/generic_char_map.h
rc4fb95d3 rd011038 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 49 53 /** Character string to generic type map declaration. 50 54 * @param[in] name Name of the map. … … 64 68 int name##_add(name##_t *, const uint8_t *, const size_t, type *); \ 65 69 int name##_count(name##_t *); \ 66 void name##_destroy(name##_t * ); \67 void name##_exclude(name##_t *, const uint8_t *, const size_t ); \70 void name##_destroy(name##_t *, DTOR_T()); \ 71 void name##_exclude(name##_t *, const uint8_t *, const size_t, DTOR_T()); \ 68 72 type *name##_find(name##_t *, const uint8_t *, const size_t); \ 69 73 int name##_initialize(name##_t *); \ … … 84 88 type *value) \ 85 89 { \ 86 int rc; \87 90 int index; \ 88 91 if (!name##_is_valid(map)) \ … … 91 94 if (index < 0) \ 92 95 return 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; \ 96 return char_map_add(&map->names, name, length, index); \ 99 97 } \ 100 98 \ … … 105 103 } \ 106 104 \ 107 void name##_destroy(name##_t *map ) \105 void name##_destroy(name##_t *map, DTOR_T(dtor)) \ 108 106 { \ 109 107 if (name##_is_valid(map)) { \ 110 108 char_map_destroy(&map->names); \ 111 name##_items_destroy(&map->values ); \109 name##_items_destroy(&map->values, dtor); \ 112 110 } \ 113 111 } \ 114 112 \ 115 113 void name##_exclude(name##_t *map, const uint8_t *name, \ 116 const size_t length ) \114 const size_t length, DTOR_T(dtor)) \ 117 115 { \ 118 116 if (name##_is_valid(map)) { \ … … 121 119 if (index != CHAR_MAP_NULL) \ 122 120 name##_items_exclude_index(&map->values, \ 123 index ); \121 index, dtor); \ 124 122 } \ 125 123 } \
Note:
See TracChangeset
for help on using the changeset viewer.