diff options
author | nyamatongwe <unknown> | 2009-07-12 23:31:36 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2009-07-12 23:31:36 +0000 |
commit | 290b272cdaf0c0f04d3536080f3918893e489094 (patch) | |
tree | c8fa0033ee165c14327614447d92ae00bcd79bfa /src/SVector.h | |
parent | 26c0795acabf1964ac9ba6dc7e212d58d9714c83 (diff) | |
download | scintilla-mirror-290b272cdaf0c0f04d3536080f3918893e489094.tar.gz |
Since now using exceptions, don't check result from new.
Diffstat (limited to 'src/SVector.h')
-rw-r--r-- | src/SVector.h | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/src/SVector.h b/src/SVector.h index 9f56da528..7b929190d 100644 --- a/src/SVector.h +++ b/src/SVector.h @@ -23,7 +23,6 @@ class SVector { int *v; ///< The vector unsigned int size; ///< Number of elements allocated unsigned int len; ///< Number of elements used in vector - bool allocFailure; ///< A memory allocation call has failed /** Internally allocate more elements than the user wants * to avoid thrashing the memory allocator. */ @@ -33,12 +32,8 @@ class SVector { else newSize = (newSize * 3) / 2; int* newv = new int[newSize]; - if (!newv) { - allocFailure = true; - return; - } size = newSize; - unsigned int i=0; + unsigned int i=0; for (; i<len; i++) { newv[i] = v[i]; } @@ -51,7 +46,6 @@ class SVector { public: SVector() { - allocFailure = false; v = 0; len = 0; size = 0; @@ -61,33 +55,27 @@ public: } /// Constructor from another vector. SVector(const SVector &other) { - allocFailure = false; v = 0; len = 0; size = 0; if (other.Length() > 0) { SizeTo(other.Length()); - if (!allocFailure) { - for (int i=0;i<other.Length();i++) - v[i] = other.v[i]; - len = other.Length(); - } + for (int i=0;i<other.Length();i++) + v[i] = other.v[i]; + len = other.Length(); } } /// Copy constructor. SVector &operator=(const SVector &other) { if (this != &other) { delete []v; - allocFailure = false; v = 0; len = 0; size = 0; if (other.Length() > 0) { SizeTo(other.Length()); - if (!allocFailure) { - for (int i=0;i<other.Length();i++) - v[i] = other.v[i]; - } + for (int i=0;i<other.Length();i++) + v[i] = other.v[i]; len = other.Length(); } } |