NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: lib/47144: rbtree iteration is broken
The following reply was made to PR lib/47144; it has been noted by GNATS.
From: Jeremy Huddleston Sequoia <jeremyhu%apple.com@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc:
Subject: Re: lib/47144: rbtree iteration is broken
Date: Tue, 30 Oct 2012 14:57:23 -0700
This should fix it (not yet tested).
direction is the direction we want to travel.
minmax[direction] is the ultimate node in that direction (the end point in
that direction). We want the start point.
Index: rb.c
===================================================================
--- rb.c (revision 84243)
+++ rb.c (working copy)
@@ -976,13 +976,13 @@
#ifndef RBSMALL
if (RB_SENTINEL_P(rbt->rbt_root))
return NULL;
- return RB_NODETOITEM(rbto, rbt->rbt_minmax[direction]);
+ return RB_NODETOITEM(rbto, rbt->rbt_minmax[direction ==
RB_DIR_LEFT ? RB_DIR_RIGHT : RB_DIR_LEFT]);
#else
self = rbt->rbt_root;
if (RB_SENTINEL_P(self))
return NULL;
- while (!RB_SENTINEL_P(self->rb_nodes[direction]))
- self = self->rb_nodes[direction];
+ while (!RB_SENTINEL_P(self->rb_nodes[direction == RB_DIR_LEFT ?
RB_DIR_RIGHT : RB_DIR_LEFT]))
+ self = self->rb_nodes[direction == RB_DIR_LEFT ?
RB_DIR_RIGHT : RB_DIR_LEFT];
return RB_NODETOITEM(rbto, self);
#endif /* !RBSMALL */
}
On Oct 30, 2012, at 2:50 PM, gnats-admin%netbsd.org@localhost wrote:
> Thank you very much for your problem report.
> It has the internal identification `lib/47144'.
> The individual assigned to look at your
> report is: lib-bug-people.
>
>> Category: lib
>> Responsible: lib-bug-people
>> Synopsis: rbtree itteration is broken
>> Arrival-Date: Tue Oct 30 21:50:00 +0000 2012
>
Home |
Main Index |
Thread Index |
Old Index