The only remaining users of heterogeneous dicts are sets and multidicts.
XBT_INFO("== Trying to modify a process property");
value = gras_process_property_value("new prop");
xbt_assert(!value, "Property 'new prop' exists before I add it!");
- xbt_dict_set(process_props, "new prop", xbt_strdup("new value"),
- xbt_free_f);
+ xbt_dict_set(process_props, "new prop", xbt_strdup("new value"), NULL);
/* Test if we have changed the value */
value = gras_process_property_value("new prop");
XBT_INFO
("== Set a host property that alice will try to retrieve in SG (from bob->hello)");
- xbt_dict_set(host_props, "from bob", xbt_strdup("hello"), xbt_free_f);
+ xbt_dict_set(host_props, "from bob", xbt_strdup("hello"), NULL);
XBT_INFO("== Dump all the properties of host1 again to check the addition");
xbt_dict_foreach(host_props, cursor, key, data)
xbt_workload_elm_t cmd;
xbt_dict_cursor_t dict_cursor;
- xbt_dict_t pals_int = xbt_dict_new();
+ xbt_dict_t pals_int = xbt_dict_new_homogeneous(NULL);
xbt_dynar_foreach(cmds, cursor, cmd) {
int *p = xbt_dict_get_or_null(pals_int, cmd->who);
if (!p) {
xbt_dict_free(&pals_int);
/* Check who came */
- xbt_dict_t pals = xbt_dict_new();
+ xbt_dict_t pals = xbt_dict_new_homogeneous(NULL);
gras_socket_t pal;
xbt_dynar_foreach(peers, cursor, peer) {
//XBT_INFO("%s is here",peer->name);
int connected = 0;
gras_cb_register("commands", worker_commands_cb);
- globals->peers = xbt_dict_new();
+ globals->peers = xbt_dict_new_homogeneous(NULL);
if (gras_if_RL())
XBT_INFO("Sensor %s starting. Connecting to master on %s",
XBT_INFO(" Property: %s old value: %s", exist, value);
XBT_INFO("== Trying to modify a host property");
- xbt_dict_set(props, exist, xbt_strdup("250"), xbt_free_f);
+ xbt_dict_set(props, exist, xbt_strdup("250"), NULL);
/* Test if we have changed the value */
value = MSG_host_get_property_value(host1, exist);
/* Trying to set a new property */
- xbt_dict_set(props, "NewProp", strdup("newValue"), free);
+ xbt_dict_set(props, "NewProp", strdup("newValue"), NULL);
/* Print the properties of the workstation 1 */
xbt_dict_foreach(props, cursor, key, data) {
XBT_INFO("\tProperty: %s is undefined", exist);
else {
XBT_INFO("\tProperty: %s old value: %s", exist, value);
- xbt_dict_set(props, exist, strdup("250"), free);
+ xbt_dict_set(props, exist, strdup("250"), NULL);
}
/* Test if we have changed the value */
mod->groups = NULL;
mod->done = 0;
- mod->groups = xbt_dict_new();
+ mod->groups = xbt_dict_new_homogeneous(NULL);
/* callbacks */
gras_cb_register("amok_pm_kill", &amok_pm_cb_kill);
return -1;
}
xbt_dict_t props = MSG_host_get_properties(host);
- xbt_dict_set(props,prop_id,xbt_strdup(prop_value),free);
+ xbt_dict_set(props,prop_id,xbt_strdup(prop_value),NULL);
return 0;
}
if (xbt_dict_is_empty(machine_set)
|| xbt_dict_is_empty(process_function_set)
|| xbt_dynar_is_empty(process_list)) {
- process_function_set = xbt_dict_new();
+ process_function_set = xbt_dict_new_homogeneous(NULL);
process_list = xbt_dynar_new(sizeof(s_process_t), s_process_free);
- machine_set = xbt_dict_new();
+ machine_set = xbt_dict_new_homogeneous(NULL);
}
xbt_dict_set(machine_set, process_host, NULL, NULL);
res = xbt_new(s_gras_cbps_t, 1);
res->lints = xbt_dynar_new(sizeof(int), NULL);
- res->space = xbt_dict_new();
+ res->space = xbt_dict_new_homogeneous(NULL);
/* no leak, the content is freed manually on block_end */
res->frames = xbt_dynar_new(sizeof(xbt_dynar_t), NULL);
res->globals = xbt_dynar_new(sizeof(char *), NULL);
ddt = gras_datadesc_ref("xbt_peer_t", ddt);
/* Dict containing the constant value (for the parsing macro) */
- gras_dd_constants = xbt_dict_new();
+ gras_dd_constants = xbt_dict_new_homogeneous(xbt_free_f);
}
*(void **) r_ref);
if (detect_cycle)
- xbt_dict_set_ext(refs, (const char *) r_ref, r_len, ptr, xbt_free_f);
+ xbt_dict_set_ext(refs, (const char *) r_ref, r_len, ptr, NULL);
}
}
dst);
if (!state) {
state = gras_cbps_new();
- refs = xbt_dict_new();
+ refs = xbt_dict_new_homogeneous(xbt_free_f);
}
TRY {
if (!state) {
state = gras_cbps_new();
- refs = xbt_dict_new();
+ refs = xbt_dict_new_homogeneous(NULL);
}
TRY {
if (!state) {
state = gras_cbps_new();
- refs = xbt_dict_new();
+ refs = xbt_dict_new_homogeneous(xbt_free_f);
}
xbt_assert(type, "called with NULL type descriptor");
int *stored = xbt_new(int, 1);
*stored = value;
- xbt_dict_set(gras_dd_constants, name, stored, xbt_free_f);
+ xbt_dict_set(gras_dd_constants, name, stored, NULL);
}
}
if (plug)
- xbt_dict_set(_gras_trp_plugins, name, plug, gras_trp_plugin_free);
+ xbt_dict_set(_gras_trp_plugins, name, plug, NULL);
}
void gras_trp_init(void)
{
if (!_gras_trp_started) {
/* make room for all plugins */
- _gras_trp_plugins = xbt_dict_new();
+ _gras_trp_plugins = xbt_dict_new_homogeneous(gras_trp_plugin_free);
#ifdef HAVE_WINSOCK2_H
/* initialize the windows mechanism */
gras_procdata_init();
/* initialize the host & process properties */
- _host_properties = xbt_dict_new();
- _process_properties = xbt_dict_new();
+ _host_properties = xbt_dict_new_homogeneous(xbt_free_f);
+ _process_properties = xbt_dict_new_homogeneous(xbt_free_f);
env_iter = environ;
while (*env_iter) {
char *equal, *buf = xbt_strdup(*env_iter);
continue;
}
*equal = '\0';
- xbt_dict_set(_process_properties, buf, xbt_strdup(equal + 1),
- xbt_free_f);
+ xbt_dict_set(_process_properties, buf, xbt_strdup(equal + 1), NULL);
free(buf);
env_iter++;
}
void gras_emul_init(void)
{
if (!benchmark_set) {
- benchmark_set = xbt_dict_new();
+ benchmark_set = xbt_dict_new_homogeneous(xbt_free_f);
timer = xbt_os_timer_new();
}
}
ir = xbt_dict_get_or_null(dict, key);
if (!ir) {
ir = xbt_new0(double, 1);
- xbt_dict_set(dict, key, ir, xbt_free_f);
+ xbt_dict_set(dict, key, ir, NULL);
}
*ir = value;
}
XBT_DEBUG ("Tracing is on");
/* other trace initialization */
- created_categories = xbt_dict_new();
+ created_categories = xbt_dict_new_homogeneous(xbt_free);
TRACE_surf_alloc();
TRACE_smpi_alloc();
return 0;
//check if category is already created
char *created = xbt_dict_get_or_null(created_categories, category);
if (created) return;
- xbt_dict_set (created_categories, category, xbt_strdup("1"), xbt_free);
+ xbt_dict_set (created_categories, category, xbt_strdup("1"), NULL);
//define final_color
char final_color[INSTR_DEFAULT_STR_SIZE];
void instr_paje_init (container_t root)
{
- allContainers = xbt_dict_new ();
- trivaNodeTypes = xbt_dict_new ();
- trivaEdgeTypes = xbt_dict_new ();
+ allContainers = xbt_dict_new_homogeneous(NULL);
+ trivaNodeTypes = xbt_dict_new_homogeneous(xbt_free);
+ trivaEdgeTypes = xbt_dict_new_homogeneous(xbt_free);
rootContainer = root;
}
ret->name = xbt_strdup (typename);
ret->father = father;
ret->kind = kind;
- ret->children = xbt_dict_new ();
- ret->values = xbt_dict_new ();
+ ret->children = xbt_dict_new_homogeneous(NULL);
+ ret->values = xbt_dict_new_homogeneous(NULL);
ret->color = xbt_strdup (color);
char str_id[INSTR_DEFAULT_STR_SIZE];
default: xbt_die ("Congratulations, you have found a bug on newContainer function of instr_routing.c"); break;
}
}
- new->children = xbt_dict_new();
+ new->children = xbt_dict_new_homogeneous(NULL);
if (new->father){
xbt_dict_set(new->father->children, new->name, new, NULL);
new_pajeCreateContainer (new);
xbt_dict_set (allContainers, new->name, new, NULL);
//register NODE types for triva configuration
- xbt_dict_set (trivaNodeTypes, new->type->name, xbt_strdup("1"), xbt_free);
+ xbt_dict_set (trivaNodeTypes, new->type->name, xbt_strdup("1"), NULL);
}
return new;
}
container_t container = getContainerByName (resource);
type_t type = getVariableType (variable, NULL, container->type);
new_pajeSetVariable (now, container, type, 0);
- xbt_dict_set(platform_variables, resource, array,
- xbt_dynar_free_voidp);
+ xbt_dict_set(platform_variables, resource, array, NULL);
} else {
xbt_dynar_t array = xbt_dict_get(platform_variables, resource);
unsigned int i;
void TRACE_surf_resource_utilization_alloc()
{
- platform_variables = xbt_dict_new();
+ platform_variables = xbt_dict_new_homogeneous(xbt_dynar_free_voidp);
}
void TRACE_surf_resource_utilization_release()
if (xbt_dict_get_or_null (filter, aux2)) return;
//ok, not found, register it
- xbt_dict_set (filter, aux1, xbt_strdup ("1"), xbt_free);
- xbt_dict_set (filter, aux2, xbt_strdup ("1"), xbt_free);
+ xbt_dict_set (filter, aux1, xbt_strdup ("1"), NULL);
+ xbt_dict_set (filter, aux2, xbt_strdup ("1"), NULL);
}
//declare type
type_t link_type = getLinkType (link_typename, father->type, src->type, dst->type);
//register EDGE types for triva configuration
- xbt_dict_set (trivaEdgeTypes, link_type->name, xbt_strdup("1"), xbt_free);
+ xbt_dict_set (trivaEdgeTypes, link_type->name, xbt_strdup("1"), NULL);
//create the link
static long long counter = 0;
{
xbt_dynar_free(¤tContainer);
currentContainer = NULL;
- xbt_dict_t filter = xbt_dict_new ();
+ xbt_dict_t filter = xbt_dict_new_homogeneous(xbt_free);
recursiveGraphExtraction (global_routing->root, getRootContainer(), filter);
xbt_dict_free(&filter);
platform_created = 1;
xbt_graph_t instr_routing_platform_graph (void)
{
xbt_graph_t ret = xbt_graph_new_graph (0, NULL);
- xbt_dict_t nodes = xbt_dict_new ();
- xbt_dict_t edges = xbt_dict_new ();
+ xbt_dict_t nodes = xbt_dict_new_homogeneous(NULL);
+ xbt_dict_t edges = xbt_dict_new_homogeneous(NULL);
recursiveXBTGraphExtraction (ret, nodes, edges, global_routing->root, getRootContainer());
return ret;
}
xbt_dynar_t d = xbt_dict_get_or_null(keys, aux);
if (d == NULL) {
d = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
- xbt_dict_set(keys, aux, d, xbt_free);
+ xbt_dict_set(keys, aux, d, NULL);
}
//generate the key
static unsigned long long counter = 0;
if (xbt_dict_get_or_null (process_category, processid))
xbt_dict_remove (process_category, processid);
if (category != NULL)
- xbt_dict_set (process_category, processid, xbt_strdup(category), xbt_free);
+ xbt_dict_set (process_category, processid, xbt_strdup(category), NULL);
}
const char *TRACE_internal_smpi_get_category (void)
void TRACE_smpi_alloc()
{
- keys = xbt_dict_new();
- process_category = xbt_dict_new();
+ keys = xbt_dict_new_homogeneous(xbt_free);
+ process_category = xbt_dict_new_homogeneous(xbt_free);
}
void TRACE_smpi_start(void)
(*event)->resource_subsets = xbt_dynar_new(sizeof(jed_res_subset_t), NULL);
(*event)->characteristics_list = xbt_dynar_new(sizeof(char*), NULL);
- (*event)->info_hash = xbt_dict_new();
+ (*event)->info_hash = xbt_dict_new_homogeneous(NULL);
}
parent->is_lowest = 1;
xbt_dynar_free(&parent->container_children);
parent->container_children = NULL;
- parent->name2id = xbt_dict_new();
+ parent->name2id = xbt_dict_new_homogeneous(xbt_free);
parent->last_id = 0;
parent->resource_list = xbt_dynar_new(sizeof(char *), NULL);
xbt_dynar_foreach(host_names, iter, host_name) {
buf = bprintf("%d", parent->last_id);
(parent->last_id)++;
- xbt_dict_set(parent->name2id, host_name, buf, xbt_free);
+ xbt_dict_set(parent->name2id, host_name, buf, NULL);
xbt_dict_set(host2_simgrid_parent_container, host_name, parent, NULL);
xbt_dynar_push(parent->resource_list, &host_name);
}
unsigned int iter;
xbt_dict_t parent2hostgroup; // group hosts by parent
- parent2hostgroup = xbt_dict_new();
+ parent2hostgroup = xbt_dict_new_homogeneous(NULL);
xbt_assert( host_names != NULL );
void jed_create_jedule(jedule_t *jedule) {
*jedule = (jedule_t)calloc(1,sizeof(s_jedule_t));
- host2_simgrid_parent_container = xbt_dict_new();
- container_name2container = xbt_dict_new();
- (*jedule)->jedule_meta_info = xbt_dict_new();
+ 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);
}
void jed_free_jedule(jedule_t jedule) {
void _MSG_action_init()
{
- action_funs = xbt_dict_new();
- action_queues = xbt_dict_new();
+ action_funs = xbt_dict_new_homogeneous(NULL);
+ action_queues = xbt_dict_new_homogeneous(NULL);
MSG_function_register_default(MSG_action_runner);
}
if (path)
fclose(action_fp);
xbt_dict_free(&action_queues);
- action_queues = xbt_dict_new();
+ action_queues = xbt_dict_new_homogeneous(NULL);
return res;
}
dax_lineno = 1;
result = xbt_dynar_new(sizeof(SD_task_t), dax_task_free);
- files = xbt_dict_new();
- jobs = xbt_dict_new();
+ files = xbt_dict_new_homogeneous(&dax_task_free);
+ jobs = xbt_dict_new_homogeneous(NULL);
root_task = SD_task_create_comp_seq("root", NULL, 0);
/* by design the root task is always SCHEDULABLE */
__SD_task_set_state(root_task, SD_SCHEDULABLE);
file = xbt_dict_get_or_null(files, A_dax__uses_file);
if (file == NULL) {
file = SD_task_create_comm_e2e(A_dax__uses_file, NULL, size);
- xbt_dict_set(files, A_dax__uses_file, file, &dax_task_free);
+ xbt_dict_set(files, A_dax__uses_file, file, NULL);
} else {
if (SD_task_get_amount(file) != size) {
XBT_WARN("Ignoring file %s size redefinition from %.0f to %.0f",
dag_dot = agread(in_file, NIL(Agdisc_t *));
result = xbt_dynar_new(sizeof(SD_task_t), dot_task_free);
- files = xbt_dict_new();
- jobs = xbt_dict_new();
- computers = xbt_dict_new();
+ files = xbt_dict_new_homogeneous(&dot_task_free);
+ jobs = xbt_dict_new_homogeneous(NULL);
+ computers = xbt_dict_new_homogeneous(NULL);
root_task = SD_task_create_comp_seq("root", NULL, 0);
/* by design the root task is always SCHEDULABLE */
__SD_task_set_state(root_task, SD_SCHEDULABLE);
#ifdef HAVE_TRACING
TRACE_sd_dotloader (file, agget (edge, (char*)"category"));
#endif
- xbt_dict_set(files, name, file, &dot_task_free);
+ xbt_dict_set(files, name, file, NULL);
} else {
if (SD_task_get_amount(file) != size) {
XBT_WARN("Ignoring file %s size redefinition from %.0f to %.0f",
#ifdef HAVE_TRACING
TRACE_sd_dotloader (file, agget (edge, (char*)"category"));
#endif
- xbt_dict_set(files, name, file, &dot_task_free);
+ xbt_dict_set(files, name, file, NULL);
} else {
if (SD_task_get_amount(file) != size) {
XBT_WARN("Ignoring file %s size redefinition from %.0f to %.0f",
xbt_swag_new(xbt_swag_offset(proc, destroy_hookup));
simix_global->maestro_process = NULL;
- simix_global->registered_functions = xbt_dict_new();
+ simix_global->registered_functions = xbt_dict_new_homogeneous(NULL);
simix_global->create_process_function = SIMIX_process_create;
simix_global->kill_process_function = SIMIX_process_kill;
*/
xbt_dict_t SIMIX_host_get_dict(void)
{
- xbt_dict_t host_dict = xbt_dict_new();
+ xbt_dict_t host_dict = xbt_dict_new_homogeneous(NULL);
xbt_lib_cursor_t cursor = NULL;
char *name = NULL;
void **host = NULL;
xbt_lib_foreach(host_lib, cursor, name, host){
if(host[SIMIX_HOST_LEVEL])
- xbt_dict_set(host_dict,name,host[SIMIX_HOST_LEVEL],NULL);
+ xbt_dict_set(host_dict,name,host[SIMIX_HOST_LEVEL], NULL);
}
return host_dict;
}
void SIMIX_network_init(void)
{
- rdv_points = xbt_dict_new();
+ rdv_points = xbt_dict_new_homogeneous(SIMIX_rdv_free);
}
void SIMIX_network_exit(void)
rdv->comm_fifo = xbt_fifo_new();
if (rdv->name)
- xbt_dict_set(rdv_points, rdv->name, rdv, SIMIX_rdv_free);
+ xbt_dict_set(rdv_points, rdv->name, rdv, NULL);
}
return rdv;
}
smpi_bench_end(); /* Take time from previous MPI call into account */
if (!samples) {
- samples = xbt_dict_new();
+ samples = xbt_dict_new_homogeneous(free);
}
data = xbt_dict_get_or_null(samples, loc);
if (!data) {
data->iters = iters;
data->threshold = threshold;
data->started = 0;
- xbt_dict_set(samples, loc, data, &free);
+ xbt_dict_set(samples, loc, data, NULL);
return 0;
}
free(loc);
shared_data_t *data;
if (!allocs) {
- allocs = xbt_dict_new();
+ allocs = xbt_dict_new_homogeneous(free);
}
data = xbt_dict_get_or_null(allocs, loc);
if (!data) {
data = (shared_data_t *) xbt_malloc0(sizeof(int) + size);
data->count = 1;
- xbt_dict_set(allocs, loc, data, &free);
+ xbt_dict_set(allocs, loc, data, NULL);
} else {
data->count++;
}
int known;
if(!calls) {
- calls = xbt_dict_new();
+ calls = xbt_dict_new_homogeneous(NULL);
}
TRY {
xbt_dict_get(calls, loc); /* Succeed or throw */
void* data;
if(!calls) {
- calls = xbt_dict_new();
+ calls = xbt_dict_new_homogeneous(NULL);
}
data = xbt_dict_get(calls, loc);
free(loc);
char* loc = bprintf("%s:%s", func, input);
if(!calls) {
- calls = xbt_dict_new();
+ calls = xbt_dict_new_homogeneous(NULL);
}
xbt_dict_set(calls, loc, data, NULL);
free(loc);
comm_lookup = xbt_dynar_new(sizeof(MPI_Comm), NULL);
new_comm(MPI_COMM_WORLD);
- request_lookup = xbt_dict_new();
+ request_lookup = xbt_dict_new_homogeneous(NULL);
datatype_lookup = xbt_dynar_new(sizeof(MPI_Datatype), NULL);
new_datatype(MPI_BYTE);
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;
uint32_t totalBytes,
void * action)
{
- if(!dict_socket) dict_socket = xbt_dict_new();
+ if(!dict_socket) dict_socket = xbt_dict_new_homogeneous(free);
PacketSinkHelper sink ("ns3::TcpSocketFactory",
InetSocketAddress (Ipv4Address::GetAny(),
mysocket->action = action;
transformSocketPtr(sock);
- xbt_dict_set(dict_socket,socket_key, mysocket,free);
+ xbt_dict_set(dict_socket,socket_key, mysocket,NULL);
sock->Bind(InetSocketAddress(port_number));
XBT_DEBUG("Create flow starting to %fs + %fs = %fs",start-ns3_time(), ns3_time(), start);
if (strcmp(cluster->availability_trace, "")
|| strcmp(cluster->state_trace, "")) {
- patterns = xbt_dict_new();
- xbt_dict_set(patterns, "id", xbt_strdup(cluster->id), free);
- xbt_dict_set(patterns, "prefix", xbt_strdup(cluster->prefix), free);
- xbt_dict_set(patterns, "suffix", xbt_strdup(cluster->suffix), free);
+ patterns = xbt_dict_new_homogeneous(xbt_free_f);
+ xbt_dict_set(patterns, "id", xbt_strdup(cluster->id), NULL);
+ xbt_dict_set(patterns, "prefix", xbt_strdup(cluster->prefix), NULL);
+ xbt_dict_set(patterns, "suffix", xbt_strdup(cluster->suffix), NULL);
}
memset(&host, 0, sizeof(host));
host.id = host_id;
if (strcmp(cluster->availability_trace, "")) {
- xbt_dict_set(patterns, "radical", bprintf("%d", i), xbt_free);
+ xbt_dict_set(patterns, "radical", bprintf("%d", i), NULL);
char *avail_file = xbt_str_varsubst(cluster->availability_trace, patterns);
XBT_DEBUG("\tavailability_file=\"%s\"", avail_file);
host.power_trace = tmgr_trace_new(avail_file);
random->generator, random->seed, random_radical);
if (!random_value)
- random_value = xbt_dict_new();
+ random_value = xbt_dict_new_homogeneous(free);
if (!strcmp(random_radical, "")) {
res = random_generate(random);
rd_value = bprintf("%f", res);
- xbt_dict_set(random_value, random_id, rd_value, free);
+ xbt_dict_set(random_value, random_id, rd_value, NULL);
} else {
radical_elements = xbt_str_split(random_radical, ",");
xbt_dynar_foreach(radical_elements, iter, groups) {
tmpbuf =
bprintf("%s%d", random_id,
atoi(xbt_dynar_getfirst_as(radical_ends, char *)));
- xbt_dict_set(random_value, tmpbuf, bprintf("%f", res), free);
+ xbt_dict_set(random_value, tmpbuf, bprintf("%f", res), NULL);
xbt_free(tmpbuf);
break;
i));
res = random_generate(random);
tmpbuf = bprintf("%s%d", random_id, i);
- xbt_dict_set(random_value, tmpbuf, bprintf("%f", res), free);
+ xbt_dict_set(random_value, tmpbuf, bprintf("%f", res), NULL);
xbt_free(tmpbuf);
}
break;
res = random_generate(random);
rd_name = bprintf("%s_router", random_id);
rd_value = bprintf("%f", res);
- xbt_dict_set(random_value, rd_name, rd_value, free);
+ xbt_dict_set(random_value, rd_name, rd_value, NULL);
xbt_dynar_free(&radical_ends);
}
void surf_routing_cluster_add_link(const char* host_id,surf_parsing_link_up_down_t info) {
if(!cluster_host_link)
- cluster_host_link = xbt_dict_new();
+ cluster_host_link = xbt_dict_new_homogeneous(xbt_free);
- xbt_dict_set(cluster_host_link,host_id,info,xbt_free);
+ xbt_dict_set(cluster_host_link,host_id,info,NULL);
}
void surf_routing_cluster_add_backbone(AS_t as, void* bb) {
elm = xbt_new0(struct graph_node_map_element, 1);
elm->node = node;
xbt_dict_set_ext(as->graph_node_map, (char *) (&id), sizeof(int),
- (xbt_set_elm_t) elm, &graph_node_map_elem_free);
+ (xbt_set_elm_t) elm, NULL);
return node;
}
elm->pred_arr = pred_arr;
elm->size = size;
xbt_dict_set_ext(as->route_cache, (char *) (&src_id), sizeof(int),
- (xbt_set_elm_t) elm, &route_cache_elem_free);
+ (xbt_set_elm_t) elm, NULL);
}
if (!as->cached)
if(!THIS->route_graph)
THIS->route_graph = xbt_graph_new_graph(1, NULL);
if(!THIS->graph_node_map)
- THIS->graph_node_map = xbt_dict_new();
+ THIS->graph_node_map = xbt_dict_new_homogeneous(&graph_node_map_elem_free);
if (THIS->cached && !THIS->route_cache)
- THIS->route_cache = xbt_dict_new();
+ THIS->route_cache = xbt_dict_new_homogeneous(&route_cache_elem_free);
/* Add the loopback if needed */
if (as->hierarchy == SURF_ROUTING_BASE)
if(!as->route_graph)
as->route_graph = xbt_graph_new_graph(1, NULL);
if(!as->graph_node_map)
- as->graph_node_map = xbt_dict_new();
+ as->graph_node_map = xbt_dict_new_homogeneous(&graph_node_map_elem_free);
if (as->cached && !as->route_cache)
- as->route_cache = xbt_dict_new();
+ as->route_cache = xbt_dict_new_homogeneous(&route_cache_elem_free);
if( A_surfxml_route_symmetrical == A_surfxml_route_symmetrical_YES
|| A_surfxml_ASroute_symmetrical == A_surfxml_ASroute_symmetrical_YES )
generic_get_bypassroute;
new_component->finalize = model_generic_finalize;
- new_component->to_index = xbt_dict_new();
- new_component->bypassRoutes = xbt_dict_new();
+ new_component->to_index = xbt_dict_new_homogeneous(xbt_free);
+ new_component->bypassRoutes = xbt_dict_new_homogeneous((void (*)(void *)) generic_free_route);
return new_component;
}
xbt_dict_t _to_index;
_to_index = as->to_index;
*id = xbt_dict_length(_to_index);
- xbt_dict_set(_to_index, name, id, xbt_free);
+ xbt_dict_set(_to_index, name, id, NULL);
}
void generic_parse_AS(AS_t as, const char *name)
xbt_dict_t _to_index;
_to_index = as->to_index;
*id = xbt_dict_length(_to_index);
- xbt_dict_set(_to_index, name, id, xbt_free);
+ xbt_dict_set(_to_index, name, id, NULL);
}
void generic_parse_bypassroute(AS_t rc,
xbt_dynar_free(&(e_route->link_list));
xbt_free(e_route);
- xbt_dict_set(dict_bypassRoutes, route_name, new_e_route,
- (void (*)(void *)) generic_free_route);
+ xbt_dict_set(dict_bypassRoutes, route_name, new_e_route, NULL);
xbt_free(route_name);
}
new_component->get_bypass_route = none_get_bypass_route;
new_component->finalize = model_none_finalize;
- new_component->routing_sons = xbt_dict_new();
+ new_component->routing_sons = xbt_dict_new_homogeneous(NULL);
return new_component;
}
static void model_rulebased_parse_AS(AS_t rc, const char *name)
{
AS_rulebased_t routing = (AS_rulebased_t) rc;
- xbt_dict_set(routing->dict_autonomous_systems, name, (void *) (-1),
- NULL);
+ xbt_dict_set(routing->dict_autonomous_systems, name, (void *) (-1), NULL);
}
static void model_rulebased_parse_route(AS_t rc,
new_component->generic_routing.get_bypass_route = rulebased_get_bypass_route;
new_component->generic_routing.finalize = rulebased_finalize;
/* initialization of internal structures */
- new_component->dict_processing_units = xbt_dict_new();
- new_component->dict_autonomous_systems = xbt_dict_new();
+ new_component->dict_processing_units = xbt_dict_new_homogeneous(NULL);
+ new_component->dict_autonomous_systems = xbt_dict_new_homogeneous(NULL);
new_component->list_route = xbt_dynar_new(sizeof(rule_route_t), &rule_route_free);
new_component->list_ASroute =
xbt_dynar_new(sizeof(rule_route_extended_t),
memset(&host,0,sizeof(host));
xbt_assert(current_property_set == NULL, "Someone forgot to reset the property set to NULL in its closing tag (or XML malformed)");
- host.properties = current_property_set = xbt_dict_new();
+ host.properties = current_property_set = xbt_dict_new_homogeneous(xbt_free_f);
host.id = A_surfxml_host_id;
host.power_peak = get_cpu_power(A_surfxml_host_power);
memset(&link,0,sizeof(link));
xbt_assert(current_property_set == NULL, "Someone forgot to reset the property set to NULL in its closing tag (or XML malformed)");
- link.properties = current_property_set = xbt_dict_new();
+ link.properties = current_property_set = xbt_dict_new_homogeneous(xbt_free_f);
link.id = A_surfxml_link_id;
link.bandwidth = surf_parse_get_double(A_surfxml_link_bandwidth);
void STag_surfxml_config(void){
XBT_DEBUG("START configuration name = %s",A_surfxml_config_id);
xbt_assert(current_property_set == NULL, "Someone forgot to reset the property set to NULL in its closing tag (or XML malformed)");
- current_property_set = xbt_dict_new();
+ current_property_set = xbt_dict_new_homogeneous(xbt_free_f);
}
void ETag_surfxml_config(void){
void parse_properties(void)
{
if (!current_property_set)
- current_property_set = xbt_dict_new(); // Maybe, it should raise an error
+ current_property_set = xbt_dict_new_homogeneous(xbt_free_f); // Maybe, it should raise an error
- xbt_dict_set(current_property_set, A_surfxml_prop_id, xbt_strdup(A_surfxml_prop_value), free);
+ xbt_dict_set(current_property_set, A_surfxml_prop_id, xbt_strdup(A_surfxml_prop_value), NULL);
}
case A_surfxml_trace_connect_kind_HOST_AVAIL:
xbt_dict_set(trace_connect_list_host_avail,
A_surfxml_trace_connect_trace,
- xbt_strdup(A_surfxml_trace_connect_element), free);
+ xbt_strdup(A_surfxml_trace_connect_element), NULL);
break;
case A_surfxml_trace_connect_kind_POWER:
xbt_dict_set(trace_connect_list_power, A_surfxml_trace_connect_trace,
- xbt_strdup(A_surfxml_trace_connect_element), free);
+ xbt_strdup(A_surfxml_trace_connect_element), NULL);
break;
case A_surfxml_trace_connect_kind_LINK_AVAIL:
xbt_dict_set(trace_connect_list_link_avail,
A_surfxml_trace_connect_trace,
- xbt_strdup(A_surfxml_trace_connect_element), free);
+ xbt_strdup(A_surfxml_trace_connect_element), NULL);
break;
case A_surfxml_trace_connect_kind_BANDWIDTH:
xbt_dict_set(trace_connect_list_bandwidth,
A_surfxml_trace_connect_trace,
- xbt_strdup(A_surfxml_trace_connect_element), free);
+ xbt_strdup(A_surfxml_trace_connect_element), NULL);
break;
case A_surfxml_trace_connect_kind_LATENCY:
xbt_dict_set(trace_connect_list_latency, A_surfxml_trace_connect_trace,
- xbt_strdup(A_surfxml_trace_connect_element), free);
+ xbt_strdup(A_surfxml_trace_connect_element), NULL);
break;
default:
xbt_die("Cannot connect trace %s to %s: kind of trace unknown",
if (!surfxml_bufferstack_stack)
surfxml_bufferstack_stack = xbt_dynar_new(sizeof(char *), NULL);
- traces_set_list = xbt_dict_new();
- trace_connect_list_host_avail = xbt_dict_new();
- trace_connect_list_power = xbt_dict_new();
- trace_connect_list_link_avail = xbt_dict_new();
- trace_connect_list_bandwidth = xbt_dict_new();
- trace_connect_list_latency = xbt_dict_new();
+ traces_set_list = xbt_dict_new_homogeneous(NULL);
+ trace_connect_list_host_avail = xbt_dict_new_homogeneous(free);
+ trace_connect_list_power = xbt_dict_new_homogeneous(free);
+ trace_connect_list_link_avail = xbt_dict_new_homogeneous(free);
+ trace_connect_list_bandwidth = xbt_dict_new_homogeneous(free);
+ trace_connect_list_latency = xbt_dict_new_homogeneous(free);
surfxml_add_callback(STag_surfxml_trace_cb_list, &parse_Stag_trace);
surfxml_add_callback(ETag_surfxml_trace_cb_list, &parse_Etag_trace);
last_event->delta = periodicity;
if (!trace_list)
- trace_list = xbt_dict_new();
+ trace_list = xbt_dict_new_homogeneous((void (*)(void *)) tmgr_trace_free);
- xbt_dict_set(trace_list, id, (void *) trace,
- (void (*)(void *)) tmgr_trace_free);
+ xbt_dict_set(trace_list, id, (void *) trace, NULL);
xbt_dynar_free(&list);
return trace;
double latency = 0.0;
if (ptask_parallel_task_link_set == NULL)
- ptask_parallel_task_link_set = xbt_dict_new();
+ ptask_parallel_task_link_set = xbt_dict_new_homogeneous(NULL);
xbt_dict_reset(ptask_parallel_task_link_set);
xbt_cfg_t xbt_cfg_new(void)
{
- return (xbt_cfg_t) xbt_dict_new();
+ return (xbt_cfg_t) xbt_dict_new_homogeneous(&xbt_cfgelm_free);
}
/** \brief Copy an existing configuration set
XBT_ERROR("%d is an invalide type code", type);
}
- xbt_dict_set((xbt_dict_t) * cfg, name, res, &xbt_cfgelm_free);
+ xbt_dict_set((xbt_dict_t) * cfg, name, res, NULL);
}
/** @brief Unregister an element from a config set.
else
parsed_graph = xbt_graph_new_graph(0, NULL);
- parsed_nodes = xbt_dict_new();
+ parsed_nodes = xbt_dict_new_homogeneous(NULL);
}
static void __parse_graph_end(void)
file = fopen (filename, "r");
xbt_assert(file, "Failed to open %s \n", filename);
- xbt_dict_t nodes_dict = xbt_dict_new ();
+ xbt_dict_t nodes_dict = xbt_dict_new_homogeneous(NULL);
xbt_graph_t ret = xbt_graph_new_graph (0, NULL);
//read the number of nodes
char *str; /*foreach */
xbt_strbuff_t sb; /* what we test */
- p = xbt_dict_new();
+ p = xbt_dict_new_homogeneous(free);
dyn_patterns = xbt_str_split(patterns, " ");
xbt_dynar_foreach(dyn_patterns, cpt, str) {
xbt_dynar_t keyvals = xbt_str_split(str, "=");
char *key = xbt_dynar_get_as(keyvals, 0, char *);
char *val = xbt_dynar_get_as(keyvals, 1, char *);
xbt_str_subst(key, '_', ' ', 0); // to put space in names without breaking the enclosing dynar_foreach
- xbt_dict_set(p, key, xbt_strdup(val), free);
+ xbt_dict_set(p, key, xbt_strdup(val), NULL);
xbt_dynar_free(&keyvals);
}
xbt_dynar_free(&dyn_patterns);
static void parse_process_init(void)
{
- xbt_dict_set(process_function_set, A_surfxml_process_function, NULL,
- NULL);
+ xbt_dict_set(process_function_set, A_surfxml_process_function, NULL, NULL);
xbt_dict_set(machine_set, A_surfxml_process_host, NULL, NULL);
process.argc = 1;
process.argv = xbt_new(char *, 1);
int i;
surf_init(&argc, argv);
- process_function_set = xbt_dict_new();
+ process_function_set = xbt_dict_new_homogeneous(NULL);
process_list = xbt_dynar_new(sizeof(s_process_t), s_process_free);
- machine_set = xbt_dict_new();
+ machine_set = xbt_dict_new_homogeneous(NULL);
for (i = 1; i < argc; i++) {
int need_removal = 0;
int len = strlen("setenv ");
char *eq = strchr(line + len, '=');
char *key = bprintf("%.*s", (int) (eq - line - len), line + len);
- xbt_dict_set(env, key, xbt_strdup(eq + 1), xbt_free_f);
+ xbt_dict_set(env, key, xbt_strdup(eq + 1), NULL);
free(key);
rctx->env = realloc(rctx->env, ++(rctx->env_size) * sizeof(char *));
int i;
char *eq = NULL;
char *key = NULL;
- env = xbt_dict_new();
+ env = xbt_dict_new_homogeneous(xbt_free_f);
for (i = 0; environ[i]; i++) {
p = environ[i];
eq = strchr(p, '=');
key = bprintf("%.*s", (int) (eq - p), p);
- xbt_dict_set(env, key, xbt_strdup(eq + 1), xbt_free_f);
+ xbt_dict_set(env, key, xbt_strdup(eq + 1), NULL);
free(key);
}
}
char *eq = strchr(argv[i+1], '=');
xbt_assert(eq,"The argument of --setenv must contain a '=' (got %s instead)",argv[i+1]);
char *key = bprintf("%.*s", (int) (eq - argv[i+1]), argv[i+1]);
- xbt_dict_set(env, key, xbt_strdup(eq + 1), xbt_free_f);
+ xbt_dict_set(env, key, xbt_strdup(eq + 1), NULL);
XBT_INFO("setting environment variable '%s' to '%s'", key, eq+1);
free(key);
memmove(argv + i, argv + i + 2, (argc - i - 1) * sizeof(char *));