aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--gtk/PlatGTK.cxx8
-rw-r--r--lexlib/WordList.cxx30
-rw-r--r--src/Editor.cxx12
-rw-r--r--src/PerLine.cxx4
-rw-r--r--src/PositionCache.cxx10
-rw-r--r--win32/PlatWin.cxx8
6 files changed, 27 insertions, 45 deletions
diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx
index 8e225d0a5..1227452b8 100644
--- a/gtk/PlatGTK.cxx
+++ b/gtk/PlatGTK.cxx
@@ -301,11 +301,9 @@ FontID FontCached::FindOrCreate(const FontParameters &fp) {
}
if (ret == 0) {
FontCached *fc = new FontCached(fp);
- if (fc) {
- fc->next = first;
- first = fc;
- ret = fc->fid;
- }
+ fc->next = first;
+ first = fc;
+ ret = fc->fid;
}
FontMutexUnlock();
return ret;
diff --git a/lexlib/WordList.cxx b/lexlib/WordList.cxx
index 9c2c9653b..07ca015e3 100644
--- a/lexlib/WordList.cxx
+++ b/lexlib/WordList.cxx
@@ -45,26 +45,22 @@ static char **ArrayFromWordList(char *wordlist, int *len, bool onlyLineEnds = fa
prev = curr;
}
char **keywords = new char *[words + 1];
- if (keywords) {
- words = 0;
- prev = '\0';
- size_t slen = strlen(wordlist);
- for (size_t k = 0; k < slen; k++) {
- if (!wordSeparator[static_cast<unsigned char>(wordlist[k])]) {
- if (!prev) {
- keywords[words] = &wordlist[k];
- words++;
- }
- } else {
- wordlist[k] = '\0';
+ words = 0;
+ prev = '\0';
+ size_t slen = strlen(wordlist);
+ for (size_t k = 0; k < slen; k++) {
+ if (!wordSeparator[static_cast<unsigned char>(wordlist[k])]) {
+ if (!prev) {
+ keywords[words] = &wordlist[k];
+ words++;
}
- prev = wordlist[k];
+ } else {
+ wordlist[k] = '\0';
}
- keywords[words] = &wordlist[slen];
- *len = words;
- } else {
- *len = 0;
+ prev = wordlist[k];
}
+ keywords[words] = &wordlist[slen];
+ *len = words;
return keywords;
}
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 430469d5f..63deb701a 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -9069,9 +9069,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_CREATEDOCUMENT: {
Document *doc = new Document();
- if (doc) {
- doc->AddRef();
- }
+ doc->AddRef();
return reinterpret_cast<sptr_t>(doc);
}
@@ -9085,11 +9083,9 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_CREATELOADER: {
Document *doc = new Document();
- if (doc) {
- doc->AddRef();
- doc->Allocate(wParam);
- doc->SetUndoCollection(false);
- }
+ doc->AddRef();
+ doc->Allocate(wParam);
+ doc->SetUndoCollection(false);
return reinterpret_cast<sptr_t>(static_cast<ILoader *>(doc));
}
diff --git a/src/PerLine.cxx b/src/PerLine.cxx
index cc46fb9a2..7e25e4823 100644
--- a/src/PerLine.cxx
+++ b/src/PerLine.cxx
@@ -68,8 +68,6 @@ bool MarkerHandleSet::Contains(int handle) const {
bool MarkerHandleSet::InsertHandle(int handle, int markerNum) {
MarkerHandleNumber *mhn = new MarkerHandleNumber;
- if (!mhn)
- return false;
mhn->handle = handle;
mhn->number = markerNum;
mhn->next = root;
@@ -200,8 +198,6 @@ int LineMarkers::AddMark(int line, int markerNum, int lines) {
if (!markers[line]) {
// Need new structure to hold marker handle
markers[line] = new MarkerHandleSet();
- if (!markers[line])
- return -1;
}
markers[line]->InsertHandle(handleCurrent, markerNum);
diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx
index 9fb045636..b03a97d38 100644
--- a/src/PositionCache.cxx
+++ b/src/PositionCache.cxx
@@ -309,12 +309,10 @@ LineLayout *LineLayoutCache::Retrieve(int lineNumber, int lineCaret, int maxChar
if (!cache[pos]) {
cache[pos] = new LineLayout(maxChars);
}
- if (cache[pos]) {
- cache[pos]->lineNumber = lineNumber;
- cache[pos]->inCache = true;
- ret = cache[pos];
- useCount++;
- }
+ cache[pos]->lineNumber = lineNumber;
+ cache[pos]->inCache = true;
+ ret = cache[pos];
+ useCount++;
}
}
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index b73f0fee7..c746bfcb2 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -407,11 +407,9 @@ FontID FontCached::FindOrCreate(const FontParameters &fp) {
}
if (ret == 0) {
FontCached *fc = new FontCached(fp);
- if (fc) {
- fc->next = first;
- first = fc;
- ret = fc->fid;
- }
+ fc->next = first;
+ first = fc;
+ ret = fc->fid;
}
::LeaveCriticalSection(&crPlatformLock);
return ret;