Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
kill another avoidable XML
[simgrid.git] / teshsuite / mc / mutex_handling.c
index 4db2783..e13bd2f 100644 (file)
  * and the MC does not find the counter-example.
  */
 
-#include <stdio.h>
 #include "simgrid/msg.h"
-#include "xbt/log.h"
 #include "mc/mc.h"
 #include <xbt/synchro_core.h>
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
-                             "Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
 #define BOX_NAME "box"
 
@@ -65,18 +62,14 @@ static int sender(int argc, char *argv[])
 int main(int argc, char *argv[])
 {
   MSG_init(&argc, argv);
-  if (argc != 3) {
-    printf("Usage: %s platform_file deployment_file\n", argv[0]);
-    printf("example: %s msg_platform.xml msg_deployment.xml\n", argv[0]);
-    exit(1);
-  }
-  const char *platform_file = argv[1];
-  const char *application_file = argv[2];
-  MSG_create_environment(platform_file);
+  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+       "\tExample: %s msg_platform.xml msg_deployment.xml\n", argv[0], argv[0]);
+
+  MSG_create_environment(argv[1]);
   MSG_function_register("receiver", receiver);
   MSG_function_register("sender", sender);
 
-  MSG_launch_application(application_file);
+  MSG_launch_application(argv[2]);
 #ifndef DISABLE_THE_MUTEX
   mutex = xbt_mutex_init();
 #endif
@@ -86,8 +79,5 @@ int main(int argc, char *argv[])
 #endif
   XBT_INFO("Simulation time %g", MSG_get_clock());
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
-}
\ No newline at end of file
+  return res != MSG_OK;
+}