#include "xbt/set.h"
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(set,xbt,
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_set,xbt,
"set: data container consisting in dict+dynar");
/*####[ Type definition ]####################################################*/
xbt_set_elm_t found_in_dict = NULL;
xbt_ex_t e;
+ VERB1("add %s to the set",elm->name);
+
if (elm->name_len <= 0) {
elm->name_len = strlen(elm->name);
}
xbt_dict_set_ext(set->dict, elm->name, elm->name_len, elm, free_func);
xbt_dynar_set(set->dynar, elm->ID, &elm);
DEBUG2("Insertion of key '%s' (id %d)", elm->name, elm->ID);
- xbt_ex_free(&e);
+ xbt_ex_free(e);
}
if (found) {
return res;
}
+/** @brief Constructor */
+unsigned long xbt_set_length (const xbt_set_t set) {
+ return xbt_dynar_length(set->dynar);
+}
+
/***
*** Cursors
***/
} CATCH(e) {
if (e.category != not_found_error)
xbt_test_exception(e);
- xbt_ex_free(&e);
+ xbt_ex_free(e);
}
}
xbt_test_add0("Search 123");
elm = (my_elem_t) xbt_set_get_by_name(set,"123");
xbt_test_assert0(elm,"elm must be there");
- strcmp("123",elm->data);
+ xbt_assert(!strcmp("123",elm->data));
search_not_found(set,"Can't be found");
search_not_found(set,"123 Can't be found");