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
Change malloc/free to new/delete.
[simgrid.git]
/
src
/
smpi
/
colls
/
bcast
/
bcast-flattree.cpp
diff --git
a/src/smpi/colls/bcast/bcast-flattree.cpp
b/src/smpi/colls/bcast/bcast-flattree.cpp
index
79e9fe7
..
175c875
100644
(file)
--- a/
src/smpi/colls/bcast/bcast-flattree.cpp
+++ b/
src/smpi/colls/bcast/bcast-flattree.cpp
@@
-1,4
+1,4
@@
-/* Copyright (c) 2013-201
7
. The SimGrid Team.
+/* Copyright (c) 2013-201
9
. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
@@
-11,9
+11,6
@@
int
Coll_bcast_flattree::bcast(void *buff, int count, MPI_Datatype data_type,
int root, MPI_Comm comm)
{
Coll_bcast_flattree::bcast(void *buff, int count, MPI_Datatype data_type,
int root, MPI_Comm comm)
{
- MPI_Request *req_ptr;
- MPI_Request *reqs;
-
int i, rank, num_procs;
int tag = COLL_TAG_BCAST;
int i, rank, num_procs;
int tag = COLL_TAG_BCAST;
@@
-25,8
+22,8
@@
Coll_bcast_flattree::bcast(void *buff, int count, MPI_Datatype data_type,
}
else {
}
else {
-
reqs = (MPI_Request *) xbt_malloc((num_procs - 1) * sizeof(MPI_Request))
;
- req_ptr = reqs;
+
MPI_Request* reqs = new MPI_Request[num_procs - 1]
;
+
MPI_Request*
req_ptr = reqs;
// Root sends data to all others
for (i = 0; i < num_procs; i++) {
// Root sends data to all others
for (i = 0; i < num_procs; i++) {
@@
-38,7
+35,7
@@
Coll_bcast_flattree::bcast(void *buff, int count, MPI_Datatype data_type,
// wait on all requests
Request::waitall(num_procs - 1, reqs, MPI_STATUSES_IGNORE);
// wait on all requests
Request::waitall(num_procs - 1, reqs, MPI_STATUSES_IGNORE);
-
free(reqs)
;
+
delete[] reqs
;
}
return MPI_SUCCESS;
}
}
return MPI_SUCCESS;
}