aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/qregisters.cpp
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2016-11-20 05:27:10 +0100
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2016-11-20 05:54:44 +0100
commit19675a1a4899f68a4e7afbd45cebc63b544650e4 (patch)
tree22815deaea7a791cd86ea276fe1b20de3c558512 /src/qregisters.cpp
parent255c8085c1132ce79db82fc620a76bab5f8709de (diff)
downloadsciteco-19675a1a4899f68a4e7afbd45cebc63b544650e4.tar.gz
optimized RBTree: avoid unnecessary virtual RBTree and RBEntry implementation classes
* whenever the implementation class was not exactly RBEntryType, it had to have a virtual destructor since RBTree cared about cleanup and had to delete its members. * Since it does not allocate them, it is consistent to remove RBTree::clear(). The destructor now only checks that subclasses have cleaned up. Implementing cleanup in the subclasses is trivial. * Consequently, RBEntryString no longer has to be virtual. HelpIndex and GotoTables are completely non-virtual now which saves memory (and a bit of cleanup speed). For QRegister, not much changes, though.
Diffstat (limited to 'src/qregisters.cpp')
-rw-r--r--src/qregisters.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/qregisters.cpp b/src/qregisters.cpp
index f6c89a8..821cbc2 100644
--- a/src/qregisters.cpp
+++ b/src/qregisters.cpp
@@ -841,7 +841,7 @@ QRegisterTable::update_environ(void)
/**
* Free resources associated with table.
*
- * This is similar to RBTree::clear() but
+ * This is similar to the destructor but
* has the advantage that we can check whether some
* register is currently edited.
* Since this is not a destructor, we can throw
@@ -859,8 +859,7 @@ QRegisterTable::clear(void)
throw Error("Currently edited Q-Register \"%s\" "
"cannot be discarded", cur->name);
- remove(cur);
- delete cur;
+ delete (QRegister *)remove(cur);
}
}