summaryrefslogtreecommitdiffstats
path: root/kexi/3rdparty/kexisql/src/btree_rb.c
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
commitf008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch)
tree8e9244c4d4957c36be81e15b566b4aa5ea26c982 /kexi/3rdparty/kexisql/src/btree_rb.c
parent1210f27b660efb7b37ff43ec68763e85a403471f (diff)
downloadkoffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz
koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kexi/3rdparty/kexisql/src/btree_rb.c')
-rw-r--r--kexi/3rdparty/kexisql/src/btree_rb.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/kexi/3rdparty/kexisql/src/btree_rb.c b/kexi/3rdparty/kexisql/src/btree_rb.c
index 3954fe6d..8d905ef0 100644
--- a/kexi/3rdparty/kexisql/src/btree_rb.c
+++ b/kexi/3rdparty/kexisql/src/btree_rb.c
@@ -123,7 +123,7 @@ struct BtRbNode {
int nData;
void *pData;
u8 isBlack; /* true for a black node, 0 for a red node */
- BtRbNode *pParent; /* Nodes parent node, NULL for the tree head */
+ BtRbNode *pParent; /* Nodes tqparent node, NULL for the tree head */
BtRbNode *pLeft; /* Nodes left child, or NULL */
BtRbNode *pRight; /* Nodes right child, or NULL */
@@ -319,7 +319,7 @@ static void print_node(BtRbNode *pNode)
/*
* Check the following properties of the red-black tree:
- * (1) - If a node is red, both of it's children are black
+ * (1) - If a node is red, both of it's tqchildren are black
* (2) - Each path from a given node to a leaf (NULL) node passes thru the
* same number of black nodes
*
@@ -329,7 +329,7 @@ static void check_redblack_tree(BtRbTree * tree, char ** msg)
{
BtRbNode *pNode;
- /* 0 -> came from parent
+ /* 0 -> came from tqparent
* 1 -> came from left
* 2 -> came from right */
int prev_step = 0;
@@ -400,34 +400,34 @@ static void check_redblack_tree(BtRbTree * tree, char ** msg)
/*
* Node pX has just been inserted into pTree (by code in sqliteRbtreeInsert()).
- * It is possible that pX is a red node with a red parent, which is a violation
+ * It is possible that pX is a red node with a red tqparent, which is a violation
* of the red-black tree properties. This function performs rotations and
* color changes to rebalance the tree
*/
static void do_insert_balancing(BtRbTree *pTree, BtRbNode *pX)
{
/* In the first iteration of this loop, pX points to the red node just
- * inserted in the tree. If the parent of pX exists (pX is not the root
+ * inserted in the tree. If the tqparent of pX exists (pX is not the root
* node) and is red, then the properties of the red-black tree are
* violated.
*
* At the start of any subsequent iterations, pX points to a red node
- * with a red parent. In all other respects the tree is a legal red-black
+ * with a red tqparent. In all other respects the tree is a legal red-black
* binary tree. */
while( pX != pTree->pHead && !pX->pParent->isBlack ){
BtRbNode *pUncle;
- BtRbNode *pGrandparent;
+ BtRbNode *pGrandtqparent;
- /* Grandparent of pX must exist and must be black. */
- pGrandparent = pX->pParent->pParent;
- assert( pGrandparent );
- assert( pGrandparent->isBlack );
+ /* Grandtqparent of pX must exist and must be black. */
+ pGrandtqparent = pX->pParent->pParent;
+ assert( pGrandtqparent );
+ assert( pGrandtqparent->isBlack );
/* Uncle of pX may or may not exist. */
- if( pX->pParent == pGrandparent->pLeft )
- pUncle = pGrandparent->pRight;
+ if( pX->pParent == pGrandtqparent->pLeft )
+ pUncle = pGrandtqparent->pRight;
else
- pUncle = pGrandparent->pLeft;
+ pUncle = pGrandtqparent->pLeft;
/* If the uncle of pX exists and is red, we do the following:
* | |
@@ -438,16 +438,16 @@ static void do_insert_balancing(BtRbTree *pTree, BtRbNode *pX)
* X(r) X(r)
*
* BEFORE AFTER
- * pX is then set to G. If the parent of G is red, then the while loop
+ * pX is then set to G. If the tqparent of G is red, then the while loop
* will run again. */
if( pUncle && !pUncle->isBlack ){
- pGrandparent->isBlack = 0;
+ pGrandtqparent->isBlack = 0;
pUncle->isBlack = 1;
pX->pParent->isBlack = 1;
- pX = pGrandparent;
+ pX = pGrandtqparent;
}else{
- if( pX->pParent == pGrandparent->pLeft ){
+ if( pX->pParent == pGrandtqparent->pLeft ){
if( pX == pX->pParent->pRight ){
/* If pX is a right-child, do the following transform, essentially
* to change pX into a left-child:
@@ -474,10 +474,10 @@ static void do_insert_balancing(BtRbTree *pTree, BtRbNode *pX)
*
* BEFORE AFTER
*/
- assert( pGrandparent == pX->pParent->pParent );
- pGrandparent->isBlack = 0;
+ assert( pGrandtqparent == pX->pParent->pParent );
+ pGrandtqparent->isBlack = 0;
pX->pParent->isBlack = 1;
- rightRotate( pTree, pGrandparent );
+ rightRotate( pTree, pGrandtqparent );
}else{
/* This code is symetric to the illustrated case above. */
@@ -485,10 +485,10 @@ static void do_insert_balancing(BtRbTree *pTree, BtRbNode *pX)
pX = pX->pParent;
rightRotate(pTree, pX);
}
- assert( pGrandparent == pX->pParent->pParent );
- pGrandparent->isBlack = 0;
+ assert( pGrandtqparent == pX->pParent->pParent );
+ pGrandtqparent->isBlack = 0;
pX->pParent->isBlack = 1;
- leftRotate( pTree, pGrandparent );
+ leftRotate( pTree, pGrandtqparent );
}
}
}
@@ -768,7 +768,7 @@ static int memRbtreeInsert(
memcpy(pData, pDataInput, nData);
/* Move the cursor to a node near the key to be inserted. If the key already
- * exists in the table, then (match == 0). In this case we can just replace
+ * exists in the table, then (match == 0). In this case we can just tqreplace
* the data associated with the entry, we don't need to manipulate the tree.
*
* If there is no exact match, then the cursor points at what would be either
@@ -951,10 +951,10 @@ static int memRbtreeDelete(RbtCursor* pCur)
}
/* First do a standard binary-tree delete (node pZ is to be deleted). How
- * to do this depends on how many children pZ has:
+ * to do this depends on how many tqchildren pZ has:
*
- * If pZ has no children or one child, then splice out pZ. If pZ has two
- * children, splice out the successor of pZ and replace the key and data of
+ * If pZ has no tqchildren or one child, then splice out pZ. If pZ has two
+ * tqchildren, splice out the successor of pZ and replace the key and data of
* pZ with the key and data of the spliced out successor. */
if( pZ->pLeft && pZ->pRight ){
BtRbNode *pTmp;
@@ -1008,7 +1008,7 @@ static int memRbtreeDelete(RbtCursor* pCur)
}
/* pZ now points at the spliced out node. pChild is the only child of pZ, or
- * NULL if pZ has no children. If pZ is black, and not the tree root, then we
+ * NULL if pZ has no tqchildren. If pZ is black, and not the tree root, then we
* will have violated the "same number of black nodes in every path to a
* leaf" property of the red-black tree. The code in do_delete_balancing()
* repairs this. */