X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/b6491c34258d1493b01c3bc9514c87f0abb96edc..2d9d3add29c03f92d7b7cbe589ceefd6cfaab431:/src/xbt/set.c?ds=sidebyside diff --git a/src/xbt/set.c b/src/xbt/set.c index d452b1a64e..47ef8d3860 100644 --- a/src/xbt/set.c +++ b/src/xbt/set.c @@ -10,7 +10,7 @@ #include "gras_private.h" -GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(set,GRAS); +GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(set,tbx); /*####[ Type definition ]####################################################*/ struct gras_set_ { @@ -77,13 +77,13 @@ gras_error_t gras_set_add (gras_set_t *set, elm->name_len = strlen(elm->name); } - errcode = gras_dict_retrieve_ext (set->dict, + errcode = gras_dict_get_ext (set->dict, elm->name, elm->name_len, (void**) &found_in_dict); if (errcode == no_error) { elm->ID=found_in_dict->ID; DEBUG2("Reinsertion of key %s (id %d)", elm->name, elm->ID); - TRY(gras_dict_insert_ext(set->dict, elm->name, elm->name_len, elm, free_func)); + TRY(gras_dict_set_ext(set->dict, elm->name, elm->name_len, elm, free_func)); TRY(gras_dynar_set(set->dynar, elm->ID, &elm)); return no_error; @@ -92,9 +92,9 @@ gras_error_t gras_set_add (gras_set_t *set, } elm->ID = gras_dynar_length( set->dynar ); - TRY(gras_dict_insert_ext(set->dict, elm->name, elm->name_len, elm, free_func)); + TRY(gras_dict_set_ext(set->dict, elm->name, elm->name_len, elm, free_func)); TRY(gras_dynar_set(set->dynar, elm->ID, &elm)); - DEBUG2("Insertion of key %s (id %d)", elm->name, elm->ID); + DEBUG2("Insertion of key '%s' (id %d)", elm->name, elm->ID); return no_error; } @@ -105,13 +105,13 @@ gras_error_t gras_set_add (gras_set_t *set, * @name: Name of the searched cell * @dst: where to put the found data into * - * Retrieve a data stored in the cell by providing its name. + * get a data stored in the cell by providing its name. */ gras_error_t gras_set_get_by_name (gras_set_t *set, const char *name, /* OUT */gras_set_elm_t **dst) { - return gras_dict_retrieve_ext(set->dict, name, strlen(name), (void**) dst); + return gras_dict_get_ext(set->dict, name, strlen(name), (void**) dst); } /** * gras_set_get_by_name_ext: @@ -120,7 +120,7 @@ gras_error_t gras_set_get_by_name (gras_set_t *set, * @name_len: length of the name, when strlen cannot be trusted * @dst: where to put the found data into * - * Retrieve a data stored in the cell by providing its name (and the length + * get a data stored in the cell by providing its name (and the length * of the name, when strlen cannot be trusted because you don't use a char* * as name, you weird guy). */ @@ -129,7 +129,7 @@ gras_error_t gras_set_get_by_name_ext(gras_set_t *set, int name_len, /* OUT */gras_set_elm_t **dst) { - return gras_dict_retrieve_ext (set->dict, name, name_len, (void**)dst); + return gras_dict_get_ext (set->dict, name, name_len, (void**)dst); } /** @@ -139,17 +139,21 @@ gras_error_t gras_set_get_by_name_ext(gras_set_t *set, * @name_len: length of the name, when strlen cannot be trusted * @dst: where to put the found data into * - * Retrieve a data stored in the cell by providing its name (and the length + * get a data stored in the cell by providing its name (and the length * of the name, when strlen cannot be trusted because you don't use a char* * as name, you weird guy). */ gras_error_t gras_set_get_by_id (gras_set_t *set, int id, /* OUT */gras_set_elm_t **dst) { + DEBUG2("Lookup type of id %d (of %d)", + id, gras_dynar_length(set->dynar)); if (id < gras_dynar_length(set->dynar) && id >= 0) { gras_dynar_get(set->dynar,id,dst); - + DEBUG3("Lookup type of id %d (of %d): %s", + id, gras_dynar_length(set->dynar), (*dst)->name); + } else { DEBUG1("Cannot get ID %d: out of bound", id); return mismatch_error;