-/*
- * 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 <stdlib.h>
#include <string.h>
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) {
+void jed_simgrid_create_container(jed_simgrid_container_t *container,
+ const 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);
// 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;
}
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);
}
// printf("subset parent >>> %s\n", parent->name);
add_subsets_to(subset_list, hostgroup, parent);
}
-
+ xbt_dynar_free(&hostgroup);
}
xbt_dict_free(&parent2hostgroup);
}
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);
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);