aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2015-03-02 00:18:52 +0100
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2015-03-02 00:18:52 +0100
commit7b0e9feee71bf739331d5bd6a4d7a73d163c7370 (patch)
tree7031c8e330993d350e9610dbbd844c1efa064e37
parent800bbd8a13ccee0a82b61a47a04b01d1b2b68976 (diff)
downloadsciteco-7b0e9feee71bf739331d5bd6a4d7a73d163c7370.tar.gz
minor optimization: no need to check for NULL when using C++ delete operator
-rw-r--r--src/parser.cpp3
-rw-r--r--src/qregisters.h3
-rw-r--r--src/ring.h3
-rw-r--r--src/undo.h6
4 files changed, 5 insertions, 10 deletions
diff --git a/src/parser.cpp b/src/parser.cpp
index 0193e19..ce77aaf 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -418,8 +418,7 @@ StateEscaped:
StringBuildingMachine::~StringBuildingMachine()
{
- if (qregspec_machine)
- delete qregspec_machine;
+ delete qregspec_machine;
}
State *
diff --git a/src/qregisters.h b/src/qregisters.h
index ff4da87..0f2404a 100644
--- a/src/qregisters.h
+++ b/src/qregisters.h
@@ -274,8 +274,7 @@ class QRegisterStack {
~UndoTokenPush()
{
- if (entry)
- delete entry;
+ delete entry;
}
void run(void);
diff --git a/src/ring.h b/src/ring.h
index 0aa12f0..d2e9d7b 100644
--- a/src/ring.h
+++ b/src/ring.h
@@ -143,8 +143,7 @@ extern class Ring {
: UndoToken(), ring(_ring), buffer(_buffer) {}
~UndoTokenEdit()
{
- if (buffer)
- delete buffer;
+ delete buffer;
}
void run(void);
diff --git a/src/undo.h b/src/undo.h
index 028d73c..9fc5925 100644
--- a/src/undo.h
+++ b/src/undo.h
@@ -145,15 +145,13 @@ public:
~UndoTokenObject()
{
- if (obj)
- delete obj;
+ delete obj;
}
void
run(void)
{
- if (*ptr)
- delete *ptr;
+ delete *ptr;
*ptr = obj;
obj = NULL;
}