Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use xxx_is_empty().
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 7 May 2018 20:06:20 +0000 (22:06 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 7 May 2018 20:47:54 +0000 (22:47 +0200)
examples/msg/dht-pastry/dht-pastry.c
teshsuite/msg/app-bittorrent/bittorrent-peer.c

index 8ac58ec..e4e4809 100644 (file)
@@ -313,7 +313,7 @@ static void handle_task(node_t node, msg_task_t task) {
       // if the node is ready, do all the pending tasks and send update to known nodes
       if (node->ready==0) {
         XBT_DEBUG("Node %i is ready!!!", node->id);
-        while(xbt_dynar_length(node->pending_tasks)){
+        while (!xbt_dynar_is_empty(node->pending_tasks)) {
           msg_task_t task;
           xbt_dynar_shift(node->pending_tasks, &task);
           handle_task(node, task);
index f74cdf3..700d920 100644 (file)
@@ -591,7 +591,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_choked  = xbt_dict_cursor_get_key(cursor);
     peer_choked = xbt_dict_cursor_get_data(cursor);
   }