Use xbt_free_f everywhere a pointer to function is needed.
XBT_INFO(" Property: %s old value: %s", exist, value);
XBT_INFO("== Trying to modify a host property");
- MSG_host_set_property_value(thehost, exist, xbt_strdup("250"), xbt_free);
+ MSG_host_set_property_value(thehost, exist, xbt_strdup("250"), xbt_free_f);
/* Test if we have changed the value */
value = MSG_host_get_property_value(thehost, exist);
XBT_INFO(" Property: %s old value: %s", exist, value);
/* Restore the value for the next test */
- MSG_host_set_property_value(thehost, exist, xbt_strdup("180"), xbt_free);
+ MSG_host_set_property_value(thehost, exist, xbt_strdup("180"), xbt_free_f);
}
int alice(int argc, char *argv[]) { /* Dump what we have on the current host */
/* Trying to set a new property */
- xbt_dict_set(props, "NewProp", strdup("newValue"), xbt_free);
+ xbt_dict_set(props, "NewProp", strdup("newValue"), xbt_free_f);
/* 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"), xbt_free);
+ xbt_dict_set(props, exist, strdup("250"), xbt_free_f);
}
/* Test if we have changed the value */
static type *name = NULL; \
if(!name) { \
name = (type*)calloc(smpi_global_size(), sizeof(type)); \
- smpi_register_static(name, xbt_free); \
+ smpi_register_static(name, xbt_free_f); \
}
#define SMPI_VARINIT_STATIC_AND_SET(name,type,expr) \
for(i = 0; i < size; i++) { \
name[i] = value; \
} \
- smpi_register_static(name, xbt_free); \
+ smpi_register_static(name, xbt_free_f); \
}
#define SMPI_VARGET_STATIC(name) name[smpi_process_index()]
/** @brief like free
@hideinitializer */
-#define xbt_free free /*nothing specific to do here. A poor valgrind replacement? */
+#define xbt_free(p) free(p) /*nothing specific to do here. A poor valgrind replacement? */
/** @brief like free, but you can be sure that it is a function */
XBT_PUBLIC(void) xbt_free_f(void *p);
const char *value_java = (*env)->GetStringUTFChars(env, jvalue, 0);
char *value = strdup(value_java);
- MSG_host_set_property_value(host,name,value,xbt_free);
+ MSG_host_set_property_value(host, name, value, xbt_free_f);
(*env)->ReleaseStringUTFChars(env, jvalue, value);
(*env)->ReleaseStringUTFChars(env, jname, name);
XBT_DEBUG("Tracing is on");
/* other trace initialization */
- created_categories = xbt_dict_new_homogeneous(xbt_free);
- declared_marks = xbt_dict_new_homogeneous(xbt_free);
- user_host_variables = xbt_dict_new_homogeneous(xbt_free);
- user_vm_variables = xbt_dict_new_homogeneous (xbt_free);
- user_link_variables = xbt_dict_new_homogeneous(xbt_free);
+ created_categories = xbt_dict_new_homogeneous(xbt_free_f);
+ declared_marks = xbt_dict_new_homogeneous(xbt_free_f);
+ user_host_variables = xbt_dict_new_homogeneous(xbt_free_f);
+ user_vm_variables = xbt_dict_new_homogeneous(xbt_free_f);
+ user_link_variables = xbt_dict_new_homogeneous(xbt_free_f);
if (TRACE_start_functions != NULL) {
void (*func) ();
xbt_graph_t g = instr_routing_platform_graph();
if (g == NULL) return 0;
instr_routing_platform_graph_export_graphviz (g, filename);
- xbt_graph_free_graph (g, xbt_free, xbt_free, NULL);
+ xbt_graph_free_graph(g, xbt_free_f, xbt_free_f, NULL);
return 1;
}
void PJ_container_alloc (void)
{
allContainers = xbt_dict_new_homogeneous(NULL);
- trivaNodeTypes = xbt_dict_new_homogeneous(xbt_free);
- trivaEdgeTypes = xbt_dict_new_homogeneous(xbt_free);
+ trivaNodeTypes = xbt_dict_new_homogeneous(xbt_free_f);
+ trivaEdgeTypes = xbt_dict_new_homogeneous(xbt_free_f);
}
void PJ_container_release (void)
parent->is_lowest = 1;
xbt_dynar_free(&parent->container_children);
parent->container_children = NULL;
- parent->name2id = xbt_dict_new_homogeneous(xbt_free);
+ parent->name2id = xbt_dict_new_homogeneous(xbt_free_f);
parent->last_id = 0;
parent->resource_list = xbt_dynar_new(sizeof(char *), NULL);
void TRACE_smpi_alloc()
{
keys = xbt_dict_new_homogeneous(xbt_dynar_free_voidp);
- process_category = xbt_dict_new_homogeneous(xbt_free);
+ process_category = xbt_dict_new_homogeneous(xbt_free_f);
}
void TRACE_smpi_release(void)
simcall_comm_isend(mailbox, request->size, -1.0,
buf, request->real_size,
&match_send,
- &xbt_free, // how to free the userdata if a detached send fails
+ &xbt_free_f, // how to free the userdata if a detached send fails
&smpi_comm_copy_buffer_callback,
request,
// detach if msg size < eager/rdv switch limit
xbt_die("Could not map fd %d: %s", fd, strerror(errno));
}
if(!allocs_metadata) {
- allocs_metadata = xbt_dict_new_homogeneous(xbt_free);
+ allocs_metadata = xbt_dict_new_homogeneous(xbt_free_f);
}
snprintf(loc, PTR_STRLEN, "%p", mem);
meta = xbt_new(shared_metadata_t, 1);
process_count+=num_processes;
if(!smpi_instances){
- smpi_instances=xbt_dict_new_homogeneous(xbt_free);
+ smpi_instances = xbt_dict_new_homogeneous(xbt_free_f);
}
xbt_dict_set(smpi_instances, name, (void*)instance, NULL);
}
xbt_dict_free (&nodes);
xbt_dict_free (&edges);
- xbt_graph_free_graph(graph,xbt_free, xbt_free, NULL);
+ xbt_graph_free_graph(graph, xbt_free_f, xbt_free_f, NULL);
}
}
{
xbt_dynar_free(¤tContainer);
currentContainer = NULL;
- xbt_dict_t filter = xbt_dict_new_homogeneous(xbt_free);
+ xbt_dict_t filter = xbt_dict_new_homogeneous(xbt_free_f);
XBT_DEBUG ("Starting graph extraction.");
recursiveGraphExtraction (surf_platf_get_root(routing_platf), PJ_container_get_root(), filter);
XBT_DEBUG ("Graph extraction finished.");
}
//Delete edges from the graph
xbt_dynar_foreach(dynar_edges_cpy, i, graph_edge) {
- xbt_graph_free_edge(platform_graph, graph_edge, xbt_free);
+ xbt_graph_free_edge(platform_graph, graph_edge, xbt_free_f);
}
//remove the dynar copy
xbt_dynar_free(&dynar_edges_cpy);
if ((!filename) || (strcmp(filename, "") == 0))
return NULL;
- xbt_dict_t parse_content = xbt_dict_new_homogeneous(xbt_free);
+ xbt_dict_t parse_content = xbt_dict_new_homogeneous(xbt_free_f);
FILE *file = NULL;
file = surf_fopen(filename, "r");
void storage_register_callbacks() {
- ROUTING_STORAGE_LEVEL = xbt_lib_add_level(storage_lib,xbt_free);
+ ROUTING_STORAGE_LEVEL = xbt_lib_add_level(storage_lib, xbt_free_f);
ROUTING_STORAGE_HOST_LEVEL = xbt_lib_add_level(storage_lib, routing_storage_host_free);
ROUTING_STORAGE_TYPE_LEVEL = xbt_lib_add_level(storage_type_lib, routing_storage_type_free);
SURF_STORAGE_LEVEL = xbt_lib_add_level(storage_lib, surf_storage_resource_free);
xbt_dynar_t RoutingPlatf::recursiveGetOneLinkRoutes(AsPtr rc)
{
- xbt_dynar_t ret = xbt_dynar_new(sizeof(OnelinkPtr), xbt_free);
+ xbt_dynar_t ret = xbt_dynar_new(sizeof(OnelinkPtr), xbt_free_f);
//adding my one link routes
xbt_dynar_t onelink_mine = rc->getOneLinkRoutes();
xbt_dynar_t AsDijkstra::getOnelinkRoutes()
{
- xbt_dynar_t ret = xbt_dynar_new(sizeof(OnelinkPtr), xbt_free);
+ xbt_dynar_t ret = xbt_dynar_new(sizeof(OnelinkPtr), xbt_free_f);
sg_platf_route_cbarg_t route = xbt_new0(s_sg_platf_route_cbarg_t,1);
route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t),NULL);
int nr_nodes = xbt_dynar_length(nodes);
cost_arr = xbt_new0(double, nr_nodes); /* link cost from src to other hosts */
pred_arr = xbt_new0(int, nr_nodes); /* predecessors in path from src */
- pqueue = xbt_heap_new(nr_nodes, xbt_free);
+ pqueue = xbt_heap_new(nr_nodes, xbt_free_f);
/* initialize */
cost_arr[src_node_id] = 0.0;
AsDijkstra::~AsDijkstra()
{
- xbt_graph_free_graph(p_routeGraph, &xbt_free,
- &graph_edge_data_free, &xbt_free);
+ xbt_graph_free_graph(p_routeGraph, &xbt_free_f,
+ &graph_edge_data_free, &xbt_free_f);
xbt_dict_free(&p_graphNodeMap);
if (m_cached)
xbt_dict_free(&p_routeCache);
/* Business methods */
xbt_dynar_t AsFloyd::getOneLinkRoutes()
{
- xbt_dynar_t ret = xbt_dynar_new(sizeof(OnelinkPtr), xbt_free);
+ xbt_dynar_t ret = xbt_dynar_new(sizeof(OnelinkPtr), xbt_free_f);
sg_platf_route_cbarg_t route = xbt_new0(s_sg_platf_route_cbarg_t, 1);
route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
xbt_dynar_t AsFull::getOneLinkRoutes()
{
- xbt_dynar_t ret = xbt_dynar_new(sizeof(OnelinkPtr), xbt_free);
+ xbt_dynar_t ret = xbt_dynar_new(sizeof(OnelinkPtr), xbt_free_f);
int src, dst;
int table_size = xbt_dynar_length(p_indexNetworkElm);
else{
if (!current_property_set)
current_property_set = xbt_dict_new(); // Maybe, it should raise an error
- xbt_dict_set(current_property_set, A_surfxml_prop_id, xbt_strdup(A_surfxml_prop_value), xbt_free);
+ xbt_dict_set(current_property_set, A_surfxml_prop_id, xbt_strdup(A_surfxml_prop_value), xbt_free_f);
}
}
{
xbt_lib_t lib;
lib = xbt_new(s_xbt_lib_t, 1);
- lib->dict = xbt_dict_new_homogeneous(xbt_free);
+ lib->dict = xbt_dict_new_homogeneous(xbt_free_f);
lib->levels = 0;
lib->free_f = NULL;
return lib;
msg_storage_t storage;
xbt_dynar_foreach(storages, cursor, storage){
XBT_INFO("Storage %s is attached to %s", MSG_storage_get_name(storage), MSG_storage_get_host(storage));
- MSG_storage_set_property_value(storage, "other usage", xbt_strdup("gpfs"), xbt_free);
+ MSG_storage_set_property_value(storage, "other usage", xbt_strdup("gpfs"), xbt_free_f);
}
xbt_dynar_free(&storages);
}