Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use new/delete for smx_process_arg_t
authorGabriel Corona <gabriel.corona@loria.fr>
Fri, 20 May 2016 07:53:05 +0000 (09:53 +0200)
committerGabriel Corona <gabriel.corona@loria.fr>
Mon, 23 May 2016 07:05:21 +0000 (09:05 +0200)
src/simix/smx_host.cpp
src/simix/smx_process.cpp
src/simix/smx_process_private.h
src/surf/sg_platf.cpp

index 985bdcd..15ffa67 100644 (file)
@@ -166,7 +166,7 @@ void _SIMIX_host_free_process_arg(void *data)
     xbt_free(arg->argv[i]);
   xbt_free(arg->argv);
   xbt_free(arg->name);
-  xbt_free(arg);
+  delete arg;
 }
 /**
  * \brief Add a process to the list of the processes that the host will restart when it comes back
@@ -188,7 +188,7 @@ void SIMIX_host_add_auto_restart_process(sg_host_t host,
   if (!sg_host_simix(host)->auto_restart_processes) {
     sg_host_simix(host)->auto_restart_processes = xbt_dynar_new(sizeof(smx_process_arg_t),_SIMIX_host_free_process_arg);
   }
-  smx_process_arg_t arg = xbt_new(s_smx_process_arg_t,1);
+  smx_process_arg_t arg = new s_smx_process_arg_t();
   arg->name = xbt_strdup(name);
   arg->code = code;
   arg->data = data;
index 08644bb..f696d92 100644 (file)
@@ -219,7 +219,7 @@ smx_process_t SIMIX_process_create_from_wrapper(smx_process_arg_t args) {
                                         args->properties,
                                         args->auto_restart,
                                         NULL);
-  xbt_free(args);
+  delete args;
   return process;
 }
 
index bf93b7f..099821d 100644 (file)
@@ -17,7 +17,8 @@ typedef struct s_smx_process_exit_fun {
   void *arg;
 } s_smx_process_exit_fun_t, *smx_process_exit_fun_t;
 
-typedef struct s_smx_process_arg {
+typedef class s_smx_process_arg {
+public:
   char *name;
   xbt_main_func_t code;
   void *data;
index effdb4b..da11235 100644 (file)
@@ -575,7 +575,7 @@ void sg_platf_new_process(sg_platf_process_cbarg_t process)
   smx_process_arg_t arg = NULL;
   smx_process_t process_created = NULL;
 
-  arg = xbt_new0(s_smx_process_arg_t, 1);
+  arg = new s_smx_process_arg_t();
   arg->code = parse_code;
   arg->data = NULL;
   arg->hostname = sg_host_get_name(host);
@@ -593,7 +593,7 @@ void sg_platf_new_process(sg_platf_process_cbarg_t process)
   xbt_dynar_push_as(sg_host_simix(host)->boot_processes,smx_process_arg_t,arg);
 
   if (start_time > SIMIX_get_clock()) {
-    arg = xbt_new0(s_smx_process_arg_t, 1);
+    arg = new s_smx_process_arg_t();
     arg->name = (char*)(process->argv)[0];
     arg->code = parse_code;
     arg->data = NULL;