From bee3400ba6e1daeca869db8753dc4d86bcda28ca Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Thu, 10 Nov 2011 23:36:16 +0100 Subject: [PATCH] Simply say fun_ptr(...) instead of (*fun_ptr)(...). Another possible cleanup in the same spirit is to remove the ampersand when taking the address of a function. This is left as an exercise for the reader. --- examples/xbt/sem_sched.c | 2 +- include/xbt/ex.h | 8 ++++---- src/gras/DataDesc/ddt_exchange.c | 4 ++-- src/gras/Msg/gras_msg_exchange.c | 2 +- src/gras/Msg/timer.c | 2 +- src/gras/Transport/transport.c | 14 +++++++------- src/gras/Virtu/gras_module.c | 10 +++++----- src/gras/Virtu/process.c | 2 +- src/gras/Virtu/rl_process.c | 2 +- src/msg/msg_actions.c | 4 ++-- src/simix/private.h | 18 ++++++++++-------- src/simix/smx_context.c | 4 ++-- src/simix/smx_context_base.c | 2 +- src/simix/smx_deployment.c | 12 ++++++------ src/simix/smx_network.c | 2 +- src/surf/network.c | 8 ++++---- src/surf/network_im.c | 8 ++++---- src/surf/sg_platf.c | 14 +++++++------- src/surf/surf_routing.c | 16 ++++++++-------- src/surf/surf_routing_vivaldi.c | 2 +- src/surf/surfxml_parse.c | 2 +- src/xbt/backtrace_windows.c | 10 +++++----- src/xbt/config.c | 28 ++++++++++++++-------------- src/xbt/dict.c | 2 +- src/xbt/dynar.c | 8 ++++---- src/xbt/ex.c | 2 +- src/xbt/graph.c | 12 ++++++------ src/xbt/graphxml_parse.c | 12 ++++++------ src/xbt/heap.c | 2 +- src/xbt/mallocator.c | 10 +++++----- src/xbt/mmalloc/mfree.c | 2 +- src/xbt/mmalloc/mmalloc.c | 2 +- src/xbt/mmalloc/mmcheck.c | 2 +- src/xbt/mmalloc/mrealloc.c | 2 +- src/xbt/xbt_matrix.c | 6 +++--- src/xbt/xbt_os_thread.c | 2 +- src/xbt/xbt_rl_synchro.c | 2 +- src/xbt/xbt_sg_synchro.c | 2 +- src/xbt/xbt_synchro.c | 4 ++-- 39 files changed, 125 insertions(+), 123 deletions(-) diff --git a/examples/xbt/sem_sched.c b/examples/xbt/sem_sched.c index eb018c707d..64a6bf1bb9 100644 --- a/examples/xbt/sem_sched.c +++ b/examples/xbt/sem_sched.c @@ -394,7 +394,7 @@ int job_execute(job_t job) if (!job) return EINVAL; - return (*(job->func)) (job->argc, job->argv); + return job->func(job->argc, job->argv); } int job_free(job_t * ref) diff --git a/include/xbt/ex.h b/include/xbt/ex.h index 50ef63e9fe..f1f3cc968c 100644 --- a/include/xbt/ex.h +++ b/include/xbt/ex.h @@ -55,15 +55,15 @@ SG_BEGIN_DECL() # include #include # define MAYDAY_SAVE(m) printf("%d %s:%d save %p\n", \ - (*xbt_getpid)(),__FILE__,__LINE__, \ + xbt_getpid(), __FILE__, __LINE__, \ (m)->jb \ ), # define MAYDAY_RESTORE(m) printf("%d %s:%d restore %p\n", \ - (*xbt_getpid)(),__FILE__,__LINE__, \ + xbt_getpid(), __FILE__, __LINE__, \ (m)->jb \ ), # define MAYDAY_CATCH(e) printf("%d %s:%d Catched '%s'\n", \ - (*xbt_getpid)(),__FILE__,__LINE__, \ + xbt_getpid(), __FILE__, __LINE__, \ (e).msg \ ), #else @@ -450,7 +450,7 @@ extern void __xbt_ex_terminate_default(xbt_ex_t * e); _throw_ctx->exception.remote = 0; \ _throw_ctx->exception.host = (char*)NULL; \ _throw_ctx->exception.procname = (char*)xbt_procname(); \ - _throw_ctx->exception.pid = (*xbt_getpid)(); \ + _throw_ctx->exception.pid = xbt_getpid(); \ _throw_ctx->exception.file = (char*)__FILE__; \ _throw_ctx->exception.line = __LINE__; \ _throw_ctx->exception.func = (char*)_XBT_FUNCTION; \ diff --git a/src/gras/DataDesc/ddt_exchange.c b/src/gras/DataDesc/ddt_exchange.c index 60b19436e9..e00f6a93f1 100644 --- a/src/gras/DataDesc/ddt_exchange.c +++ b/src/gras/DataDesc/ddt_exchange.c @@ -235,7 +235,7 @@ gras_datadesc_memcpy_rec(gras_cbps_t state, /* Detect the referenced type */ sub_type = ref_data.type; if (sub_type == NULL) { - sub_type = (*ref_data.selector) (type, state, src); + sub_type = ref_data.selector(type, state, src); } /* Send the pointed data only if not already sent */ @@ -525,7 +525,7 @@ gras_datadesc_send_rec(gras_socket_t sock, /* Detect the referenced type and send it to peer if needed */ sub_type = ref_data.type; if (sub_type == NULL) { - sub_type = (*ref_data.selector) (type, state, data); + sub_type = ref_data.selector(type, state, data); gras_dd_send_int(sock, &(sub_type->code), 1 /*stable */ ); } diff --git a/src/gras/Msg/gras_msg_exchange.c b/src/gras/Msg/gras_msg_exchange.c index a992a815f9..127ce0f21c 100644 --- a/src/gras/Msg/gras_msg_exchange.c +++ b/src/gras/Msg/gras_msg_exchange.c @@ -403,7 +403,7 @@ void gras_msg_handle(volatile double timeOut) XBT_DEBUG ("Use the callback #%d (@%p) for incomming msg '%s' (payload_size=%d)", cpt + 1, cb, msg.type->name, msg.payl_size); - if (!(*cb) (&ctx, msg.payl)) { + if (!cb(&ctx, msg.payl)) { /* cb handled the message */ free(msg.payl); ran_ok = 1; diff --git a/src/gras/Msg/timer.c b/src/gras/Msg/timer.c index 3c97260740..1fff6ea1fd 100644 --- a/src/gras/Msg/timer.c +++ b/src/gras/Msg/timer.c @@ -185,7 +185,7 @@ double gras_msg_timer_handle(void) timer->action); xbt_dynar_cursor_rm(pd->timers, &cursor); } - (*action) (); + action(); return 0.0; } else if (untilthis < untilnext || untilnext == -1) { untilnext = untilthis; diff --git a/src/gras/Transport/transport.c b/src/gras/Transport/transport.c index ef7e7ccaf2..8aabcc482c 100644 --- a/src/gras/Transport/transport.c +++ b/src/gras/Transport/transport.c @@ -395,7 +395,7 @@ void gras_socket_close(gras_socket_t sock) void gras_trp_send(gras_socket_t sd, char *data, long int size, int stable) { xbt_assert(sd->outgoing, "Socket not suited for data send"); - (*sd->plugin->send) (sd, data, size, stable); + sd->plugin->send(sd, data, size, stable); } /** @@ -429,7 +429,7 @@ int gras_socket_my_port(gras_socket_t sock) { if (!sock->plugin->my_port) THROWF(unknown_error,0,"Function my_port unimplemented in plugin %s",sock->plugin->name); - return (*sock->plugin->my_port)(sock); + return sock->plugin->my_port(sock); } @@ -437,23 +437,23 @@ int gras_socket_peer_port(gras_socket_t sock) { if (!sock->plugin->peer_port) THROWF(unknown_error,0,"Function peer_port unimplemented in plugin %s",sock->plugin->name); - return (*sock->plugin->peer_port)(sock); + return sock->plugin->peer_port(sock); } const char *gras_socket_peer_name(gras_socket_t sock) { xbt_assert(sock->plugin); - return (*sock->plugin->peer_name)(sock); + return sock->plugin->peer_name(sock); } const char *gras_socket_peer_proc(gras_socket_t sock) { - return (*sock->plugin->peer_proc)(sock); + return sock->plugin->peer_proc(sock); } void gras_socket_peer_proc_set(gras_socket_t sock, char *peer_proc) { - return (*sock->plugin->peer_proc_set)(sock,peer_proc); + return sock->plugin->peer_proc_set(sock,peer_proc); } /** \brief Check if the provided socket is a measurement one (or a regular one) */ @@ -505,7 +505,7 @@ void gras_socket_meas_send(gras_socket_t peer, "Sent %lu msgs of %lu (size of each: %ld) to %s:%d", sent_sofar, msg_amount, msg_size, gras_socket_peer_name(peer), gras_socket_peer_port(peer)); - (*peer->plugin->raw_send) (peer, chunk, msg_size); + peer->plugin->raw_send(peer, chunk, msg_size); } XBT_CDEBUG(gras_trp_meas, "Sent %lu msgs of %lu (size of each: %ld) to %s:%d", sent_sofar, diff --git a/src/gras/Virtu/gras_module.c b/src/gras/Virtu/gras_module.c index 2a2feb57c6..cd4808460e 100644 --- a/src/gras/Virtu/gras_module.c +++ b/src/gras/Virtu/gras_module.c @@ -187,7 +187,7 @@ static void moddata_freep(void *p) int id = xbt_dynar_search(pd->moddata, p); gras_module_t mod = (gras_module_t) xbt_set_get_by_id(_gras_modules, id); - (*mod->leave_f) (gras_moddata_by_id(id)); + mod->leave_f(gras_moddata_by_id(id)); } void gras_module_join(const char *name) @@ -204,7 +204,7 @@ void gras_module_join(const char *name) XBT_VERB("Init module %s", name); mod->name = xbt_strdup(name); - (*mod->init_f) (); + mod->init_f(); } else { XBT_DEBUG("Module %s already inited. Refcount=%d ID=%d", mod->name, mod->refcount, *(mod->p_id)); @@ -221,7 +221,7 @@ void gras_module_join(const char *name) xbt_dynar_set(pd->moddata, *(mod->p_id), &moddata); - (*mod->join_f) (moddata); + mod->join_f(moddata); XBT_DEBUG("Module %s joined successfully (ID=%d)", name, *(mod->p_id)); } @@ -236,14 +236,14 @@ void gras_module_leave(const char *name) /* LEAVE */ moddata = gras_moddata_by_id(*(mod->p_id)); - (*mod->leave_f) (moddata); + mod->leave_f(moddata); /* EXIT */ mod->refcount--; if (!mod->refcount) { XBT_VERB("Exit module %s", name); - (*mod->exit_f) (); + mod->exit_f(); /* Don't remove the module for real, sets don't allow to diff --git a/src/gras/Virtu/process.c b/src/gras/Virtu/process.c index 36949b378d..fef78bec14 100644 --- a/src/gras/Virtu/process.c +++ b/src/gras/Virtu/process.c @@ -150,7 +150,7 @@ void gras_procdata_init() "MayDay: two modules use '%s' as libdata name", fab.name); /* Add the data in place, after some more sanity checking */ - elem = (*(fab.constructor)) (); + elem = fab.constructor(); if (elem->name_len && elem->name_len != strlen(elem->name)) { elem->name_len = strlen(elem->name); XBT_WARN diff --git a/src/gras/Virtu/rl_process.c b/src/gras/Virtu/rl_process.c index db5148e9cc..f120573df9 100644 --- a/src/gras/Virtu/rl_process.c +++ b/src/gras/Virtu/rl_process.c @@ -103,7 +103,7 @@ typedef struct { static void *spawner_wrapper(void *data) { spawner_wrapper_args *a = data; - (*(a->code))(a->argc,a->argv); + a->code(a->argc, a->argv); free(a); return NULL; } diff --git a/src/msg/msg_actions.c b/src/msg/msg_actions.c index 97d3c4c05e..0fb8c58740 100644 --- a/src/msg/msg_actions.c +++ b/src/msg/msg_actions.c @@ -57,7 +57,7 @@ static int MSG_action_runner(int argc, char *argv[]) while ((evt = action_get_action(argv[0]))) { msg_action_fun function = xbt_dict_get(action_funs, evt[1]); - (*function) (evt); + function(evt); free(evt); } } else { // Should have got my trace file in argument @@ -70,7 +70,7 @@ static int MSG_action_runner(int argc, char *argv[]) while ((evt=xbt_replay_trace_reader_get(reader))) { if (!strcmp(argv[0],evt[0])) { msg_action_fun function = xbt_dict_get(action_funs, evt[1]); - (*function) (evt); + function(evt); free(evt); } else { XBT_WARN("%s: Ignore trace element not for me", diff --git a/src/simix/private.h b/src/simix/private.h index 2008f9c1eb..41694a8534 100644 --- a/src/simix/private.h +++ b/src/simix/private.h @@ -197,8 +197,10 @@ static XBT_INLINE smx_context_t SIMIX_context_new(xbt_main_func_t code, smx_process_t simix_process) { - return (*(simix_global->context_factory->create_context)) - (code, argc, argv, cleanup_func, simix_process); + return simix_global->context_factory->create_context(code, + argc, argv, + cleanup_func, + simix_process); } /** @@ -208,7 +210,7 @@ static XBT_INLINE smx_context_t SIMIX_context_new(xbt_main_func_t code, */ static XBT_INLINE void SIMIX_context_free(smx_context_t context) { - (*(simix_global->context_factory->free)) (context); + simix_global->context_factory->free(context); } /** @@ -217,7 +219,7 @@ static XBT_INLINE void SIMIX_context_free(smx_context_t context) */ static XBT_INLINE void SIMIX_context_stop(smx_context_t context) { - (*(simix_global->context_factory->stop)) (context); + simix_global->context_factory->stop(context); } /** @@ -227,7 +229,7 @@ static XBT_INLINE void SIMIX_context_stop(smx_context_t context) */ static XBT_INLINE void SIMIX_context_suspend(smx_context_t context) { - (*(simix_global->context_factory->suspend)) (context); + simix_global->context_factory->suspend(context); } /** @@ -235,7 +237,7 @@ static XBT_INLINE void SIMIX_context_suspend(smx_context_t context) */ static XBT_INLINE void SIMIX_context_runall() { - (*(simix_global->context_factory->runall)) (); + simix_global->context_factory->runall(); } /** @@ -244,7 +246,7 @@ static XBT_INLINE void SIMIX_context_runall() static XBT_INLINE smx_context_t SIMIX_context_self(void) { if (simix_global && simix_global->context_factory != NULL) { - return (*(simix_global->context_factory->self))(); + return simix_global->context_factory->self(); } return NULL; @@ -257,7 +259,7 @@ static XBT_INLINE smx_context_t SIMIX_context_self(void) */ static XBT_INLINE void* SIMIX_context_get_data(smx_context_t context) { - return (*(simix_global->context_factory->get_data))(context); + return simix_global->context_factory->get_data(context); } XBT_PUBLIC(int) SIMIX_process_get_maxpid(void); diff --git a/src/simix/smx_context.c b/src/simix/smx_context.c index 7e0b7e56c7..ec51170f05 100644 --- a/src/simix/smx_context.c +++ b/src/simix/smx_context.c @@ -39,7 +39,7 @@ void SIMIX_context_mod_init(void) if (!simix_global->context_factory) { /* select the context factory to use to create the contexts */ if (smx_factory_initializer_to_use) { - (*smx_factory_initializer_to_use)(&(simix_global->context_factory)); + smx_factory_initializer_to_use(&simix_global->context_factory); } else { /* use the factory specified by --cfg=contexts/factory:value */ @@ -104,7 +104,7 @@ void SIMIX_context_mod_exit(void) /* finalize the context factory */ finalize_factory = simix_global->context_factory->finalize; - (*finalize_factory) (&simix_global->context_factory); + finalize_factory(&simix_global->context_factory); } xbt_dict_remove((xbt_dict_t) _surf_cfg_set,"contexts/factory"); } diff --git a/src/simix/smx_context_base.c b/src/simix/smx_context_base.c index 1a5d14087d..290698163d 100644 --- a/src/simix/smx_context_base.c +++ b/src/simix/smx_context_base.c @@ -85,7 +85,7 @@ void smx_ctx_base_free(smx_context_t context) void smx_ctx_base_stop(smx_context_t context) { if (context->cleanup_func) - (*(context->cleanup_func)) (context->data); + context->cleanup_func(context->data); context->iwannadie = 0; SIMIX_req_process_cleanup(context->data); } diff --git a/src/simix/smx_deployment.c b/src/simix/smx_deployment.c index 9ebd945cb2..bd9c56c4ef 100644 --- a/src/simix/smx_deployment.c +++ b/src/simix/smx_deployment.c @@ -66,12 +66,12 @@ static void parse_process_finalize(void) XBT_DEBUG("Starting Process %s(%s) right now", parse_argv[0], parse_host); if (simix_global->create_process_function) - (*simix_global->create_process_function) (&process, - parse_argv[0], - parse_code, NULL, - parse_host, parse_argc, - parse_argv, - current_property_set); + simix_global->create_process_function(&process, + parse_argv[0], + parse_code, NULL, + parse_host, parse_argc, + parse_argv, + current_property_set); else SIMIX_req_process_create(&process, parse_argv[0], parse_code, NULL, parse_host, parse_argc, parse_argv, current_property_set); diff --git a/src/simix/smx_network.c b/src/simix/smx_network.c index c3265f6950..d4290260d6 100644 --- a/src/simix/smx_network.c +++ b/src/simix/smx_network.c @@ -888,7 +888,7 @@ void SIMIX_comm_copy_data(smx_action_t comm) if (buff_size == 0) return; - (*SIMIX_comm_copy_data_callback) (comm, buff_size); + SIMIX_comm_copy_data_callback(comm, buff_size); /* Set the copied flag so we copy data only once */ /* (this function might be called from both communication ends) */ diff --git a/src/surf/network.c b/src/surf/network.c index 6349d1cb5d..7ef05330c6 100644 --- a/src/surf/network.c +++ b/src/surf/network.c @@ -627,21 +627,21 @@ static surf_action_t net_communicate(const char *src_name, (link->lmm_resource.power.peak * link->lmm_resource.power.scale); if (bandwidth_bound < 0.0) bandwidth_bound = - (*bandwidth_factor_callback) (size) * + bandwidth_factor_callback(size) * (link->lmm_resource.power.peak * link->lmm_resource.power.scale); else bandwidth_bound = min(bandwidth_bound, - (*bandwidth_factor_callback) (size) * + bandwidth_factor_callback(size) * (link->lmm_resource.power.peak * link->lmm_resource.power.scale)); } /* LARGE PLATFORMS HACK: Add src->link and dst->link latencies */ action->lat_current = action->latency; - action->latency *= (*latency_factor_callback) (size); + action->latency *= latency_factor_callback(size); action->rate = - (*bandwidth_constraint_callback) (action->rate, bandwidth_bound, + bandwidth_constraint_callback(action->rate, bandwidth_bound, size); if(xbt_dynar_length(route) > 0) { diff --git a/src/surf/network_im.c b/src/surf/network_im.c index 7a8d6f465b..48447e1104 100644 --- a/src/surf/network_im.c +++ b/src/surf/network_im.c @@ -654,21 +654,21 @@ static surf_action_t im_net_communicate(const char *src_name, (link->lmm_resource.power.peak * link->lmm_resource.power.scale); if (bandwidth_bound < 0.0) bandwidth_bound = - (*im_bandwidth_factor_callback) (size) * + im_bandwidth_factor_callback(size) * (link->lmm_resource.power.peak * link->lmm_resource.power.scale); else bandwidth_bound = min(bandwidth_bound, - (*im_bandwidth_factor_callback) (size) * + im_bandwidth_factor_callback(size) * (link->lmm_resource.power.peak * link->lmm_resource.power.scale)); } /* LARGE PLATFORMS HACK: Add src->link and dst->link latencies */ action->lat_current = action->latency; - action->latency *= (*im_latency_factor_callback) (size); + action->latency *= im_latency_factor_callback(size); action->rate = - (*im_bandwidth_constraint_callback) (action->rate, bandwidth_bound, + im_bandwidth_constraint_callback(action->rate, bandwidth_bound, size); /* LARGE PLATFORMS HACK: diff --git a/src/surf/sg_platf.c b/src/surf/sg_platf.c index e3264df595..06e0c77007 100644 --- a/src/surf/sg_platf.c +++ b/src/surf/sg_platf.c @@ -50,28 +50,28 @@ void sg_platf_new_host(sg_platf_host_cbarg_t h){ unsigned int iterator; sg_platf_host_cb_t fun; xbt_dynar_foreach(sg_platf_host_cb_list, iterator, fun) { - (*fun) (h); + fun(h); } } void sg_platf_new_router(sg_platf_router_cbarg_t router) { unsigned int iterator; sg_platf_router_cb_t fun; xbt_dynar_foreach(sg_platf_router_cb_list, iterator, fun) { - (*fun) (router); + fun(router); } } void sg_platf_new_link(sg_platf_link_cbarg_t link){ unsigned int iterator; sg_platf_link_cb_t fun; xbt_dynar_foreach(sg_platf_link_cb_list, iterator, fun) { - (*fun) (link); + fun(link); } } void sg_platf_new_peer(sg_platf_peer_cbarg_t peer){ unsigned int iterator; sg_platf_peer_cb_t fun; xbt_dynar_foreach(sg_platf_link_cb_list, iterator, fun) { - (*fun) (peer); + fun(peer); } } @@ -81,7 +81,7 @@ void sg_platf_end() { unsigned int iterator; void_f_void_t fun; xbt_dynar_foreach(sg_platf_postparse_cb_list, iterator, fun) { - (*fun) (); + fun(); } } @@ -109,7 +109,7 @@ void sg_platf_new_AS_begin(const char *id, const char *routing) { } xbt_dynar_foreach(sg_platf_AS_begin_cb_list, iterator, fun) { - (*fun) (id,routing); + fun(id, routing); } } @@ -117,7 +117,7 @@ void sg_platf_new_AS_end() { unsigned int iterator; void_f_void_t fun; xbt_dynar_foreach(sg_platf_AS_end_cb_list, iterator, fun) { - (*fun) (); + fun(); } } diff --git a/src/surf/surf_routing.c b/src/surf/surf_routing.c index 7ad72d3c5e..cb3c7e34be 100644 --- a/src/surf/surf_routing.c +++ b/src/surf/surf_routing.c @@ -100,7 +100,7 @@ static void parse_S_host(sg_platf_host_cbarg_t host) xbt_assert(!xbt_lib_get_or_null(host_lib, host->id, ROUTING_HOST_LEVEL), "Reading a host, processing unit \"%s\" already exists", host->id); - (*(current_routing->parse_PU)) (current_routing, host->id); + current_routing->parse_PU(current_routing, host->id); info = xbt_new0(s_network_element_info_t, 1); info->rc_component = current_routing; info->rc_type = SURF_NETWORK_ELEMENT_HOST; @@ -127,7 +127,7 @@ static void parse_S_router(sg_platf_router_cbarg_t router) "Reading a router, processing unit \"%s\" already exists", router->id); - (*(current_routing->parse_PU)) (current_routing, router->id); + current_routing->parse_PU(current_routing, router->id); info = xbt_new0(s_network_element_info_t, 1); info->rc_component = current_routing; info->rc_type = SURF_NETWORK_ELEMENT_ROUTER; @@ -231,7 +231,7 @@ static void routing_parse_E_route(void) xbt_assert(current_routing->parse_route, "no defined method \"set_route\" in \"%s\"", current_routing->name); - (*(current_routing->parse_route)) (current_routing, src, dst, route); + current_routing->parse_route(current_routing, src, dst, route); link_list = NULL; src = NULL; dst = NULL; @@ -249,7 +249,7 @@ static void routing_parse_E_ASroute(void) xbt_assert(current_routing->parse_ASroute, "no defined method \"set_ASroute\" in \"%s\"", current_routing->name); - (*(current_routing->parse_ASroute)) (current_routing, src, dst, e_route); + current_routing->parse_ASroute(current_routing, src, dst, e_route); link_list = NULL; src = NULL; dst = NULL; @@ -269,7 +269,7 @@ static void routing_parse_E_bypassRoute(void) xbt_assert(current_routing->parse_bypassroute, "Bypassing mechanism not implemented by routing '%s'", current_routing->name); - (*(current_routing->parse_bypassroute)) (current_routing, src, dst, e_route); + current_routing->parse_bypassroute(current_routing, src, dst, e_route); link_list = NULL; src = NULL; dst = NULL; @@ -311,7 +311,7 @@ void routing_AS_begin(const char *AS_id, const char *wanted_routing_type) } /* make a new routing component */ - new_as = (AS_t) (*(model->create)) (); + new_as = (AS_t) model->create(); new_as->model_desc = model; new_as->hierarchy = SURF_ROUTING_NULL; new_as->name = xbt_strdup(AS_id); @@ -336,7 +336,7 @@ void routing_AS_begin(const char *AS_id, const char *wanted_routing_type) xbt_dict_set(current_routing->routing_sons, AS_id, (void *) new_as, NULL); /* add to the father element list */ - (*(current_routing->parse_AS)) (current_routing, AS_id); + current_routing->parse_AS(current_routing, AS_id); } else { THROWF(arg_error, 0, "All defined components must be belong to a AS"); } @@ -372,7 +372,7 @@ void routing_AS_end() (void *) info); if (current_routing->model_desc->end) - (*(current_routing->model_desc->end)) (current_routing); + current_routing->model_desc->end(current_routing); current_routing = current_routing->routing_father; } } diff --git a/src/surf/surf_routing_vivaldi.c b/src/surf/surf_routing_vivaldi.c index 73b4a38eaf..873121a668 100644 --- a/src/surf/surf_routing_vivaldi.c +++ b/src/surf/surf_routing_vivaldi.c @@ -61,7 +61,7 @@ static double vivaldi_get_link_latency (AS_t rc,const char *src, const char *dst if(routing_get_network_element_type(src) == SURF_NETWORK_ELEMENT_AS) { int need_to_clean = e_route?0:1; double latency; - e_route = e_route?e_route:(*(rc->get_route)) (rc, src, dst); + e_route = e_route ? e_route : rc->get_route(rc, src, dst); latency = base_vivaldi_get_latency(e_route->src_gateway,e_route->dst_gateway); if(need_to_clean) generic_free_extended_route(e_route); return latency; diff --git a/src/surf/surfxml_parse.c b/src/surf/surfxml_parse.c index 10c9ff03d6..21ebc7404e 100644 --- a/src/surf/surfxml_parse.c +++ b/src/surf/surfxml_parse.c @@ -541,7 +541,7 @@ static XBT_INLINE void surfxml_call_cb_functions(xbt_dynar_t cb_list) unsigned int iterator; void_f_void_t fun; xbt_dynar_foreach(cb_list, iterator, fun) { - if (fun) (*fun) (); + if (fun) fun(); } } diff --git a/src/xbt/backtrace_windows.c b/src/xbt/backtrace_windows.c index fea72db4a6..0b2167c838 100644 --- a/src/xbt/backtrace_windows.c +++ b/src/xbt/backtrace_windows.c @@ -123,10 +123,10 @@ void xbt_backtrace_preinit(void) return; } - (*fun_set_options) ((*fun_get_options) () | + fun_set_options(fun_get_options() | SYMOPT_LOAD_LINES | SYMOPT_DEFERRED_LOADS); - if (!(*fun_initialize) (process_handle, 0, 1)) { + if (!fun_initialize(process_handle, 0, 1)) { FreeLibrary(hlp_dbg_instance); hlp_dbg_instance = NULL; } @@ -137,7 +137,7 @@ void xbt_backtrace_postexit(void) if (!hlp_dbg_instance) return; - if ((*fun_cleanup) (process_handle)) + if (fun_cleanup(process_handle)) FreeLibrary(hlp_dbg_instance); hlp_dbg_instance = NULL; @@ -318,9 +318,9 @@ char **backtrace_symbols(void *const *buffer, int size) if (NULL != stack_frame) { - if ((*fun_get_sym_from_addr) + if (fun_get_sym_from_addr (process_handle, stack_frame->AddrPC.Offset, &offset, pSym)) { - if ((*fun_get_line_from_addr) + if (fun_get_line_from_addr (process_handle, stack_frame->AddrPC.Offset, &offset, &line_info)) { strings[pos] = diff --git a/src/xbt/config.c b/src/xbt/config.c index 9fbffa5609..aa55aa65e1 100644 --- a/src/xbt/config.c +++ b/src/xbt/config.c @@ -829,7 +829,7 @@ void xbt_cfg_set_int(xbt_cfg_t cfg, const char *name, int val) if (variable->max == 1) { if (variable->cb_rm && xbt_dynar_length(variable->content)) - (*variable->cb_rm) (name, 0); + variable->cb_rm(name, 0); xbt_dynar_set(variable->content, 0, &val); } else { @@ -844,7 +844,7 @@ void xbt_cfg_set_int(xbt_cfg_t cfg, const char *name, int val) } if (variable->cb_set) - (*variable->cb_set) (name, xbt_dynar_length(variable->content) - 1); + variable->cb_set(name, xbt_dynar_length(variable->content) - 1); variable->isdefault = 0; } @@ -864,7 +864,7 @@ void xbt_cfg_set_double(xbt_cfg_t cfg, const char *name, double val) if (variable->max == 1) { if (variable->cb_rm && xbt_dynar_length(variable->content)) - (*variable->cb_rm) (name, 0); + variable->cb_rm(name, 0); xbt_dynar_set(variable->content, 0, &val); } else { @@ -878,7 +878,7 @@ void xbt_cfg_set_double(xbt_cfg_t cfg, const char *name, double val) } if (variable->cb_set) - (*variable->cb_set) (name, xbt_dynar_length(variable->content) - 1); + variable->cb_set(name, xbt_dynar_length(variable->content) - 1); variable->isdefault = 0; } @@ -904,7 +904,7 @@ void xbt_cfg_set_string(xbt_cfg_t cfg, const char *name, const char *val) if (variable->max == 1) { if (xbt_dynar_length(variable->content)) { if (variable->cb_rm) - (*variable->cb_rm) (name, 0); + variable->cb_rm(name, 0); else if (variable->type == xbt_cfgelm_string) { char *sval = xbt_dynar_get_as(variable->content, 0, char *); free(sval); @@ -923,7 +923,7 @@ void xbt_cfg_set_string(xbt_cfg_t cfg, const char *name, const char *val) } if (variable->cb_set) - (*variable->cb_set) (name, xbt_dynar_length(variable->content) - 1); + variable->cb_set(name, xbt_dynar_length(variable->content) - 1); variable->isdefault = 0; } @@ -950,7 +950,7 @@ xbt_cfg_set_peer(xbt_cfg_t cfg, const char *name, const char *peer, if (variable->max == 1) { if (variable->cb_rm && xbt_dynar_length(variable->content)) - (*variable->cb_rm) (name, 0); + variable->cb_rm(name, 0); xbt_dynar_set(variable->content, 0, &val); } else { @@ -964,7 +964,7 @@ xbt_cfg_set_peer(xbt_cfg_t cfg, const char *name, const char *peer, } if (variable->cb_set) - (*variable->cb_set) (name, xbt_dynar_length(variable->content) - 1); + variable->cb_set(name, xbt_dynar_length(variable->content) - 1); variable->isdefault = 0; } @@ -993,7 +993,7 @@ void xbt_cfg_rm_int(xbt_cfg_t cfg, const char *name, int val) xbt_dynar_foreach(variable->content, cpt, seen) { if (seen == val) { if (variable->cb_rm) - (*variable->cb_rm) (name, cpt); + variable->cb_rm(name, cpt); xbt_dynar_cursor_rm(variable->content, &cpt); return; } @@ -1028,7 +1028,7 @@ void xbt_cfg_rm_double(xbt_cfg_t cfg, const char *name, double val) if (seen == val) { xbt_dynar_cursor_rm(variable->content, &cpt); if (variable->cb_rm) - (*variable->cb_rm) (name, cpt); + variable->cb_rm(name, cpt); return; } } @@ -1060,7 +1060,7 @@ void xbt_cfg_rm_string(xbt_cfg_t cfg, const char *name, const char *val) xbt_dynar_foreach(variable->content, cpt, seen) { if (!strcpy(seen, val)) { if (variable->cb_rm) - (*variable->cb_rm) (name, cpt); + variable->cb_rm(name, cpt); xbt_dynar_cursor_rm(variable->content, &cpt); return; } @@ -1097,7 +1097,7 @@ xbt_cfg_rm_peer(xbt_cfg_t cfg, const char *name, const char *peer, xbt_dynar_foreach(variable->content, cpt, seen) { if (!strcpy(seen->name, peer) && seen->port == port) { if (variable->cb_rm) - (*variable->cb_rm) (name, cpt); + variable->cb_rm(name, cpt); xbt_dynar_cursor_rm(variable->content, &cpt); return; } @@ -1123,7 +1123,7 @@ void xbt_cfg_rm_at(xbt_cfg_t cfg, const char *name, int pos) pos, name, variable->min); if (variable->cb_rm) - (*variable->cb_rm) (name, pos); + variable->cb_rm(name, pos); xbt_dynar_remove_at(variable->content, pos, NULL); } @@ -1156,7 +1156,7 @@ void xbt_cfg_empty(xbt_cfg_t cfg, const char *name) unsigned int cpt; void *ignored; xbt_dynar_foreach(variable->content, cpt, ignored) { - (*variable->cb_rm) (name, cpt); + variable->cb_rm(name, cpt); } } xbt_dynar_reset(variable->content); diff --git a/src/xbt/dict.c b/src/xbt/dict.c index d591e01b9f..83e73b5be0 100644 --- a/src/xbt/dict.c +++ b/src/xbt/dict.c @@ -684,7 +684,7 @@ void xbt_dict_dump(xbt_dict_t dict, void_f_pvoid_t output) while (element != NULL) { printf(" %s -> '", element->key); if (output != NULL) { - (*output) (element->content); + output(element->content); } printf("'\n"); element = element->next; diff --git a/src/xbt/dynar.c b/src/xbt/dynar.c index 3df1edf1d5..5831a788e0 100644 --- a/src/xbt/dynar.c +++ b/src/xbt/dynar.c @@ -152,11 +152,11 @@ _xbt_dynar_remove_at(xbt_dynar_t const dynar, if (dynar->elmsize <= SIZEOF_MAX) { char elm[SIZEOF_MAX]; _xbt_dynar_get_elm(elm, dynar, idx); - (*dynar->free_f) (elm); + dynar->free_f(elm); } else { char *elm = malloc(dynar->elmsize); _xbt_dynar_get_elm(elm, dynar, idx); - (*dynar->free_f) (elm); + dynar->free_f(elm); free(elm); } } @@ -459,7 +459,7 @@ xbt_dynar_replace(xbt_dynar_t dynar, if (idx < dynar->used && dynar->free_f) { void *const old_object = _xbt_dynar_elm(dynar, idx); - (*(dynar->free_f)) (old_object); + dynar->free_f(old_object); } _xbt_dynar_set(dynar, idx, object); @@ -674,7 +674,7 @@ static void _dynar_map(const xbt_dynar_t dynar, void_f_pvoid_t const op) for (i = 0; i < used; i++) { char* elm = (char*) data + i * elmsize; - (*op) (elm); + op(elm); } } diff --git a/src/xbt/ex.c b/src/xbt/ex.c index 26d7d3d5eb..9768d5e640 100644 --- a/src/xbt/ex.c +++ b/src/xbt/ex.c @@ -140,7 +140,7 @@ void xbt_ex_display(xbt_ex_t * e) "** SimGrid: UNCAUGHT EXCEPTION received on %s(%d): category: %s; value: %d\n" "** %s\n" "** Thrown by %s()%s\n", - gras_os_myname(), (*xbt_getpid) (), + gras_os_myname(), xbt_getpid(), xbt_ex_catname(e->category), e->value, e->msg, e->procname, thrower ? thrower : " in this process"); XBT_CRITICAL("%s", e->msg); diff --git a/src/xbt/graph.c b/src/xbt/graph.c index d2f2edfd37..a56d008f66 100644 --- a/src/xbt/graph.c +++ b/src/xbt/graph.c @@ -144,12 +144,12 @@ void xbt_graph_free_graph(xbt_graph_t g, xbt_dynar_free(&(node->out)); xbt_dynar_free(&(node->in)); if (node_free_function) - (*node_free_function) (node->data); + node_free_function(node->data); } xbt_dynar_foreach(g->edges, cursor, edge) { if (edge_free_function) - (*edge_free_function) (edge->data); + edge_free_function(edge->data); } xbt_dynar_foreach(g->nodes, cursor, node) @@ -160,7 +160,7 @@ void xbt_graph_free_graph(xbt_graph_t g, free(edge); xbt_dynar_free(&(g->edges)); if (graph_free_function) - (*graph_free_function) (g->data); + graph_free_function(g->data); free(g); xbt_graph_parse_lex_destroy(); return; @@ -190,7 +190,7 @@ void xbt_graph_free_node(xbt_graph_t g, xbt_node_t n, } if ((node_free_function) && (n->data)) - (*node_free_function) (n->data); + node_free_function(n->data); cursor = 0; xbt_dynar_foreach(g->nodes, cursor, node) @@ -214,7 +214,7 @@ void xbt_graph_free_edge(xbt_graph_t g, xbt_edge_t e, xbt_edge_t edge = NULL; if ((free_function) && (e->data)) - (*free_function) (e->data); + free_function(e->data); xbt_dynar_foreach(g->edges, cursor, edge) { if (edge == e) { @@ -628,7 +628,7 @@ xbt_graph_t xbt_graph_read(const char *filename, xbt_graph_parse_open(filename); _XBT_GNUC_UNUSED int res; - res = (*xbt_graph_parse) (); + res = xbt_graph_parse(); xbt_assert(!res, "Parse error in %s", filename); xbt_graph_parse_close(); diff --git a/src/xbt/graphxml_parse.c b/src/xbt/graphxml_parse.c index 89582e7117..3edfa48e4c 100644 --- a/src/xbt/graphxml_parse.c +++ b/src/xbt/graphxml_parse.c @@ -48,34 +48,34 @@ void xbt_graph_parse_reset_parser(void) void STag_graphxml_graph(void) { - (*STag_graphxml_graph_fun) (); + STag_graphxml_graph_fun(); } void ETag_graphxml_graph(void) { - (*ETag_graphxml_graph_fun) (); + ETag_graphxml_graph_fun(); } void STag_graphxml_node(void) { - (*STag_graphxml_node_fun) (); + STag_graphxml_node_fun(); } void ETag_graphxml_node(void) { - (*ETag_graphxml_node_fun) (); + ETag_graphxml_node_fun(); } void STag_graphxml_edge(void) { - (*STag_graphxml_edge_fun) (); + STag_graphxml_edge_fun(); } void ETag_graphxml_edge(void) { - (*ETag_graphxml_edge_fun) (); + ETag_graphxml_edge_fun(); } diff --git a/src/xbt/heap.c b/src/xbt/heap.c index 71a87a0a39..a91e006bf9 100644 --- a/src/xbt/heap.c +++ b/src/xbt/heap.c @@ -61,7 +61,7 @@ void xbt_heap_free(xbt_heap_t H) int i; if (H->free) for (i = 0; i < H->count; i++) - (*(H->free)) (H->items[i].content); + H->free(H->items[i].content); free(H->items); free(H); return; diff --git a/src/xbt/mallocator.c b/src/xbt/mallocator.c index 0b416cbcc4..b8427aab25 100644 --- a/src/xbt/mallocator.c +++ b/src/xbt/mallocator.c @@ -90,7 +90,7 @@ void xbt_mallocator_free(xbt_mallocator_t m) XBT_VERB("Frees mallocator %p (size:%d/%d)", m, m->current_size, m->max_size); for (i = 0; i < m->current_size; i++) { - (*(m->free_f)) (m->objects[i]); + m->free_f(m->objects[i]); } xbt_free(m->objects); xbt_free(m); @@ -126,7 +126,7 @@ void *xbt_mallocator_get(xbt_mallocator_t m) int i; int amount = MIN(m->max_size / 2, 1000); for (i = 0; i < amount; i++) - m->objects[i] = (*(m->new_f)) (); + m->objects[i] = m->new_f(); m->current_size = amount; } @@ -135,10 +135,10 @@ void *xbt_mallocator_get(xbt_mallocator_t m) /* m, m->current_size, m->max_size); */ object = m->objects[--m->current_size]; } else { - object = (*(m->new_f)) (); + object = m->new_f(); } - (*(m->reset_f)) (object); + m->reset_f(object); return object; } @@ -167,6 +167,6 @@ void xbt_mallocator_release(xbt_mallocator_t m, void *object) /* otherwise we don't have a choice, we must free the object */ /* XBT_DEBUG("Free deleted object: mallocator %p is full (size:%d/%d)", m, m->current_size, m->max_size); */ - (*(m->free_f)) (object); + m->free_f(object); } } diff --git a/src/xbt/mmalloc/mfree.c b/src/xbt/mmalloc/mfree.c index 86b75056ce..e9e7210d7f 100644 --- a/src/xbt/mmalloc/mfree.c +++ b/src/xbt/mmalloc/mfree.c @@ -187,7 +187,7 @@ void mfree(void *md, void *ptr) } } if (mdp->mfree_hook != NULL) { - (*mdp->mfree_hook) (mdp, ptr); + mdp->mfree_hook(mdp, ptr); } else { __mmalloc_free(mdp, ptr); } diff --git a/src/xbt/mmalloc/mmalloc.c b/src/xbt/mmalloc/mmalloc.c index 1c36aa82cb..ab198a97d7 100644 --- a/src/xbt/mmalloc/mmalloc.c +++ b/src/xbt/mmalloc/mmalloc.c @@ -118,7 +118,7 @@ void *mmalloc(void *md, size_t size) // printf("(%s) Mallocing %d bytes on %p (default: %p)...",xbt_thread_self_name(),size,mdp,__mmalloc_default_mdp);fflush(stdout); if (mdp->mmalloc_hook != NULL) { - return (*mdp->mmalloc_hook) (md, size); + return mdp->mmalloc_hook(md, size); } if (!(mdp->flags & MMALLOC_INITIALIZED)) { diff --git a/src/xbt/mmalloc/mmcheck.c b/src/xbt/mmalloc/mmcheck.c index 46b48a6aec..8e0dc549e3 100644 --- a/src/xbt/mmalloc/mmcheck.c +++ b/src/xbt/mmalloc/mmcheck.c @@ -50,7 +50,7 @@ static void checkhdr(struct mdesc *mdp, const struct hdr *hdr) { if (hdr->magic != MAGICWORD || ((char *) &hdr[1])[hdr->size] != MAGICBYTE) { - (*mdp->abortfunc) (); + mdp->abortfunc(); } } diff --git a/src/xbt/mmalloc/mrealloc.c b/src/xbt/mmalloc/mrealloc.c index 14230a5fc1..aeb358a863 100644 --- a/src/xbt/mmalloc/mrealloc.c +++ b/src/xbt/mmalloc/mrealloc.c @@ -46,7 +46,7 @@ void *mrealloc(void *md, void *ptr, size_t size) } if (mdp->mrealloc_hook != NULL) { - return ((*mdp->mrealloc_hook) (md, ptr, size)); + return mdp->mrealloc_hook(md, ptr, size); } block = BLOCK(ptr); diff --git a/src/xbt/xbt_matrix.c b/src/xbt/xbt_matrix.c index 80e60d3ca0..d5f041764e 100644 --- a/src/xbt/xbt_matrix.c +++ b/src/xbt/xbt_matrix.c @@ -47,7 +47,7 @@ void xbt_matrix_free(xbt_matrix_t mat) if (mat) { if (mat->free_f) { for (i = 0; i < (mat->lines * mat->rows); i++) { - (*(mat->free_f)) ((void *) &(mat->data[i * mat->elmsize])); + mat->free_f((void *) &(mat->data[i * mat->elmsize])); } } free(mat->data); @@ -78,7 +78,7 @@ void xbt_matrix_dump(xbt_matrix_t matrix, const char *name, int coords, fprintf(stderr, " (%d,%d)=", i, j); else fprintf(stderr, " "); - (*display_fun) (xbt_matrix_get_ptr(matrix, i, j)); + display_fun(xbt_matrix_get_ptr(matrix, i, j)); } fprintf(stderr, "\n"); } @@ -128,7 +128,7 @@ void xbt_matrix_copy_values(xbt_matrix_t dst, xbt_matrix_t src, if (cpy_f) { for (j = 0; j < lsize; j++) xbt_matrix_get_as(dst, j + lpos_dst, i + rpos_dst, void *) = - (*cpy_f) (xbt_matrix_get_ptr(src, j + rpos_src, i + lpos_src)); + cpy_f(xbt_matrix_get_ptr(src, j + rpos_src, i + lpos_src)); } else { memcpy(xbt_matrix_get_ptr(dst, lpos_dst, i + rpos_dst), xbt_matrix_get_ptr(src, lpos_src, i + rpos_src), diff --git a/src/xbt/xbt_os_thread.c b/src/xbt/xbt_os_thread.c index c79d8f8aeb..a53dfc90dd 100644 --- a/src/xbt/xbt_os_thread.c +++ b/src/xbt/xbt_os_thread.c @@ -149,7 +149,7 @@ static void *wrapper_start_routine(void *s) THROWF(system_error, errcode, "pthread_setspecific failed for xbt_self_thread_key"); - void *res = (*(t->start_routine)) (t->param); + void *res = t->start_routine(t->param); if (t->detached) xbt_os_thread_free_thread_data(t); return res; diff --git a/src/xbt/xbt_rl_synchro.c b/src/xbt/xbt_rl_synchro.c index 3ae9acbcdd..a0a855b5f6 100644 --- a/src/xbt/xbt_rl_synchro.c +++ b/src/xbt/xbt_rl_synchro.c @@ -31,7 +31,7 @@ static void *xbt_thread_create_wrapper(void *p) { xbt_thread_t t = (xbt_thread_t) p; XBT_DEBUG("I'm thread %p", p); - (*t->code) (t->userparam); + t->code(t->userparam); return NULL; } diff --git a/src/xbt/xbt_sg_synchro.c b/src/xbt/xbt_sg_synchro.c index 34d22444b0..f95d16a6b5 100644 --- a/src/xbt/xbt_sg_synchro.c +++ b/src/xbt/xbt_sg_synchro.c @@ -39,7 +39,7 @@ static int xbt_thread_create_wrapper(int argc, char *argv[]) xbt_thread_t t = (xbt_thread_t) SIMIX_process_self_get_data(); SIMIX_req_process_set_data(SIMIX_process_self(), t->father_data); - (*t->code) (t->userparam); + t->code(t->userparam); if (t->joinable) { t->done = 1; xbt_mutex_acquire(t->mutex); diff --git a/src/xbt/xbt_synchro.c b/src/xbt/xbt_synchro.c index 5b78e0a0cf..f0d73b1d02 100644 --- a/src/xbt/xbt_synchro.c +++ b/src/xbt/xbt_synchro.c @@ -29,7 +29,7 @@ static void worker_wait_n_free(void *w) static void worker_wrapper(void *w) { worker_data_t me = (worker_data_t) w; - (*me->function) (me->rank, xbt_dynar_get_ptr(me->data, me->rank)); + me->function(me->rank, xbt_dynar_get_ptr(me->data, me->rank)); } void xbt_dynar_dopar(xbt_dynar_t datas, void_f_int_pvoid_t function) @@ -42,7 +42,7 @@ void xbt_dynar_dopar(xbt_dynar_t datas, void_f_int_pvoid_t function) return; /* nothing to do */ if (xbt_dynar_length(datas) == 1) { /* don't start any new thread, do it directly */ - (*function) (0, xbt_dynar_get_ptr(datas, 0)); + function(0, xbt_dynar_get_ptr(datas, 0)); return; } /* Start all workers */ -- 2.20.1