aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CellBuffer.cxx2
-rw-r--r--src/Document.cxx4
-rw-r--r--src/Editor.h11
-rw-r--r--src/SVector.h24
4 files changed, 10 insertions, 31 deletions
diff --git a/src/CellBuffer.cxx b/src/CellBuffer.cxx
index 5385cccde..0868cf251 100644
--- a/src/CellBuffer.cxx
+++ b/src/CellBuffer.cxx
@@ -150,8 +150,6 @@ void UndoHistory::EnsureUndoRoom() {
// Run out of undo nodes so extend the array
int lenActionsNew = lenActions * 2;
Action *actionsNew = new Action[lenActionsNew];
- if (!actionsNew)
- return;
for (int act = 0; act <= currentAction; act++)
actionsNew[act].Grab(&actions[act]);
delete []actions;
diff --git a/src/Document.cxx b/src/Document.cxx
index 0eb511162..fdf8261d9 100644
--- a/src/Document.cxx
+++ b/src/Document.cxx
@@ -1376,8 +1376,6 @@ bool Document::AddWatcher(DocWatcher *watcher, void *userData) {
return false;
}
WatcherWithUserData *pwNew = new WatcherWithUserData[lenWatchers + 1];
- if (!pwNew)
- return false;
for (int j = 0; j < lenWatchers; j++)
pwNew[j] = watchers[j];
pwNew[lenWatchers].watcher = watcher;
@@ -1398,8 +1396,6 @@ bool Document::RemoveWatcher(DocWatcher *watcher, void *userData) {
lenWatchers = 0;
} else {
WatcherWithUserData *pwNew = new WatcherWithUserData[lenWatchers];
- if (!pwNew)
- return false;
for (int j = 0; j < lenWatchers - 1; j++) {
pwNew[j] = (j < i) ? watchers[j] : watchers[j + 1];
}
diff --git a/src/Editor.h b/src/Editor.h
index de7aac98f..79746477e 100644
--- a/src/Editor.h
+++ b/src/Editor.h
@@ -78,14 +78,11 @@ public:
}
void Copy(const char *s_, int len_, int codePage_, int characterSet_, bool rectangular_, bool lineCopy_) {
delete []s;
+ s = 0;
s = new char[len_];
- if (s) {
- len = len_;
- for (int i = 0; i < len_; i++) {
- s[i] = s_[i];
- }
- } else {
- len = 0;
+ len = len_;
+ for (int i = 0; i < len_; i++) {
+ s[i] = s_[i];
}
codePage = codePage_;
characterSet = characterSet_;
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();
}
}