diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2016-11-20 05:27:10 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2016-11-20 05:54:44 +0100 |
commit | 19675a1a4899f68a4e7afbd45cebc63b544650e4 (patch) | |
tree | 22815deaea7a791cd86ea276fe1b20de3c558512 /src/rbtree.cpp | |
parent | 255c8085c1132ce79db82fc620a76bab5f8709de (diff) | |
download | sciteco-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/rbtree.cpp')
-rw-r--r-- | src/rbtree.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/rbtree.cpp b/src/rbtree.cpp index 5b1a4e1..79c63d6 100644 --- a/src/rbtree.cpp +++ b/src/rbtree.cpp @@ -48,7 +48,7 @@ auto_complete(const gchar *key, gchar completed, gsize restrict_len) for (RBEntryString *cur = nfind(key); cur && !StringNCmp(cur->key, key, key_len); - cur = (RBEntryString *)cur->next()) { + cur = cur->next()) { if (restrict_len && strlen(cur->key) != restrict_len) continue; @@ -68,7 +68,7 @@ auto_complete(const gchar *key, gchar completed, gsize restrict_len) if (!insert && prefixed_entries > 1) { for (RBEntryString *cur = first; cur && !StringNCmp(cur->key, key, key_len); - cur = (RBEntryString *)cur->next()) { + cur = cur->next()) { if (restrict_len && strlen(cur->key) != restrict_len) continue; |