From: Martin Quinson Date: Thu, 10 Nov 2011 16:57:02 +0000 (+0100) Subject: That pointer to function was never given anything but one value X-Git-Tag: exp_20120216~330 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/25b7437ec8c9772f40dade724b77b13524e03fb7?ds=sidebyside That pointer to function was never given anything but one value The global_routing value seem to be used to group functions together, but the fields cannot be given another value. Of course, I'm gonna kill em all. --- diff --git a/src/instr/instr_interface.c b/src/instr/instr_interface.c index fabcf00831..75090b8f03 100644 --- a/src/instr/instr_interface.c +++ b/src/instr/instr_interface.c @@ -138,7 +138,7 @@ static void instr_user_srcdst_variable(double time, double value, InstrUserVariable what) { - xbt_dynar_t route = global_routing->get_route (src, dst); + xbt_dynar_t route = routing_get_route (src, dst); unsigned int i; void *link; xbt_dynar_foreach (route, i, link) { diff --git a/src/instr/instr_routing.c b/src/instr/instr_routing.c index d41eca08db..5164bfa79c 100644 --- a/src/instr/instr_routing.c +++ b/src/instr/instr_routing.c @@ -412,7 +412,7 @@ static void recursiveXBTGraphExtraction (xbt_graph_t graph, xbt_dict_t nodes, xb (child2->kind == INSTR_HOST || child2->kind == INSTR_ROUTER) && strcmp (child1_name, child2_name) != 0){ - xbt_dynar_t route = global_routing->get_route (child1_name, child2_name); + xbt_dynar_t route = routing_get_route (child1_name, child2_name); if (TRACE_onelink_only()){ if (xbt_dynar_length (route) > 1) continue; } diff --git a/src/surf/network.c b/src/surf/network.c index 67213b5aaf..6349d1cb5d 100644 --- a/src/surf/network.c +++ b/src/surf/network.c @@ -413,8 +413,7 @@ static void net_update_actions_state(double now, double delta) } #ifdef HAVE_TRACING if (TRACE_is_enabled()) { - xbt_dynar_t route = global_routing->get_route(action->src_name, - action->dst_name); + xbt_dynar_t route = routing_get_route(action->src_name, action->dst_name); link_CM02_t link; unsigned int i; xbt_dynar_foreach(route, i, link) { @@ -590,7 +589,7 @@ static surf_action_t net_communicate(const char *src_name, global_routing->get_route_latency(src_name, dst_name, &route, &latency, 0); if (sg_network_fullduplex == 1) { - back_route = global_routing->get_route(dst_name, src_name); + back_route = routing_get_route(dst_name, src_name); } /* LARGE PLATFORMS HACK: @@ -723,7 +722,7 @@ static surf_action_t net_communicate(const char *src_name, static xbt_dynar_t net_get_route(const char *src, const char *dst) { - return global_routing->get_route(src, dst); + return routing_get_route(src, dst); } static double net_get_link_bandwidth(const void *link) diff --git a/src/surf/network_im.c b/src/surf/network_im.c index b15b936f43..7a8d6f465b 100644 --- a/src/surf/network_im.c +++ b/src/surf/network_im.c @@ -610,7 +610,7 @@ static surf_action_t im_net_communicate(const char *src_name, if (sg_network_fullduplex == 1) { - back_route = global_routing->get_route(dst_name, src_name); + back_route = routing_get_route(dst_name, src_name); } /* LARGE PLATFORMS HACK: @@ -747,7 +747,7 @@ static surf_action_t im_net_communicate(const char *src_name, static xbt_dynar_t im_net_get_route(const char *src, const char *dst) { - return global_routing->get_route(src, dst); + return routing_get_route(src, dst); } static double im_net_get_link_bandwidth(const void *link) diff --git a/src/surf/surf_private.h b/src/surf/surf_private.h index 7c2e4ca8d2..2963ec9211 100644 --- a/src/surf/surf_private.h +++ b/src/surf/surf_private.h @@ -169,7 +169,6 @@ struct s_routing_global { AS_t root; void *loopback; size_t size_of_link; - xbt_dynar_t(*get_route) (const char *src, const char *dst); xbt_dynar_t(*get_route_or_null) (const char *src, const char *dst); xbt_dynar_t(*get_route_no_cleanup) (const char *src, const char *dst); xbt_dynar_t(*get_onelink_routes) (void); @@ -184,6 +183,8 @@ XBT_PUBLIC(void) routing_model_create(size_t size_of_link, void *loopback); XBT_PUBLIC(void) routing_exit(void); XBT_PUBLIC(void) routing_register_callbacks(void); +XBT_PUBLIC(xbt_dynar_t) routing_get_route(const char *src, const char *dst); + /** * Resource protected methods */ diff --git a/src/surf/surf_routing.c b/src/surf/surf_routing.c index 0f469d5fe9..cef283285f 100644 --- a/src/surf/surf_routing.c +++ b/src/surf/surf_routing.c @@ -605,7 +605,7 @@ static void get_route_latency(const char *src, const char *dst, } /** - * \brief Generic method: find a route between hosts + * \brief Find a route between hosts * * \param src the source host name * \param dst the destination host name @@ -614,8 +614,7 @@ static void get_route_latency(const char *src, const char *dst, * by calling the differents "get_route" functions in each routing component. * No need to free the returned dynar. It will be freed at the next call. */ -static xbt_dynar_t get_route(const char *src, const char *dst) -{ +xbt_dynar_t routing_get_route(const char *src, const char *dst) { xbt_dynar_t route = NULL; get_route_latency(src, dst, &route, NULL, 1); return route; @@ -724,7 +723,6 @@ void routing_model_create(size_t size_of_links, void *loopback) /* config the uniq global routing */ global_routing = xbt_new0(s_routing_global_t, 1); global_routing->root = NULL; - global_routing->get_route = get_route; global_routing->get_route_or_null = get_route_or_null; global_routing->get_latency = get_latency; global_routing->get_route_no_cleanup = get_route_no_cleanup; diff --git a/src/surf/surf_routing_dijkstra.c b/src/surf/surf_routing_dijkstra.c index 442c965cfc..68ea411e01 100644 --- a/src/surf/surf_routing_dijkstra.c +++ b/src/surf/surf_routing_dijkstra.c @@ -374,7 +374,7 @@ static route_extended_t dijkstra_get_route(AS_t asg, if (asg->hierarchy == SURF_ROUTING_RECURSIVE && v != dst_node_id && strcmp(gw_dst, prev_gw_src)) { xbt_dynar_t e_route_as_to_as = - (*(global_routing->get_route)) (gw_dst, prev_gw_src); + routing_get_route(gw_dst, prev_gw_src); xbt_assert(e_route_as_to_as, "no route between \"%s\" and \"%s\"", gw_dst, prev_gw_src); links = e_route_as_to_as; diff --git a/src/surf/surf_routing_floyd.c b/src/surf/surf_routing_floyd.c index 211cf928ca..c29b20910b 100644 --- a/src/surf/surf_routing_floyd.c +++ b/src/surf/surf_routing_floyd.c @@ -116,7 +116,7 @@ static route_extended_t floyd_get_route(AS_t asg, if (asg->hierarchy == SURF_ROUTING_RECURSIVE && !first && strcmp(gw_dst, prev_gw_src)) { xbt_dynar_t e_route_as_to_as = - (*(global_routing->get_route)) (gw_dst, prev_gw_src); + routing_get_route(gw_dst, prev_gw_src); xbt_assert(e_route_as_to_as, "no route between \"%s\" and \"%s\"", gw_dst, prev_gw_src); links = e_route_as_to_as; diff --git a/src/surf/workstation_ptask_L07.c b/src/surf/workstation_ptask_L07.c index 5d94ad59fb..c558a2e798 100644 --- a/src/surf/workstation_ptask_L07.c +++ b/src/surf/workstation_ptask_L07.c @@ -82,7 +82,7 @@ static void ptask_update_action_bound(surf_action_workstation_L07_t action) for (i = 0; i < workstation_nb; i++) { for (j = 0; j < workstation_nb; j++) { xbt_dynar_t route = - global_routing->get_route(surf_resource_name + routing_get_route(surf_resource_name (action->workstation_list[i]), surf_resource_name(action-> workstation_list @@ -463,7 +463,7 @@ static surf_action_t ptask_execute_parallel_task(int workstation_nb, for (j = 0; j < workstation_nb; j++) { link_L07_t link; xbt_dynar_t route = - global_routing->get_route(surf_resource_name + routing_get_route(surf_resource_name (workstation_list[i]), surf_resource_name(workstation_list [j])); @@ -517,7 +517,7 @@ static surf_action_t ptask_execute_parallel_task(int workstation_nb, for (j = 0; j < workstation_nb; j++) { link_L07_t link; xbt_dynar_t route = - global_routing->get_route(surf_resource_name + routing_get_route(surf_resource_name (workstation_list[i]), surf_resource_name(workstation_list [j])); @@ -589,9 +589,9 @@ static surf_action_t ptask_action_sleep(void *cpu, double duration) return (surf_action_t) action; } -static xbt_dynar_t ptask_get_route(void *src, void *dst) +static xbt_dynar_t ptask_get_route(void *src, void *dst) // FIXME: kill that callback kind? { - return global_routing->get_route(surf_resource_name(src), + return routing_get_route(surf_resource_name(src), surf_resource_name(dst)); } diff --git a/teshsuite/simdag/platforms/flatifier.c b/teshsuite/simdag/platforms/flatifier.c index e7321c98dc..59f1ffe2b2 100644 --- a/teshsuite/simdag/platforms/flatifier.c +++ b/teshsuite/simdag/platforms/flatifier.c @@ -136,7 +136,7 @@ int main(int argc, char **argv) printf(" \n " ,src ,dst); - xbt_dynar_t route = global_routing->get_route(src,dst); + xbt_dynar_t route = routing_get_route(src,dst); for(i=0;i\n " ,src ,dst); - xbt_dynar_t route = global_routing->get_route(src,dst); + xbt_dynar_t route = routing_get_route(src,dst); for(i=0;i\n " ,src ,dst); - xbt_dynar_t route = global_routing->get_route(src,dst); + xbt_dynar_t route = routing_get_route(src,dst); for(i=0;i\n " ,src ,dst); - xbt_dynar_t route = global_routing->get_route(src,dst); + xbt_dynar_t route = routing_get_route(src,dst); for(i=0;i