diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2008-02-19 04:42:00 +0000 |
---|---|---|
committer | Erik Schnetter <schnetter@cct.lsu.edu> | 2008-02-19 04:42:00 +0000 |
commit | 415624ed605cde362bab5e6859d62c5504450786 (patch) | |
tree | 944db932f89a356b7303e9ec59ac9485719d5611 /Carpet/CarpetLib/src/commstate.hh | |
parent | b088ef34d038e0942f588879fc83d8591974ef7e (diff) |
CarpetLib: Use vector<char> instead of new char in commstate class
Use vector<char> instead of new char[] in the commstate class. This
corrects a memory management error.
Use .AT() instead of [] to access vector elements to catch indexing
errors.
darcs-hash:20080219044221-dae7b-ecd72b45833617920a33311953d5c2f00c42568c.gz
Diffstat (limited to 'Carpet/CarpetLib/src/commstate.hh')
-rw-r--r-- | Carpet/CarpetLib/src/commstate.hh | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Carpet/CarpetLib/src/commstate.hh b/Carpet/CarpetLib/src/commstate.hh index aac7e4f64..8bc3d0869 100644 --- a/Carpet/CarpetLib/src/commstate.hh +++ b/Carpet/CarpetLib/src/commstate.hh @@ -51,8 +51,8 @@ public: // structure describing a per-processor buffer for collective communications struct procbufdesc { // the allocated communication buffers - char* sendbufbase; - char* recvbufbase; + vector<char> sendbufbase; + vector<char> recvbufbase; // the sizes of communication buffers (in elements of type <datatype>) size_t sendbufsize; @@ -64,8 +64,7 @@ public: char* recvbuf; // constructor for an instance of this structure - procbufdesc() : sendbufbase(NULL), recvbufbase(NULL), - sendbufsize(0), recvbufsize(0), + procbufdesc() : sendbufsize(0), recvbufsize(0), sendbuf(NULL), recvbuf(NULL) { } |