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
Compile with flag NDEBUG.
[simgrid.git]
/
examples
/
msg
/
icomms
/
peer2.c
diff --git
a/examples/msg/icomms/peer2.c
b/examples/msg/icomms/peer2.c
old mode 100755
(executable)
new mode 100644
(file)
index
6a0d0fc
..
2db1409
--- a/
examples/msg/icomms/peer2.c
+++ b/
examples/msg/icomms/peer2.c
@@
-28,8
+28,7
@@
int sender(int argc, char *argv[])
double task_comm_size = atof(argv[3]);
long receivers_count = atol(argv[4]);
double task_comm_size = atof(argv[3]);
long receivers_count = atol(argv[4]);
- msg_comm_t *comm =
- malloc((number_of_tasks + receivers_count) * sizeof(msg_comm_t));
+ msg_comm_t *comm = xbt_new(msg_comm_t, number_of_tasks + receivers_count);
int i;
m_task_t task = NULL;
for (i = 0; i < number_of_tasks; i++) {
int i;
m_task_t task = NULL;
for (i = 0; i < number_of_tasks; i++) {
@@
-55,6
+54,7
@@
int sender(int argc, char *argv[])
MSG_comm_waitall(comm, (number_of_tasks + receivers_count), -1);
INFO0("Goodbye now!");
MSG_comm_waitall(comm, (number_of_tasks + receivers_count), -1);
INFO0("Goodbye now!");
+ xbt_free(comm);
return 0;
} /* end_of_sender */
return 0;
} /* end_of_sender */
@@
-66,8
+66,9
@@
int receiver(int argc, char *argv[])
int id = -1;
char mailbox[80];
msg_comm_t res_irecv;
int id = -1;
char mailbox[80];
msg_comm_t res_irecv;
- xbt_assert1(sscanf(argv[1], "%d", &id),
- "Invalid argument %s\n", argv[1]);
+ int read;
+ read = sscanf(argv[1], "%d", &id);
+ xbt_assert1(read, "Invalid argument %s\n", argv[1]);
MSG_process_sleep(10);
sprintf(mailbox, "receiver-%d", id);
while (1) {
MSG_process_sleep(10);
sprintf(mailbox, "receiver-%d", id);
while (1) {
@@
-126,7
+127,6
@@
int main(int argc, char *argv[])
exit(1);
}
res = test_all(argv[1], argv[2]);
exit(1);
}
res = test_all(argv[1], argv[2]);
- SIMIX_message_sizes_output("toto.txt");
MSG_clean();
if (res == MSG_OK)
MSG_clean();
if (res == MSG_OK)