From f4e13da91b79636379546d5091c9fa1632034eba Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Tue, 1 Oct 2013 23:25:07 +0200 Subject: [PATCH] Use homogeneous dicts which are more efficient. --- src/msg/msg_host.c | 2 +- src/smpi/smpi_bench.c | 4 ++-- src/surf/network.c | 2 +- src/surf/storage.c | 4 ++-- src/surf/surf.c | 2 +- src/surf/workstation.c | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/msg/msg_host.c b/src/msg/msg_host.c index 1903036482..4dbe948fe8 100644 --- a/src/msg/msg_host.c +++ b/src/msg/msg_host.c @@ -357,7 +357,7 @@ xbt_dict_t MSG_host_get_storage_list(msg_host_t host) xbt_dict_t MSG_host_get_storage_content(msg_host_t host) { xbt_assert((host != NULL), "Invalid parameters"); - xbt_dict_t contents = xbt_dict_new(); + xbt_dict_t contents = xbt_dict_new_homogeneous(NULL); msg_storage_t storage; char* storage_name; char* mount_name; diff --git a/src/smpi/smpi_bench.c b/src/smpi/smpi_bench.c index e5aa4233a1..ccbf9b3e26 100644 --- a/src/smpi/smpi_bench.c +++ b/src/smpi/smpi_bench.c @@ -102,13 +102,13 @@ static void* shm_map(int fd, size_t size, shared_data_t* data) { xbt_die("Could not map fd %d: %s", fd, strerror(errno)); } if(!allocs_metadata) { - allocs_metadata = xbt_dict_new(); + allocs_metadata = xbt_dict_new_homogeneous(xbt_free); } snprintf(loc, PTR_STRLEN, "%p", mem); meta = xbt_new(shared_metadata_t, 1); meta->size = size; meta->data = data; - xbt_dict_set(allocs_metadata, loc, meta, &free); + xbt_dict_set(allocs_metadata, loc, meta, NULL); XBT_DEBUG("MMAP %zu to %p", size, mem); return mem; } diff --git a/src/surf/network.c b/src/surf/network.c index f5dd903b25..d3d87f7680 100644 --- a/src/surf/network.c +++ b/src/surf/network.c @@ -680,7 +680,7 @@ static void smpi_gap_append(double size, const link_CM02_t link, if (sg_sender_gap > 0.0) { if (!gap_lookup) { - gap_lookup = xbt_dict_new(); + gap_lookup = xbt_dict_new_homogeneous(NULL); } fifo = (xbt_fifo_t) xbt_dict_get_or_null(gap_lookup, src); action->sender.gap = 0.0; diff --git a/src/surf/storage.c b/src/surf/storage.c index 9a0a99e3b0..a34bf83cc9 100644 --- a/src/surf/storage.c +++ b/src/surf/storage.c @@ -43,7 +43,7 @@ static surf_action_t storage_action_ls(void *storage, const char* path) { surf_action_t action = storage_action_execute(storage,0, LS); action->ls_dict = NULL; - xbt_dict_t ls_dict = xbt_dict_new(); + xbt_dict_t ls_dict = xbt_dict_new_homogeneous(NULL); char* key; sg_storage_size_t size = 0; @@ -204,7 +204,7 @@ static xbt_dict_t storage_get_content(void *storage) /*surf_action_t action = storage_action_execute(storage,0, LS);*/ void *st = surf_storage_resource_priv(storage); - xbt_dict_t content_dict = xbt_dict_new(); + xbt_dict_t content_dict = xbt_dict_new_homogeneous(NULL); xbt_dict_cursor_t cursor = NULL; char *file; char *size; diff --git a/src/surf/surf.c b/src/surf/surf.c index dae1ecccc2..3835bc6fb5 100644 --- a/src/surf/surf.c +++ b/src/surf/surf.c @@ -401,7 +401,7 @@ void surf_init(int *argc, char **argv) as_router_lib = xbt_lib_new(); storage_lib = xbt_lib_new(); storage_type_lib = xbt_lib_new(); - watched_hosts_lib = xbt_dict_new(); + watched_hosts_lib = xbt_dict_new_homogeneous(NULL); XBT_DEBUG("Add routing levels"); ROUTING_HOST_LEVEL = xbt_lib_add_level(host_lib,routing_asr_host_free); diff --git a/src/surf/workstation.c b/src/surf/workstation.c index c4c000bb15..a9497169ed 100644 --- a/src/surf/workstation.c +++ b/src/surf/workstation.c @@ -369,7 +369,7 @@ static xbt_dict_t ws_get_storage_list(void *workstation) { s_mount_t mnt; unsigned int i; - xbt_dict_t storage_list = xbt_dict_new(); + xbt_dict_t storage_list = xbt_dict_new_homogeneous(NULL); char *storage_name = NULL; workstation_CLM03_t ws = (workstation_CLM03_t) surf_workstation_resource_priv(workstation); -- 2.20.1