A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
please sonar by removing useless asignments and return statements
[simgrid.git]
/
examples
/
msg
/
actions-comm
/
actions-comm.c
diff --git
a/examples/msg/actions-comm/actions-comm.c
b/examples/msg/actions-comm/actions-comm.c
index
8bcbc17
..
e9888db
100644
(file)
--- a/
examples/msg/actions-comm/actions-comm.c
+++ b/
examples/msg/actions-comm/actions-comm.c
@@
-19,7
+19,9
@@
typedef struct {
/* Used to implement irecv+wait */
xbt_dynar_t irecvs; /* of msg_comm_t */
xbt_dynar_t tasks; /* of msg_task_t */
/* Used to implement irecv+wait */
xbt_dynar_t irecvs; /* of msg_comm_t */
xbt_dynar_t tasks; /* of msg_task_t */
-} s_process_globals_t, *process_globals_t;
+} s_process_globals_t;
+
+typedef s_process_globals_t *process_globals_t;
/* Helper function */
static double parse_double(const char *string)
/* Helper function */
static double parse_double(const char *string)
@@
-172,7
+174,8
@@
static void action_barrier(const char *const *action)
ACT_DEBUG("Entering barrier: %s (%d already there)", NAME, processes_arrived_sofar);
simcall_mutex_lock(mutex);
ACT_DEBUG("Entering barrier: %s (%d already there)", NAME, processes_arrived_sofar);
simcall_mutex_lock(mutex);
- if (++processes_arrived_sofar == communicator_size) {
+ processes_arrived_sofar++;
+ if (processes_arrived_sofar == communicator_size) {
simcall_cond_broadcast(cond);
simcall_mutex_unlock(mutex);
} else {
simcall_cond_broadcast(cond);
simcall_mutex_unlock(mutex);
} else {
@@
-203,7
+206,8
@@
static void action_bcast(const char *const *action)
const char * process_name = MSG_process_get_name(MSG_process_self());
const char * process_name = MSG_process_get_name(MSG_process_self());
- char *bcast_identifier = bprintf("bcast_%d", counters->bcast_counter++);
+ char *bcast_identifier = bprintf("bcast_%d", counters->bcast_counter);
+ counters->bcast_counter++;
if (!strcmp(process_name, "p0")) {
XBT_DEBUG("%s: %s is the Root", bcast_identifier, process_name);
if (!strcmp(process_name, "p0")) {
XBT_DEBUG("%s: %s is the Root", bcast_identifier, process_name);
@@
-276,8
+280,6
@@
static void action_finalize(const char *const *action)
int main(int argc, char *argv[])
{
int main(int argc, char *argv[])
{
- msg_error_t res = MSG_OK;
-
/* Check the given arguments */
MSG_init(&argc, argv);
/* Explicit initialization of the action module is required now*/
/* Check the given arguments */
MSG_init(&argc, argv);
/* Explicit initialization of the action module is required now*/
@@
-308,7
+310,7
@@
int main(int argc, char *argv[])
xbt_replay_action_register("compute", action_compute);
/* Actually do the simulation using MSG_action_trace_run */
xbt_replay_action_register("compute", action_compute);
/* Actually do the simulation using MSG_action_trace_run */
-
res = MSG_action_trace_run(argv[3]);
// it's ok to pass a NULL argument here
+
msg_error_t res = MSG_action_trace_run(argv[3]);
// it's ok to pass a NULL argument here
XBT_INFO("Simulation time %g", MSG_get_clock());
XBT_INFO("Simulation time %g", MSG_get_clock());