From: Arnaud Giersch Date: Mon, 14 Nov 2011 12:04:16 +0000 (+0100) Subject: Remove usage of xbt_dict_size(). X-Git-Tag: exp_20120216~309 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/1d6c85f35e0fa3b04426cb359acb1a4ea9fa0d6a Remove usage of xbt_dict_size(). xbt_dict_size() can now be safely removed. --- diff --git a/examples/gras/replay/replay.c b/examples/gras/replay/replay.c index dbe3c90c8e..0b3f2b3be6 100644 --- a/examples/gras/replay/replay.c +++ b/examples/gras/replay/replay.c @@ -67,8 +67,8 @@ int master(int argc, char *argv[]) /* friends, we're ready. Come and play */ XBT_INFO("Wait for peers for a while. I need %d peers", - xbt_dict_size(pals_int)); - while (xbt_dynar_length(peers) < xbt_dict_size(pals_int)) { + xbt_dict_length(pals_int)); + while (xbt_dynar_length(peers) < xbt_dict_length(pals_int)) { TRY { gras_msg_handle(20); } diff --git a/src/msg/msg_actions.c b/src/msg/msg_actions.c index 0fb8c58740..cacf21e547 100644 --- a/src/msg/msg_actions.c +++ b/src/msg/msg_actions.c @@ -176,7 +176,7 @@ MSG_error_t MSG_action_trace_run(char *path) } res = MSG_main(); - if (xbt_dict_size(action_queues)) { + if (!xbt_dict_is_empty(action_queues)) { XBT_WARN ("Not all actions got consumed. If the simulation ended successfully (without deadlock), you may want to add new processes to your deployment file."); diff --git a/src/surf/network.c b/src/surf/network.c index d62882504b..d9f0192461 100644 --- a/src/surf/network.c +++ b/src/surf/network.c @@ -81,7 +81,7 @@ static void gap_remove(surf_action_network_CM02_t action) { if(size == 0) { xbt_fifo_free(fifo); xbt_dict_remove(gap_lookup, action->sender.link_name); - size = xbt_dict_size(gap_lookup); + size = xbt_dict_length(gap_lookup); if(size == 0) { xbt_dict_free(&gap_lookup); } diff --git a/src/surf/surf_routing.c b/src/surf/surf_routing.c index 6bac929dfe..701eabfeff 100644 --- a/src/surf/surf_routing.c +++ b/src/surf/surf_routing.c @@ -1075,7 +1075,7 @@ static void routing_parse_Srandom(void) random_id, random->min, random->max, random->mean, random->std, random->generator, random->seed, random_radical); - if (xbt_dict_size(random_value) == 0) + if (!random_value) random_value = xbt_dict_new(); if (!strcmp(random_radical, "")) { diff --git a/src/xbt/dict.c b/src/xbt/dict.c index 83e73b5be0..c58f0c0882 100644 --- a/src/xbt/dict.c +++ b/src/xbt/dict.c @@ -658,7 +658,7 @@ void xbt_dict_dump_output_string(void *s) */ XBT_INLINE int xbt_dict_is_empty(xbt_dict_t dict) { - return (xbt_dict_size(dict) == 0); + return !dict || (xbt_dict_length(dict) == 0); } /**