Fix a bug causing tree first / last convenience pointers to be incorrect upon last node removal.
This commit is contained in:
parent
e8a7044f14
commit
686d300046
1 changed files with 6 additions and 6 deletions
|
@ -300,18 +300,18 @@ do { \
|
|||
typeof(e) x, y, z = e, x_parent, w; \
|
||||
\
|
||||
y = z; \
|
||||
if (y == (head)->first) { \
|
||||
(head)->first = RB_NEXT(y, field); \
|
||||
} \
|
||||
if (y == (head)->last) { \
|
||||
(head)->last = RB_PREV(y, field); \
|
||||
} \
|
||||
if (y->field.left == NULL) { \
|
||||
x = y->field.right; \
|
||||
if (y == (head)->first) { \
|
||||
(head)->first = RB_NEXT(y, field); \
|
||||
} \
|
||||
} \
|
||||
else { \
|
||||
if (y->field.right == NULL) { \
|
||||
x = y->field.left; \
|
||||
if (y == (head)->last) { \
|
||||
(head)->last = RB_PREV(y, field); \
|
||||
} \
|
||||
} \
|
||||
else { \
|
||||
y = y->field.right; \
|
||||
|
|
Loading…
Add table
Reference in a new issue