Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove usage of xbt_dict_size().
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Mon, 14 Nov 2011 12:04:16 +0000 (13:04 +0100)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Mon, 14 Nov 2011 12:18:20 +0000 (13:18 +0100)
xbt_dict_size() can now be safely removed.

examples/gras/replay/replay.c
src/msg/msg_actions.c
src/surf/network.c
src/surf/surf_routing.c
src/xbt/dict.c

index dbe3c90..0b3f2b3 100644 (file)
@@ -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);
     }
index 0fb8c58..cacf21e 100644 (file)
@@ -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.");
 
index d628825..d9f0192 100644 (file)
@@ -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);
          }
index 6bac929..701eabf 100644 (file)
@@ -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, "")) {
index 83e73b5..c58f0c0 100644 (file)
@@ -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);
 }
 
 /**