X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f6940b14610d1ac8f34a2e35572c1db33920c0c4..bd7d5780ee8b73efd58c83f5d6f864d0a941b3ed:/examples/msg/dht-kademlia/answer.c diff --git a/examples/msg/dht-kademlia/answer.c b/examples/msg/dht-kademlia/answer.c index 1cd48a0cf9..14b90202de 100644 --- a/examples/msg/dht-kademlia/answer.c +++ b/examples/msg/dht-kademlia/answer.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2014. The SimGrid Team. +/* Copyright (c) 2012-2014, 2016-2017. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -35,9 +35,9 @@ void answer_print(answer_t answer) { unsigned int cpt; node_contact_t contact; - XBT_INFO("Searching %08x, size %d", answer->destination_id, answer->size); + XBT_INFO("Searching %08x, size %u", answer->destination_id, answer->size); xbt_dynar_foreach(answer->nodes, cpt, contact) { - XBT_INFO("Node %08x: %08x is at distance %d", cpt, contact->id, contact->distance); + XBT_INFO("Node %08x: %08x is at distance %u", cpt, contact->id, contact->distance); } } @@ -109,15 +109,14 @@ void answer_trim(answer_t answer) */ void answer_add_bucket(bucket_t bucket, answer_t answer) { - unsigned int cpt; - unsigned int id; - unsigned int distance; - node_contact_t contact; xbt_assert((bucket != NULL), "Provided a NULL bucket"); xbt_assert((bucket->nodes != NULL), "Provided a bucket which nodes are NULL"); + + unsigned int cpt; + unsigned int id; xbt_dynar_foreach(bucket->nodes, cpt, id) { - distance = id ^ answer->destination_id; - contact = node_contact_new(id, distance); + unsigned int distance = id ^ answer->destination_id; + node_contact_t contact = node_contact_new(id, distance); xbt_dynar_push(answer->nodes, &contact); answer->size++; }