From 18f179284015f502ea688ac2c62035805975fc50 Mon Sep 17 00:00:00 2001 From: Francesco Chemolli Date: Wed, 31 Dec 2014 00:12:49 +0100 Subject: [PATCH] Interim: remove SplayNode this==NULL checks --- include/splay.h | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/include/splay.h b/include/splay.h index 42475d4dc3..c37b1a60f3 100644 --- a/include/splay.h +++ b/include/splay.h @@ -34,7 +34,6 @@ public: mutable SplayNode *right; void destroy(SPLAYFREE * = DefaultFree); void walk(SPLAYWALKEE *, void *callerState); - bool empty() const { return this == NULL; } SplayNode const * start() const; SplayNode const * finish() const; @@ -117,9 +116,6 @@ template void SplayNode::walk(SPLAYWALKEE * walkee, void *state) { - if (this == NULL) - return; - if (left) left->walk(walkee, state); @@ -133,7 +129,7 @@ template SplayNode const * SplayNode::start() const { - if (this && left) + if (left) return left->start(); return this; @@ -143,7 +139,7 @@ template SplayNode const * SplayNode::finish() const { - if (this && right) + if (right) return right->finish(); return this; @@ -153,9 +149,6 @@ template void SplayNode::destroy(SPLAYFREE * free_func) { - if (!this) - return; - if (left) left->destroy(free_func); @@ -171,9 +164,6 @@ template SplayNode * SplayNode::remove(Value const dataToRemove, SPLAYCMP * compare) { - if (this == NULL) - return NULL; - SplayNode *result = splay(dataToRemove, compare); if (splayLastResult == 0) { /* found it */ @@ -202,12 +192,6 @@ SplayNode::insert(Value dataToInsert, SPLAYCMP * compare) /* create node to insert */ SplayNode *newNode = new SplayNode(dataToInsert); - if (this == NULL) { - splayLastResult = -1; - newNode->left = newNode->right = NULL; - return newNode; - } - SplayNode *newTop = splay(dataToInsert, compare); if (splayLastResult < 0) { @@ -232,12 +216,6 @@ template SplayNode * SplayNode::splay(FindValue const &dataToFind, int( * compare)(FindValue const &a, Value const &b)) const { - if (this == NULL) { - /* can't have compared successfully :} */ - splayLastResult = -1; - return NULL; - } - Value temp = Value(); SplayNode N(temp); SplayNode *l; -- 2.47.3