Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Replace, when possible, calls to bprintf() by calls to xbt_strdup().
[simgrid.git] / examples / msg / bittorrent / bittorrent_platfgen.c
index ff18530..62bbf49 100644 (file)
@@ -1,6 +1,5 @@
 /* Copyright (c) 2012. The SimGrid Team.
  * All rights reserved.                                                     */
-
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 #include "bittorrent.h"
@@ -97,21 +96,21 @@ void dispatch_jobs(double tracker_deadline, double peer_deadline, double seed_pe
     if(i==0) {
       //The fisrt node is the tracker
       arguments_tracker = xbt_malloc0(sizeof(char*) * 2);
-      arguments_tracker[0] = bprintf("tracker");
+      arguments_tracker[0] = xbt_strdup("tracker");
       arguments_tracker[1] = bprintf("%f", tracker_deadline);
       MSG_process_create_with_arguments("tracker", tracker, NULL, host, 2, arguments_tracker);
     } else {
       //Other nodes are peers
       int argument_size;
       arguments_peer = xbt_malloc0(sizeof(char*) * 4);
-      arguments_peer[0] = bprintf("peer");
+      arguments_peer[0] = xbt_strdup("peer");
       arguments_peer[1] = bprintf("%d", i);
       arguments_peer[2] = bprintf("%f", peer_deadline);
 
       //The first peers will be seeders
       if(seed_count > 0) {
         seed_count--;
-        arguments_peer[3] = bprintf("1");
+        arguments_peer[3] = xbt_strdup("1");
         argument_size = 4;
       } else {
         //Other ars leechers
@@ -138,7 +137,5 @@ int main(int argc, char *argv[])
 
   MSG_main();
 
-  MSG_clean();
-
   return 0;
 }