1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-16 16:42:29 +03:00

Remove pre-order and post-order traversal logic for red-black trees.

This code isn't used, and there's no clear reason why anybody would ever
want to use it.  These traversal mechanisms don't yield a visitation order
that is semantically meaningful for any external purpose, nor are they
any faster or simpler than the left-to-right or right-to-left traversals.
(In fact, some rough testing suggests they are slower :-(.)  Moreover,
these mechanisms are impossible to test in any arm's-length fashion; doing
so requires knowledge of the red-black tree's internal implementation.
Hence, let's just jettison them.

Discussion: https://postgr.es/m/17735.1505003111@sss.pgh.pa.us
This commit is contained in:
Tom Lane
2017-09-10 13:19:11 -04:00
parent c824c7e29f
commit f80e782a6b
2 changed files with 3 additions and 131 deletions

View File

@@ -35,9 +35,7 @@ typedef struct RBTree RBTree;
typedef enum RBOrderControl
{
LeftRightWalk, /* inorder: left child, node, right child */
RightLeftWalk, /* reverse inorder: right, node, left */
DirectWalk, /* preorder: node, left child, right child */
InvertedWalk /* postorder: left child, right child, node */
RightLeftWalk /* reverse inorder: right, node, left */
} RBOrderControl;
/*
@@ -52,7 +50,6 @@ struct RBTreeIterator
RBTree *rb;
RBNode *(*iterate) (RBTreeIterator *iter);
RBNode *last_visited;
char next_step;
bool is_over;
};