Skip to content

Commit

Permalink
Fix rbtree
Browse files Browse the repository at this point in the history
  • Loading branch information
MaskRay authored and Maijin committed Sep 15, 2017
1 parent 42efdf3 commit 4e88e0c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions unit/test_rbtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ static void freefn(RBNode *a) {
}

static void size(RBNode *a_) {
int i;
struct Node *a = container_of (a_, struct Node, rb);
a->size = 1;
for (int i = 0; i < 2; i++) {
for (i = 0; i < 2; i++) {
if (a_->child[i]) {
a->size += container_of (a_->child[i], struct Node, rb)->size;
}
Expand Down Expand Up @@ -148,7 +149,7 @@ static bool insert_delete(int *a, int n, RBNodeSum sum) {
}

random_iota (a, n);
for (int i = 0; i < n; i++) {
for (i = 0; i < n; i++) {
struct Node x = {.key = a[i]};
t = r_rbtree_aug_delete (&tree, &x, cmp, freefn, sum);
mu_assert (t, "delete");
Expand Down

0 comments on commit 4e88e0c

Please sign in to comment.