X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/c9f1e4b399f0d6093f78cb7fda7beaeabded297f..c94898122fc054483e0e4b0313cd52f385582d2a:/src/surf/surf_timer.c diff --git a/src/surf/surf_timer.c b/src/surf/surf_timer.c index f6ba5c76db..a6e385226e 100644 --- a/src/surf/surf_timer.c +++ b/src/surf/surf_timer.c @@ -17,16 +17,11 @@ static xbt_swag_t command_pending = NULL; static xbt_swag_t command_to_run = NULL; static xbt_heap_t timer_heap = NULL; -static void timer_free(void *timer) -{ - free(timer); -} - static command_t command_new(void *fun, void *args) { command_t command = xbt_new0(s_command_t, 1); - command->model = surf_timer_model; + command->generic_resource.model = surf_timer_model; command->function = fun; command->args = args; xbt_swag_insert(command, command_pending); @@ -35,13 +30,12 @@ static command_t command_new(void *fun, void *args) static void command_free(command_t command) { - free(command); - if (xbt_swag_belongs(command, command_to_run)) { xbt_swag_remove(command, command_to_run); } else if (xbt_swag_belongs(command, command_pending)) { xbt_swag_remove(command, command_pending); } + surf_resource_free((surf_resource_t)command); return; } @@ -53,12 +47,6 @@ static void parse_file(const char *file) { } -static const char *get_resource_name(void *resource_id) -{ - DIE_IMPOSSIBLE; - return ""; -} - static int resource_used(void *resource_id) { return 1; @@ -162,7 +150,6 @@ static void surf_timer_model_init_internal(void) { surf_timer_model = surf_model_init(); - surf_timer_model->get_resource_name = get_resource_name; surf_timer_model->action_get_state = surf_action_get_state; surf_timer_model->action_change_state = action_change_state; surf_timer_model->action_set_data = surf_action_set_data;