Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use xbt_XXX_is_empty() instead of testing xbt_XXX_length() against 0.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Thu, 14 Feb 2013 14:28:03 +0000 (15:28 +0100)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Thu, 14 Feb 2013 14:48:39 +0000 (15:48 +0100)
XXX is 'dict' or 'dynar'.

examples/msg/bittorrent/peer.c
examples/msg/kademlia/routing_table.c
src/bindings/java/smx_context_cojava.c
src/instr/instr_paje_containers.c
src/mc/mc_checkpoint.c
src/msg/msg_vm.c

index 2a9db33..4c930b7 100644 (file)
@@ -571,7 +571,7 @@ void update_choked_peers(peer_t peer)
   //remove a peer from the list
   xbt_dict_cursor_t cursor = NULL;
   xbt_dict_cursor_first(peer->active_peers, &cursor);
-  if (xbt_dict_length(peer->active_peers) > 0) {
+  if (!xbt_dict_is_empty(peer->active_peers)) {
     key = xbt_dict_cursor_get_key(cursor);
     connection_t peer_choked = xbt_dict_cursor_get_data(cursor);
     if (peer_choked) {
index 022a986..62a73e1 100644 (file)
@@ -58,7 +58,7 @@ void routing_table_print(routing_table_t table)
   XBT_INFO("Routing table of %08x:", table->id);
 
   for (i = 0; i <= identifier_size; i++) {
-    if (xbt_dynar_length(table->buckets[i].nodes) > 0) {
+    if (!xbt_dynar_is_empty(table->buckets[i].nodes)) {
       XBT_INFO("Bucket number %d: ", i);
       xbt_dynar_foreach(table->buckets[i].nodes, j, value) {
         XBT_INFO("Element %d: %08x", j, value);
index 4d5dd53..5e135f2 100644 (file)
@@ -247,7 +247,7 @@ static void smx_ctx_cojava_runall(void)
 {
   cojava_processes = SIMIX_process_get_runnable();
   smx_process_t process;
-  if (xbt_dynar_length(cojava_processes) > 0) {
+  if (!xbt_dynar_is_empty(cojava_processes)) {
     process = xbt_dynar_get_as(cojava_processes, 0, smx_process_t);
     cojava_process_index = 1;
     /* Execute the first process */
index 6846474..7febbb3 100644 (file)
@@ -229,7 +229,7 @@ void PJ_container_free_all ()
   rootContainer = NULL;
 
   //checks
-  if (xbt_dict_length(allContainers) != 0){
+  if (!xbt_dict_is_empty(allContainers)){
     THROWF(tracing_error, 0, "some containers still present even after destroying all of them");
   }
 }
index d96dd72..a8591ee 100644 (file)
@@ -498,7 +498,7 @@ static xbt_strbuff_t get_local_variables_values(void *stack_context, void *heap)
               cursor2++;
             }
 
-            if(xbt_dynar_length(compose) > 0){
+            if(!xbt_dynar_is_empty(compose)){
               frame_pointer_address = xbt_dynar_get_as(compose, xbt_dynar_length(compose) - 1, variable_value_t)->value.address ; 
             }
             break;
@@ -546,7 +546,7 @@ static xbt_strbuff_t get_local_variables_values(void *stack_context, void *heap)
             cursor++;
           }
           
-          if(xbt_dynar_length(compose) > 0){
+          if(!xbt_dynar_is_empty(compose)){
             if(strcmp(xbt_dynar_get_as(compose, xbt_dynar_length(compose) - 1, variable_value_t)->type, "value") == 0){
               to_append = bprintf("%s=%lx\n", current_variable->name, xbt_dynar_get_as(compose, xbt_dynar_length(compose) - 1, variable_value_t)->value.res);
               xbt_strbuff_append(variables, to_append);
index f46e7ca..1143525 100644 (file)
@@ -171,7 +171,7 @@ void MSG_vm_shutdown(msg_vm_t vm)
 {
   msg_process_t process;
   XBT_DEBUG("%lu processes in the VM", xbt_dynar_length(vm->processes));
-  while (xbt_dynar_length(vm->processes) > 0) {
+  while (!xbt_dynar_is_empty(vm->processes)) {
     process = xbt_dynar_get_as(vm->processes,0,msg_process_t);
     MSG_process_kill(process);
   }