A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' into MC_LTL
[simgrid.git]
/
src
/
instr
/
jedule
/
jedule_platform.c
diff --git
a/src/instr/jedule/jedule_platform.c
b/src/instr/jedule/jedule_platform.c
index
04d31b1
..
d6b488b
100644
(file)
--- a/
src/instr/jedule/jedule_platform.c
+++ b/
src/instr/jedule/jedule_platform.c
@@
-46,9
+46,7
@@
static int compare_ids(const void *num1, const void *num2) {
static void jed_free_container(jed_simgrid_container_t container) {
xbt_dict_free(&container->name2id);
static void jed_free_container(jed_simgrid_container_t container) {
xbt_dict_free(&container->name2id);
- if( container->resource_list != NULL ) {
- xbt_dynar_free(&container->resource_list);
- }
+ xbt_dynar_free(&container->resource_list);
if( container->container_children != NULL ) {
unsigned int iter;
if( container->container_children != NULL ) {
unsigned int iter;
@@
-66,8
+64,7
@@
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));
xbt_assert( name != NULL );
*container = (jed_simgrid_container_t)calloc(1,sizeof(s_jed_simgrid_container_t));
- (*container)->name = (char*)calloc((strlen(name)+1), sizeof(char));
- strcpy((*container)->name, name);
+ (*container)->name = xbt_strdup(name);
(*container)->is_lowest = 0;
(*container)->container_children = xbt_dynar_new(sizeof(jed_simgrid_container_t), NULL);
(*container)->parent = NULL;
(*container)->is_lowest = 0;
(*container)->container_children = xbt_dynar_new(sizeof(jed_simgrid_container_t), NULL);
(*container)->parent = NULL;
@@
-89,8
+86,7
@@
void jed_simgrid_add_resources(jed_simgrid_container_t parent,
unsigned int iter;
char *host_name;
unsigned int iter;
char *host_name;
- char buf[16];
- char *buf_copy;
+ char *buf;
parent->is_lowest = 1;
xbt_dynar_free(&parent->container_children);
parent->is_lowest = 1;
xbt_dynar_free(&parent->container_children);
@@
-102,10
+98,9
@@
void jed_simgrid_add_resources(jed_simgrid_container_t parent,
xbt_dynar_sort (host_names, &compare_hostnames);
xbt_dynar_foreach(host_names, iter, host_name) {
xbt_dynar_sort (host_names, &compare_hostnames);
xbt_dynar_foreach(host_names, iter, host_name) {
- buf_copy = strdup(buf);
- sprintf(buf_copy, "%d", parent->last_id);
+ buf = bprintf("%d", parent->last_id);
(parent->last_id)++;
(parent->last_id)++;
- xbt_dict_set(parent->name2id, host_name, buf
_copy, NULL
);
+ xbt_dict_set(parent->name2id, host_name, buf
, xbt_free
);
xbt_dict_set(host2_simgrid_parent_container, host_name, parent, NULL);
xbt_dynar_push(parent->resource_list, &host_name);
}
xbt_dict_set(host2_simgrid_parent_container, host_name, parent, NULL);
xbt_dynar_push(parent->resource_list, &host_name);
}