Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use bprintf instead of sprintf
[simgrid.git] / testsuite / surf / lmm_usage.c
index 935c9fa..3fe0ddb 100644 (file)
@@ -17,8 +17,6 @@
 #include "xbt/module.h"
 #include <math.h>
 
-
-
 XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test,
                             "Messages specific for surf example");
 
@@ -405,16 +403,13 @@ void test3(method_t method)
 
 
   tmp_name = (char **) calloc(31, sizeof(char *));
-  for (i = 0; i < 31; i++) {
-    tmp_name[i] = (char *) calloc(10, sizeof(char));
-  }
 
   /*
    * Creates the constraints
    */
   tmp_cnst = calloc(15, sizeof(lmm_constraint_t));
   for (i = 0; i < 15; i++) {
-    sprintf(tmp_name[i], "C_%03d", i);
+    tmp_name[i] = bprintf("C_%03d", i);
     tmp_cnst[i] = lmm_constraint_new(Sys, (void *) tmp_name[i], B[i]);
   }
 
@@ -424,7 +419,7 @@ void test3(method_t method)
    */
   tmp_var = calloc(16, sizeof(lmm_variable_t));
   for (j = 0; j < 16; j++) {
-    sprintf(tmp_name[i + j], "X_%03d", j);
+    tmp_name[i + j] = bprintf("X_%03d", j);
     tmp_var[j] =
        lmm_variable_new(Sys, (void *) tmp_name[i + j], 1.0, -1.0, 15);
     lmm_update_variable_latency(Sys, tmp_var[j], 1.0);
@@ -475,62 +470,40 @@ int main(int argc, char **argv)
 {
   xbt_init(&argc, argv);
 
-
-  DEBUG0("**************************** ");
-  DEBUG0("*****                  ***** ");
-  DEBUG0("*****      TEST 1      ***** ");
-  DEBUG0("*****                  ***** ");
-  DEBUG0("**************************** ");
-
-
-  DEBUG0("***** Test 1 (Max-Min) ***** ");
+  INFO0("***** Test 1 (Max-Min)");
   test1(MAXMIN);
 #ifdef HAVE_SDP
-  DEBUG0("***** Test 1 (SDP) ***** ");
+  INFO0("***** Test 1 (SDP)");
   test1(SDP);
 #endif
-  DEBUG0("***** Test 1 (Lagrange - Vegas) ***** ");
+  INFO0("***** Test 1 (Lagrange - Vegas)");
   test1(LAGRANGE_VEGAS);
-  DEBUG0("***** Test 1 (Lagrange - Reno) ***** ");
+  INFO0("***** Test 1 (Lagrange - Reno)");
   test1(LAGRANGE_RENO);
 
-
-  DEBUG0("**************************** ");
-  DEBUG0("*****                  ***** ");
-  DEBUG0("*****      TEST 2      ***** ");
-  DEBUG0("*****                  ***** ");
-  DEBUG0("**************************** ");
-
-
-  DEBUG0("***** Test 2 (Max-Min) ***** ");
+   
+   
+  INFO0("***** Test 2 (Max-Min)");
   test2(MAXMIN);
 #ifdef HAVE_SDP
-  DEBUG0("***** Test 2 (SDP) ***** ");
+  INFO0("***** Test 2 (SDP)");
   test2(SDP);
 #endif
-  DEBUG0("***** Test 2 (Lagrange - Vegas) ***** ");
+  INFO0("***** Test 2 (Lagrange - Vegas)");
   test2(LAGRANGE_VEGAS);
-  DEBUG0("***** Test 2 (Lagrange - Reno) ***** ");
+  INFO0("***** Test 2 (Lagrange - Reno)");
   test2(LAGRANGE_RENO);
 
 
-
-  DEBUG0("**************************** ");
-  DEBUG0("*****                  ***** ");
-  DEBUG0("*****      TEST 3      ***** ");
-  DEBUG0("*****                  ***** ");
-  DEBUG0("**************************** ");
-
-
-  DEBUG0("***** Test 3 (Max-Min) ***** ");
+  INFO0("***** Test 3 (Max-Min)");
   test3(MAXMIN);
 #ifdef HAVE_SDP
-  DEBUG0("***** Test 3 (SDP) ***** ");
+  INFO0("***** Test 3 (SDP)");
   test3(SDP);
 #endif
-  DEBUG0("***** Test 3 (Lagrange - Vegas) ***** ");
+  INFO0("***** Test 3 (Lagrange - Vegas)");
   test3(LAGRANGE_VEGAS);
-  DEBUG0("***** Test 3 (Lagrange - Reno) ***** ");
+  INFO0("***** Test 3 (Lagrange - Reno)");
   test3(LAGRANGE_RENO);
 
   return 0;