From: Arnaud Giersch Date: Thu, 12 Oct 2017 14:50:38 +0000 (+0200) Subject: Another bunch of s/malloc/new/. X-Git-Tag: v3.18~478^2~4 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/ca280be5e4f894c66ac254d445962c96a34cbe45 Another bunch of s/malloc/new/. --- diff --git a/src/bindings/java/jmsg_comm.cpp b/src/bindings/java/jmsg_comm.cpp index d3e412790a..da8c34d658 100644 --- a/src/bindings/java/jmsg_comm.cpp +++ b/src/bindings/java/jmsg_comm.cpp @@ -65,7 +65,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Comm_nativeFinalize(JNIEnv *env, job msg_task_t *task_received; task_received = (msg_task_t*) (uintptr_t) env->GetLongField(jcomm, jcomm_field_Comm_taskBind); - xbt_free(task_received); + delete task_received; comm = (msg_comm_t) (uintptr_t) env->GetLongField(jcomm, jcomm_field_Comm_bind); MSG_comm_destroy(comm); @@ -123,7 +123,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Comm_waitCompletion(JNIEnv *env, job static msg_comm_t* jarray_to_commArray(JNIEnv *env, jobjectArray jcomms, /* OUT */ int *count) { *count = env->GetArrayLength(jcomms); - msg_comm_t* comms = xbt_new(msg_comm_t, *count); + msg_comm_t* comms = new msg_comm_t[*count]; for (int i=0; i < *count; i++) { jobject jcomm = env->GetObjectArrayElement(jcomms, i); @@ -148,7 +148,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Comm_waitAll(JNIEnv *env, jclass cls return; MSG_comm_waitall(comms, count, static_cast(timeout)); - xbt_free(comms); + delete[] comms; } JNIEXPORT int JNICALL Java_org_simgrid_msg_Comm_waitAny(JNIEnv *env, jclass cls, jobjectArray jcomms) { @@ -162,7 +162,7 @@ JNIEXPORT int JNICALL Java_org_simgrid_msg_Comm_waitAny(JNIEnv *env, jclass cls, } int rank = MSG_comm_waitany(dyn); - xbt_free(comms); + delete[] comms; xbt_dynar_free(&dyn); return rank; } diff --git a/src/bindings/java/jmsg_task.cpp b/src/bindings/java/jmsg_task.cpp index 7a473f6290..add3877580 100644 --- a/src/bindings/java/jmsg_task.cpp +++ b/src/bindings/java/jmsg_task.cpp @@ -76,7 +76,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_parallelCreate(JNIEnv * env, jo int host_count = static_cast(env->GetArrayLength(jhosts)); jdouble* jcomputeDurations = env->GetDoubleArrayElements(jcomputeDurations_arg, 0); - msg_host_t* hosts = xbt_new0(msg_host_t, host_count); + msg_host_t* hosts = new msg_host_t[host_count]; double* computeDurations = xbt_new0(double, host_count); for (int index = 0; index < host_count; index++) { jobject jhost = env->GetObjectArrayElement(jhosts, index); @@ -99,6 +99,8 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_parallelCreate(JNIEnv * env, jo /* associate the java task object and the native task */ jtask_bind(jtask, task, env); + + delete[] hosts; } JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_cancel(JNIEnv * env, jobject jtask) @@ -303,8 +305,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_irecv(JNIEnv * env, jclass c return nullptr; //pointer to store the task object pointer. - msg_task_t *task = xbt_new(msg_task_t,1); - *task = nullptr; + msg_task_t* task = new msg_task_t(nullptr); /* There should be a cache here */ jobject jcomm = env->NewObject(comm_class, jtask_method_Comm_constructor); @@ -358,7 +359,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_irecvBounded(JNIEnv * env, j return nullptr; // pointer to store the task object pointer. - msg_task_t* task = xbt_new0(msg_task_t, 1); + msg_task_t* task = new msg_task_t(nullptr); jobject jcomm = env->NewObject(comm_class, jtask_method_Comm_constructor); if (not jcomm) { diff --git a/src/kernel/context/ContextRaw.cpp b/src/kernel/context/ContextRaw.cpp index 1df1de7fdb..1cd6340932 100644 --- a/src/kernel/context/ContextRaw.cpp +++ b/src/kernel/context/ContextRaw.cpp @@ -267,7 +267,7 @@ RawContextFactory::RawContextFactory() xbt_os_thread_key_create(&raw_worker_id_key); // TODO, lazily init raw_parmap = nullptr; - raw_workers_context = xbt_new(RawContext*, nthreads); + raw_workers_context = new RawContext*[nthreads]; raw_maestro_context = nullptr; #endif // TODO: choose dynamically when SIMIX_context_get_parallel_threshold() > 1 @@ -278,7 +278,7 @@ RawContextFactory::~RawContextFactory() { #if HAVE_THREAD_CONTEXTS delete raw_parmap; - xbt_free(raw_workers_context); + delete[] raw_workers_context; #endif } @@ -408,7 +408,7 @@ void RawContext::suspend_parallel() XBT_DEBUG("No more processes to run"); uintptr_t worker_id = (uintptr_t) xbt_os_thread_get_specific(raw_worker_id_key); - next_context = static_cast(raw_workers_context[worker_id]); + next_context = raw_workers_context[worker_id]; XBT_DEBUG("Restoring worker stack %zu (working threads = %zu)", worker_id, raw_threads_working); } diff --git a/src/kernel/context/ContextUnix.cpp b/src/kernel/context/ContextUnix.cpp index ae143b8a7e..26d629d654 100644 --- a/src/kernel/context/ContextUnix.cpp +++ b/src/kernel/context/ContextUnix.cpp @@ -130,7 +130,7 @@ UContextFactory::UContextFactory() : ContextFactory("UContextFactory") #if HAVE_THREAD_CONTEXTS /* To use parallel ucontexts a thread pool is needed */ int nthreads = SIMIX_context_get_nthreads(); sysv_parmap = nullptr; - sysv_workers_context = xbt_new(ParallelUContext*, nthreads); + sysv_workers_context = new ParallelUContext*[nthreads]; sysv_maestro_context = nullptr; xbt_os_thread_key_create(&sysv_worker_id_key); #else @@ -145,7 +145,7 @@ UContextFactory::~UContextFactory() { #if HAVE_THREAD_CONTEXTS delete sysv_parmap; - xbt_free(sysv_workers_context); + delete[] sysv_workers_context; #endif } diff --git a/src/kernel/routing/DijkstraZone.cpp b/src/kernel/routing/DijkstraZone.cpp index cf1dc01577..3cb87afd6e 100644 --- a/src/kernel/routing/DijkstraZone.cpp +++ b/src/kernel/routing/DijkstraZone.cpp @@ -13,12 +13,18 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_dijkstra, surf, "Routing part of surf /* Free functions */ +static void graph_node_data_free(void* n) +{ + graph_node_data_t data = static_cast(n); + delete data; +} + static void graph_edge_data_free(void* e) // FIXME: useless code duplication { - sg_platf_route_cbarg_t e_route = (sg_platf_route_cbarg_t)e; + sg_platf_route_cbarg_t e_route = static_cast(e); if (e_route) { delete e_route->link_list; - xbt_free(e_route); + delete e_route; } } @@ -51,7 +57,7 @@ void DijkstraZone::seal() } if (not found) { - sg_platf_route_cbarg_t e_route = xbt_new0(s_sg_platf_route_cbarg_t, 1); + sg_platf_route_cbarg_t e_route = new s_sg_platf_route_cbarg_t; e_route->link_list = new std::vector(); e_route->link_list->push_back(surf_network_model->loopback_); xbt_graph_new_edge(routeGraph_, node, node, e_route); @@ -63,19 +69,19 @@ void DijkstraZone::seal() xbt_dynar_t nodes = xbt_graph_get_nodes(routeGraph_); xbt_dynar_foreach (nodes, cursor, node) { - graph_node_data_t data = (graph_node_data_t)xbt_graph_node_get_data(node); + graph_node_data_t data = static_cast(xbt_graph_node_get_data(node)); data->graph_id = cursor; } } xbt_node_t DijkstraZone::routeGraphNewNode(int id, int graph_id) { - graph_node_data_t data = xbt_new0(s_graph_node_data_t, 1); + graph_node_data_t data = new s_graph_node_data_t; data->id = id; data->graph_id = graph_id; xbt_node_t node = xbt_graph_new_node(routeGraph_, data); - graph_node_map_element_t elm = xbt_new0(s_graph_node_map_element_t, 1); + graph_node_map_element_t elm = new s_graph_node_map_element_t; elm->node = node; graphNodeMap_.insert({id, elm}); @@ -136,8 +142,8 @@ void DijkstraZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cb graph_node_map_element_t src_elm = nodeMapSearch(src_id); graph_node_map_element_t dst_elm = nodeMapSearch(dst_id); - int src_node_id = ((graph_node_data_t)xbt_graph_node_get_data(src_elm->node))->graph_id; - int dst_node_id = ((graph_node_data_t)xbt_graph_node_get_data(dst_elm->node))->graph_id; + int src_node_id = static_cast(xbt_graph_node_get_data(src_elm->node))->graph_id; + int dst_node_id = static_cast(xbt_graph_node_get_data(dst_elm->node))->graph_id; /* if the src and dst are the same */ if (src_node_id == dst_node_id) { @@ -149,7 +155,7 @@ void DijkstraZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cb if (edge == nullptr) THROWF(arg_error, 0, "No route from '%s' to '%s'", src->name().c_str(), dst->name().c_str()); - sg_platf_route_cbarg_t e_route = (sg_platf_route_cbarg_t)xbt_graph_edge_get_data(edge); + sg_platf_route_cbarg_t e_route = static_cast(xbt_graph_edge_get_data(edge)); for (auto const& link : *e_route->link_list) { route->link_list->insert(route->link_list->begin(), link); @@ -169,9 +175,9 @@ void DijkstraZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cb } else { /* not cached mode, or cache miss */ int nr_nodes = xbt_dynar_length(nodes); - double* 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 */ - xbt_heap_t pqueue = xbt_heap_new(nr_nodes, xbt_free_f); + double* cost_arr = new double[nr_nodes]; /* link cost from src to other hosts */ + pred_arr = new int[nr_nodes]; /* predecessors in path from src */ + xbt_heap_t pqueue = xbt_heap_new(nr_nodes, nullptr); /* initialize */ cost_arr[src_node_id] = 0.0; @@ -184,8 +190,7 @@ void DijkstraZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cb pred_arr[i] = 0; /* initialize priority queue */ - int* nodeid = xbt_new0(int, 1); - *nodeid = i; + int* nodeid = new int(i); xbt_heap_push(pqueue, nodeid, cost_arr[i]); } @@ -198,25 +203,24 @@ void DijkstraZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cb xbt_dynar_foreach (xbt_graph_node_get_outedges(v_node), cursor, edge) { xbt_node_t u_node = xbt_graph_edge_get_target(edge); - graph_node_data_t data = (graph_node_data_t)xbt_graph_node_get_data(u_node); + graph_node_data_t data = static_cast(xbt_graph_node_get_data(u_node)); int u_id = data->graph_id; - sg_platf_route_cbarg_t tmp_e_route = (sg_platf_route_cbarg_t)xbt_graph_edge_get_data(edge); + sg_platf_route_cbarg_t tmp_e_route = static_cast(xbt_graph_edge_get_data(edge)); int cost_v_u = tmp_e_route->link_list->size(); /* count of links, old model assume 1 */ if (cost_v_u + cost_arr[*v_id] < cost_arr[u_id]) { pred_arr[u_id] = *v_id; cost_arr[u_id] = cost_v_u + cost_arr[*v_id]; - int* nodeid = xbt_new0(int, 1); - *nodeid = u_id; + int* nodeid = new int(u_id); xbt_heap_push(pqueue, nodeid, cost_arr[u_id]); } } /* free item popped from pqueue */ - xbt_free(v_id); + delete v_id; } - xbt_free(cost_arr); + delete[] cost_arr; xbt_heap_free(pqueue); } @@ -233,7 +237,7 @@ void DijkstraZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cb if (edge == nullptr) THROWF(arg_error, 0, "No route from '%s' to '%s'", src->name().c_str(), dst->name().c_str()); - sg_platf_route_cbarg_t e_route = (sg_platf_route_cbarg_t)xbt_graph_edge_get_data(edge); + sg_platf_route_cbarg_t e_route = static_cast(xbt_graph_edge_get_data(edge)); NetPoint* prev_gw_src = gw_src; gw_src = e_route->gw_src; @@ -273,19 +277,19 @@ void DijkstraZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cb if (not routeCache_.empty() && elm == nullptr) { /* add to predecessor list of the current src-host to cache */ - elm = xbt_new0(s_route_cache_element_t, 1); + elm = new s_route_cache_element_t; elm->pred_arr = pred_arr; elm->size = size; routeCache_.insert({src_id, elm}); } if (routeCache_.empty()) - xbt_free(pred_arr); + delete[] pred_arr; } DijkstraZone::~DijkstraZone() { - xbt_graph_free_graph(routeGraph_, &xbt_free_f, &graph_edge_data_free, &xbt_free_f); + xbt_graph_free_graph(routeGraph_, &graph_node_data_free, &graph_edge_data_free, nullptr); } /* Creation routing model functions */ diff --git a/src/kernel/routing/DragonflyZone.cpp b/src/kernel/routing/DragonflyZone.cpp index 38e788f480..74241c8d17 100644 --- a/src/kernel/routing/DragonflyZone.cpp +++ b/src/kernel/routing/DragonflyZone.cpp @@ -25,8 +25,8 @@ DragonflyZone::~DragonflyZone() { if (this->routers_ != nullptr) { for (unsigned int i = 0; i < this->numGroups_ * this->numChassisPerGroup_ * this->numBladesPerChassis_; i++) - delete (routers_[i]); - xbt_free(routers_); + delete routers_[i]; + delete[] routers_; } } @@ -134,20 +134,15 @@ DragonflyRouter::DragonflyRouter(int group, int chassis, int blade) : group_(gro DragonflyRouter::~DragonflyRouter() { - if (this->myNodes_ != nullptr) - xbt_free(myNodes_); - if (this->greenLinks_ != nullptr) - xbt_free(greenLinks_); - if (this->blackLinks_ != nullptr) - xbt_free(blackLinks_); - if (this->blueLinks_ != nullptr) - xbt_free(blueLinks_); + delete[] myNodes_; + delete[] greenLinks_; + delete[] blackLinks_; + delete blueLinks_; } void DragonflyZone::generateRouters() { - this->routers_ = static_cast(xbt_malloc0(this->numGroups_ * this->numChassisPerGroup_ * - this->numBladesPerChassis_ * sizeof(DragonflyRouter*))); + this->routers_ = new DragonflyRouter*[this->numGroups_ * this->numChassisPerGroup_ * this->numBladesPerChassis_]; for (unsigned int i = 0; i < this->numGroups_; i++) { for (unsigned int j = 0; j < this->numChassisPerGroup_; j++) { @@ -201,12 +196,9 @@ void DragonflyZone::generateLinks() // Links from routers to their local nodes. for (unsigned int i = 0; i < numRouters; i++) { // allocate structures - this->routers_[i]->myNodes_ = static_cast( - xbt_malloc0(numLinksperLink_ * this->numNodesPerBlade_ * sizeof(surf::LinkImpl*))); - this->routers_[i]->greenLinks_ = - static_cast(xbt_malloc0(this->numBladesPerChassis_ * sizeof(surf::LinkImpl*))); - this->routers_[i]->blackLinks_ = - static_cast(xbt_malloc0(this->numChassisPerGroup_ * sizeof(surf::LinkImpl*))); + this->routers_[i]->myNodes_ = new surf::LinkImpl*[numLinksperLink_ * this->numNodesPerBlade_]; + this->routers_[i]->greenLinks_ = new surf::LinkImpl*[this->numBladesPerChassis_]; + this->routers_[i]->blackLinks_ = new surf::LinkImpl*[this->numChassisPerGroup_]; for (unsigned int j = 0; j < numLinksperLink_ * this->numNodesPerBlade_; j += numLinksperLink_) { std::string id = "local_link_from_router_"+ std::to_string(i) + "_to_node_" + @@ -264,8 +256,8 @@ void DragonflyZone::generateLinks() for (unsigned int j = i + 1; j < this->numGroups_; j++) { unsigned int routernumi = i * numBladesPerChassis_ * numChassisPerGroup_ + j; unsigned int routernumj = j * numBladesPerChassis_ * numChassisPerGroup_ + i; - this->routers_[routernumi]->blueLinks_ = static_cast(xbt_malloc0(sizeof(surf::LinkImpl*))); - this->routers_[routernumj]->blueLinks_ = static_cast(xbt_malloc0(sizeof(surf::LinkImpl*))); + this->routers_[routernumi]->blueLinks_ = new surf::LinkImpl*; + this->routers_[routernumj]->blueLinks_ = new surf::LinkImpl*; std::string id = "blue_link_between_group_"+ std::to_string(i) +"_and_" + std::to_string(j) +"_routers_" + std::to_string(routernumi) + "_and_" + std::to_string(routernumj) + "_" + std::to_string(uniqueId); this->createLink(id, this->numLinksBlue_, &linkup, &linkdown); diff --git a/src/kernel/routing/FloydZone.cpp b/src/kernel/routing/FloydZone.cpp index e680281214..21302f0218 100644 --- a/src/kernel/routing/FloydZone.cpp +++ b/src/kernel/routing/FloydZone.cpp @@ -37,10 +37,10 @@ FloydZone::~FloydZone() for (unsigned int i = 0; i < table_size; i++) for (unsigned int j = 0; j < table_size; j++) routing_route_free(TO_FLOYD_LINK(i, j)); - xbt_free(linkTable_); + delete[] linkTable_; - xbt_free(predecessorTable_); - xbt_free(costTable_); + delete[] predecessorTable_; + delete[] costTable_; } void FloydZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t route, double* lat) @@ -93,9 +93,9 @@ void FloydZone::addRoute(sg_platf_route_cbarg_t route) if (not linkTable_) { /* Create Cost, Predecessor and Link tables */ - costTable_ = xbt_new0(double, table_size* table_size); /* link cost from host to host */ - predecessorTable_ = xbt_new0(int, table_size* table_size); /* predecessor host numbers */ - linkTable_ = xbt_new0(sg_platf_route_cbarg_t, table_size * table_size); /* actual link between src and dst */ + costTable_ = new double[table_size * table_size]; /* link cost from host to host */ + predecessorTable_ = new int[table_size * table_size]; /* predecessor host numbers */ + linkTable_ = new sg_platf_route_cbarg_t[table_size * table_size]; /* actual link between src and dst */ /* Initialize costs and predecessors */ for (unsigned int i = 0; i < table_size; i++) @@ -160,9 +160,9 @@ void FloydZone::seal() if (not linkTable_) { /* Create Cost, Predecessor and Link tables */ - costTable_ = xbt_new0(double, table_size* table_size); /* link cost from host to host */ - predecessorTable_ = xbt_new0(int, table_size* table_size); /* predecessor host numbers */ - linkTable_ = xbt_new0(sg_platf_route_cbarg_t, table_size * table_size); /* actual link between src and dst */ + costTable_ = new double[table_size * table_size]; /* link cost from host to host */ + predecessorTable_ = new int[table_size * table_size]; /* predecessor host numbers */ + linkTable_ = new sg_platf_route_cbarg_t[table_size * table_size]; /* actual link between src and dst */ /* Initialize costs and predecessors */ for (unsigned int i = 0; i < table_size; i++) @@ -178,7 +178,7 @@ void FloydZone::seal() for (unsigned int i = 0; i < table_size; i++) { sg_platf_route_cbarg_t e_route = TO_FLOYD_LINK(i, i); if (not e_route) { - e_route = xbt_new0(s_sg_platf_route_cbarg_t, 1); + e_route = new s_sg_platf_route_cbarg_t; e_route->gw_src = nullptr; e_route->gw_dst = nullptr; e_route->link_list = new std::vector(); diff --git a/src/kernel/routing/FullZone.cpp b/src/kernel/routing/FullZone.cpp index 429f07908b..5fe8ab42ca 100644 --- a/src/kernel/routing/FullZone.cpp +++ b/src/kernel/routing/FullZone.cpp @@ -24,14 +24,14 @@ void FullZone::seal() /* Create table if needed */ if (not routingTable_) - routingTable_ = xbt_new0(sg_platf_route_cbarg_t, table_size * table_size); + routingTable_ = new sg_platf_route_cbarg_t[table_size * table_size](); /* Add the loopback if needed */ if (surf_network_model->loopback_ && hierarchy_ == RoutingMode::base) { for (unsigned int i = 0; i < table_size; i++) { sg_platf_route_cbarg_t e_route = TO_ROUTE_FULL(i, i); if (not e_route) { - e_route = xbt_new0(s_sg_platf_route_cbarg_t, 1); + e_route = new s_sg_platf_route_cbarg_t; e_route->gw_src = nullptr; e_route->gw_dst = nullptr; e_route->link_list = new std::vector(); @@ -51,10 +51,10 @@ FullZone::~FullZone() for (unsigned int j = 0; j < table_size; j++) { if (TO_ROUTE_FULL(i, j)) { delete TO_ROUTE_FULL(i, j)->link_list; - xbt_free(TO_ROUTE_FULL(i, j)); + delete TO_ROUTE_FULL(i, j); } } - xbt_free(routingTable_); + delete[] routingTable_; } } @@ -85,7 +85,7 @@ void FullZone::addRoute(sg_platf_route_cbarg_t route) unsigned int table_size = getTableSize(); if (not routingTable_) - routingTable_ = xbt_new0(sg_platf_route_cbarg_t, table_size * table_size); + routingTable_ = new sg_platf_route_cbarg_t[table_size * table_size](); /* Check that the route does not already exist */ if (route->gw_dst) // inter-zone route (to adapt the error message, if any) diff --git a/src/kernel/routing/RoutedZone.cpp b/src/kernel/routing/RoutedZone.cpp index 5c237168ca..cb2d000c4f 100644 --- a/src/kernel/routing/RoutedZone.cpp +++ b/src/kernel/routing/RoutedZone.cpp @@ -18,7 +18,7 @@ void routing_route_free(sg_platf_route_cbarg_t route) { if (route) { delete route->link_list; - xbt_free(route); + delete route; } } @@ -78,7 +78,7 @@ void RoutedZone::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) if (my_src == my_dst) continue; - sg_platf_route_cbarg_t route = xbt_new0(s_sg_platf_route_cbarg_t, 1); + sg_platf_route_cbarg_t route = new s_sg_platf_route_cbarg_t; route->link_list = new std::vector(); getLocalRoute(my_src, my_dst, route, nullptr); @@ -119,7 +119,7 @@ void RoutedZone::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) XBT_DEBUG(" %s -> %s", previous_name, current_name); delete route->link_list; - xbt_free(route); + delete route; } } } @@ -132,7 +132,7 @@ sg_platf_route_cbarg_t RoutedZone::newExtendedRoute(RoutingMode hierarchy, sg_pl { sg_platf_route_cbarg_t result; - result = xbt_new0(s_sg_platf_route_cbarg_t, 1); + result = new s_sg_platf_route_cbarg_t; result->link_list = new std::vector(); xbt_assert(hierarchy == RoutingMode::base || hierarchy == RoutingMode::recursive, diff --git a/src/surf/xml/platf_private.hpp b/src/surf/xml/platf_private.hpp index 93b710ea36..db80cd7ca2 100644 --- a/src/surf/xml/platf_private.hpp +++ b/src/surf/xml/platf_private.hpp @@ -84,12 +84,12 @@ public: }; struct s_sg_platf_route_cbarg_t { - bool symmetrical; - sg_netpoint_t src; - sg_netpoint_t dst; - sg_netpoint_t gw_src; - sg_netpoint_t gw_dst; - std::vector* link_list; + bool symmetrical = false; + sg_netpoint_t src = nullptr; + sg_netpoint_t dst = nullptr; + sg_netpoint_t gw_src = nullptr; + sg_netpoint_t gw_dst = nullptr; + std::vector* link_list = nullptr; }; typedef s_sg_platf_route_cbarg_t* sg_platf_route_cbarg_t;