X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/272ccad1b68b6d9c17069f3c934886925bb15b5d..6de03ecc4e630732984a0673512a5d15fd75e270:/src/instr/jedule/jedule_platform.c diff --git a/src/instr/jedule/jedule_platform.c b/src/instr/jedule/jedule_platform.c index bd4ee3c6c4..b096eeddb4 100644 --- a/src/instr/jedule/jedule_platform.c +++ b/src/instr/jedule/jedule_platform.c @@ -1,9 +1,8 @@ -/* - * jed_simgrid_platform.c - * - * Created on: Nov 30, 2010 - * Author: sascha - */ +/* Copyright (c) 2010-2014. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ #include #include @@ -54,16 +53,17 @@ static void jed_free_container(jed_simgrid_container_t container) { xbt_dynar_foreach(container->container_children, iter, child_container) { jed_free_container(child_container); } + xbt_dynar_free(&container->container_children); } - free(container->name); - free(container); + xbt_free(container->name); + xbt_free(container); } void jed_simgrid_create_container(jed_simgrid_container_t *container, char *name) { xbt_assert( name != NULL ); - *container = (jed_simgrid_container_t)calloc(1,sizeof(s_jed_simgrid_container_t)); + *container = xbt_new0(s_jed_simgrid_container_t,1); (*container)->name = xbt_strdup(name); (*container)->is_lowest = 0; (*container)->container_children = xbt_dynar_new(sizeof(jed_simgrid_container_t), NULL); @@ -117,7 +117,7 @@ static void add_subset_to(xbt_dynar_t subset_list, int start, int end, // printf(">>> start=%d end=%d\n", start, end); - subset = (jed_res_subset_t)calloc(1,sizeof(s_jed_res_subset_t)); + subset = xbt_new0(s_jed_res_subset_t,1); subset->start_idx = start; subset->nres = end-start+1; subset->parent = parent; @@ -157,7 +157,7 @@ static void add_subsets_to(xbt_dynar_t subset_list, xbt_dynar_t hostgroup, } nb_ids = xbt_dynar_length(id_list); - id_ar = (int*)calloc(nb_ids, sizeof(int)); + id_ar = xbt_new0(int,nb_ids); xbt_dynar_foreach(id_list, iter, id_str) { id_ar[iter] = atoi(id_str); } @@ -241,7 +241,7 @@ void jed_simgrid_get_resource_selection_by_hosts(xbt_dynar_t subset_list, // printf("subset parent >>> %s\n", parent->name); add_subsets_to(subset_list, hostgroup, parent); } - + xbt_dynar_free(&hostgroup); } xbt_dict_free(&parent2hostgroup); @@ -261,7 +261,7 @@ void jedule_add_meta_info(jedule_t jedule, char *key, char *value) { } void jed_create_jedule(jedule_t *jedule) { - *jedule = (jedule_t)calloc(1,sizeof(s_jedule_t)); + *jedule = xbt_new0(s_jedule_t,1); host2_simgrid_parent_container = xbt_dict_new_homogeneous(NULL); container_name2container = xbt_dict_new_homogeneous(NULL); (*jedule)->jedule_meta_info = xbt_dict_new_homogeneous(NULL); @@ -272,7 +272,7 @@ void jed_free_jedule(jedule_t jedule) { jed_free_container(jedule->root_container); xbt_dict_free(&jedule->jedule_meta_info); - free(jedule); + xbt_free(jedule); xbt_dict_free(&host2_simgrid_parent_container); xbt_dict_free(&container_name2container);