diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CallTip.cxx | 3 | ||||
-rw-r--r-- | src/Document.cxx | 2 | ||||
-rw-r--r-- | src/Editor.cxx | 30 | ||||
-rw-r--r-- | src/PositionCache.cxx | 2 |
4 files changed, 14 insertions, 23 deletions
diff --git a/src/CallTip.cxx b/src/CallTip.cxx index 9f5f88476..511282eab 100644 --- a/src/CallTip.cxx +++ b/src/CallTip.cxx @@ -256,9 +256,8 @@ PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn, clickPlace = 0; if (val) delete []val; + val = 0; val = new char[strlen(defn) + 1]; - if (!val) - return PRectangle(); strcpy(val, defn); codePage = codePage_; Surface *surfaceMeasure = Surface::Allocate(); diff --git a/src/Document.cxx b/src/Document.cxx index 5fd2749a0..0eb511162 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -1760,8 +1760,6 @@ const char *BuiltinRegex::SubstituteByPosition(Document* doc, const char *text, } } substituted = new char[lenResult + 1]; - if (!substituted) - return 0; char *o = substituted; for (int j = 0; j < *length; j++) { if (text[j] == '\\') { diff --git a/src/Editor.cxx b/src/Editor.cxx index ad9437a6a..6c6922648 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -5271,12 +5271,10 @@ char *Editor::CopyRange(int start, int end) { if (start < end) { int len = end - start; text = new char[len + 1]; - if (text) { - for (int i = 0; i < len; i++) { - text[i] = pdoc->CharAt(start + i); - } - text[len] = '\0'; + for (int i = 0; i < len; i++) { + text[i] = pdoc->CharAt(start + i); } + text[len] = '\0'; } return text; } @@ -6198,19 +6196,17 @@ void Editor::AddStyledText(char *buffer, int appendLength) { // The buffer consists of alternating character bytes and style bytes size_t textLength = appendLength / 2; char *text = new char[textLength]; - if (text) { - size_t i; - for (i = 0;i < textLength;i++) { - text[i] = buffer[i*2]; - } - pdoc->InsertString(CurrentPosition(), text, textLength); - for (i = 0;i < textLength;i++) { - text[i] = buffer[i*2+1]; - } - pdoc->StartStyling(CurrentPosition(), static_cast<char>(0xff)); - pdoc->SetStyles(textLength, text); - delete []text; + size_t i; + for (i = 0;i < textLength;i++) { + text[i] = buffer[i*2]; + } + pdoc->InsertString(CurrentPosition(), text, textLength); + for (i = 0;i < textLength;i++) { + text[i] = buffer[i*2+1]; } + pdoc->StartStyling(CurrentPosition(), static_cast<char>(0xff)); + pdoc->SetStyles(textLength, text); + delete []text; SetEmptySelection(sel.MainCaret() + textLength); } diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx index 42f5fa3f3..d3e19d4f4 100644 --- a/src/PositionCache.cxx +++ b/src/PositionCache.cxx @@ -131,8 +131,6 @@ void LineLayout::SetLineStart(int line, int start) { if ((line >= lenLineStarts) && (line != 0)) { int newMaxLines = line + 20; int *newLineStarts = new int[newMaxLines]; - if (!newLineStarts) - return; for (int i = 0; i < newMaxLines; i++) { if (i < lenLineStarts) newLineStarts[i] = lineStarts[i]; |