X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/5b3677b425b9cc6949c1573d59ac772540cbf4b2..d6f9ff17895dbe0393bb0c31a04fffdd052da678:/examples/msg/chainsend/broadcaster.c?ds=inline diff --git a/examples/msg/chainsend/broadcaster.c b/examples/msg/chainsend/broadcaster.c index 5daf3d5fa7..f14a1be7fc 100644 --- a/examples/msg/chainsend/broadcaster.c +++ b/examples/msg/chainsend/broadcaster.c @@ -6,8 +6,7 @@ #include "broadcaster.h" -XBT_LOG_NEW_DEFAULT_CATEGORY(msg_broadcaster, - "Messages specific for the broadcaster"); +XBT_LOG_NEW_DEFAULT_CATEGORY(msg_broadcaster, "Messages specific for the broadcaster"); xbt_dynar_t build_hostlist_from_hostcount(int hostcount) { @@ -38,8 +37,7 @@ int broadcaster_build_chain(broadcaster_t bc) next = *cur; bc->first = next; - /* This iterator iterates one step ahead: cur is current iterated element, - but it's actually the next one in the chain */ + /* This iterator iterates one step ahead: cur is current iterated element, but is actually next in the chain */ do { /* following steps: prev=last, host=next, next=cur */ cur = (char**)xbt_dynar_iterator_next(bc->it); @@ -49,8 +47,8 @@ int broadcaster_build_chain(broadcaster_t bc) next = *cur; else next = NULL; - XBT_DEBUG("Building chain -- broadcaster:\"%s\" dest:\"%s\" prev:\"%s\" next:\"%s\"", me, current_host, prev, next); - + XBT_DEBUG("Building chain--broadcaster:\"%s\" dest:\"%s\" prev:\"%s\" next:\"%s\"", me, current_host, prev, next); + /* Send message to current peer */ task = task_message_chain_new(prev, next, bc->piece_count); MSG_task_send(task, current_host); @@ -118,11 +116,11 @@ int broadcaster(int argc, char *argv[]) XBT_DEBUG("broadcaster"); /* Add every mailbox given by the hostcount in argv[1] to a dynamic array */ - host_list = build_hostlist_from_hostcount(atoi(argv[1])); + host_list = build_hostlist_from_hostcount(xbt_str_parse_int(argv[1], "Invalid number of peers: %s")); /* argv[2] is the number of pieces */ if (argc > 2) { - piece_count = atoi(argv[2]); + piece_count = xbt_str_parse_int(argv[2], "Invalid number of pieces: %s"); XBT_DEBUG("piece_count set to %d", piece_count); } else { XBT_DEBUG("No piece_count specified, defaulting to %d", piece_count);