Commit 4ff98a9a authored by Warren Dukes's avatar Warren Dukes

fix a bug when deleting node and CHILDREN_PER_NODE is even

git-svn-id: https://svn.musicpd.org/mpd/trunk@4508 09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent 42390c5e
...@@ -433,7 +433,7 @@ _DeleteAt(TreeIterator * iter) ...@@ -433,7 +433,7 @@ _DeleteAt(TreeIterator * iter)
node->data[--node->dataCount] = NULL; node->data[--node->dataCount] = NULL;
// merge the nodes from the bottom up which have too few data // merge the nodes from the bottom up which have too few data
while (node->dataCount < (CHILDREN_PER_NODE/2)) while (node->dataCount < (DATA_PER_NODE/2))
{ {
// if we're not the root // if we're not the root
if (node->parent) if (node->parent)
...@@ -443,7 +443,7 @@ _DeleteAt(TreeIterator * iter) ...@@ -443,7 +443,7 @@ _DeleteAt(TreeIterator * iter)
// check siblings for extra data // check siblings for extra data
if (pos < node->parent->dataCount && if (pos < node->parent->dataCount &&
(*(child+1))->dataCount > (CHILDREN_PER_NODE/2)) (*(child+1))->dataCount > (DATA_PER_NODE/2))
{ {
child++; child++;
node->data[node->dataCount++] = node->data[node->dataCount++] =
...@@ -470,7 +470,7 @@ _DeleteAt(TreeIterator * iter) ...@@ -470,7 +470,7 @@ _DeleteAt(TreeIterator * iter)
(*child)->dataCount--; (*child)->dataCount--;
} }
else if (pos > 0 && else if (pos > 0 &&
(*(child-1))->dataCount>(CHILDREN_PER_NODE/2)) (*(child-1))->dataCount>(DATA_PER_NODE/2))
{ {
child--; child--;
int i = node->dataCount++; int i = node->dataCount++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment