/** * Inserts an unique element into a hashtable. */ _hashtable_iterator_t _hashtable_insert_unique(_hashtable_t* pt_hashtable, const void* cpv_value) { _hashtable_iterator_t it_iter; assert(pt_hashtable != NULL); assert(cpv_value != NULL); assert(_hashtable_is_inited(pt_hashtable)); if(_hashtable_empty(pt_hashtable)) { return _hashtable_insert_equal(pt_hashtable, cpv_value); } else { it_iter = _hashtable_find(pt_hashtable, cpv_value); if(!_hashtable_iterator_equal(it_iter, _hashtable_end(pt_hashtable))) { return _hashtable_end(pt_hashtable); } else { return _hashtable_insert_equal(pt_hashtable, cpv_value); } } }
/** * Find specific element. */ hash_multimap_iterator_t _hash_multimap_find_varg(const hash_multimap_t* cphmmap_map, va_list val_elemlist) { hash_multimap_iterator_t it_iter; assert(cphmmap_map != NULL); _type_get_varg_value(&((hash_multimap_t*)cphmmap_map)->_pair_temp._t_typeinfofirst, val_elemlist, cphmmap_map->_pair_temp._pv_first); it_iter = _hashtable_find(&cphmmap_map->_t_hashtable, &cphmmap_map->_pair_temp); _ITERATOR_CONTAINER(it_iter) = (hash_multimap_t*)cphmmap_map; _HASH_MULTIMAP_ITERATOR_CONTAINER_TYPE(it_iter) = _HASH_MULTIMAP_CONTAINER; _HASH_MULTIMAP_ITERATOR_ITERATOR_TYPE(it_iter) = _BIDIRECTIONAL_ITERATOR; return it_iter; }