From 75b61335a13287f7a038935382966855d3a7098e Mon Sep 17 00:00:00 2001 From: Samuel Lepetit Date: Thu, 21 Jun 2012 10:54:24 +0200 Subject: [PATCH] Cleanup in SIMIX_process_on_exit_runall --- src/simix/smx_process.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/simix/smx_process.c b/src/simix/smx_process.c index 18656face9..0020a7ac6d 100644 --- a/src/simix/smx_process.c +++ b/src/simix/smx_process.c @@ -714,16 +714,11 @@ xbt_dynar_t SIMIX_processes_as_dynar(void) { return res; } void SIMIX_process_on_exit_runall(smx_process_t process) { - int cpt; - if (!process->on_exit) { - return; - } - - smx_process_exit_fun_t exit_fun; + s_smx_process_exit_fun_t exit_fun; - for (cpt = xbt_dynar_length(process->on_exit) - 1; cpt >= 0; cpt--) { - exit_fun = xbt_dynar_get_ptr(process->on_exit, cpt); - (exit_fun->fun)(exit_fun->arg); + while (!xbt_dynar_is_empty(process->on_exit)) { + exit_fun = xbt_dynar_pop_as(process->on_exit,s_smx_process_exit_fun_t); + (exit_fun.fun)(exit_fun.arg); } } void SIMIX_process_on_exit(int_f_pvoid_t fun, void *data) { -- 2.20.1