NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/46034: rbtree code/manual mismatch



>Number:         46034
>Category:       lib
>Synopsis:       rbtree code/manual mismatch
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 17 07:05:00 +0000 2012
>Originator:     YAMAMOTO Takashi
>Release:        NetBSD current
>Organization:
        
>Environment:
        
        
>Description:
        the man page says:

     rb_tree_iterate(rbt, rb, direction)
              If direction is RB_DIR_LEFT, return the node in the tree rbt
              immediately preceding the node rb or, if rb is NULL, return the
              last node in rbt or, if the tree is empty, return NULL.

              If direction is RB_DIR_RIGHT, return the node in the tree rbt
              immediately following the node rb or, if rb is NULL, return the
              first node in rbt or, if the tree is empty, return NULL.

        but actually
        rb_tree_iterate(t, NULL, RB_DIR_LEFT) returns the left-most node and
        rb_tree_iterate(t, NULL, RB_DIR_RIGHT) returns the right-most node.

        i personally prefer the documented behaviour because it simplifies
        a loop:
                it = NULL;
                while ((it = rb_tree_iterate(t, it, RB_DIR_RIGHT)) != NULL) {
                }
        but, given that the library is already in-use, probably it's better
        to fix the man page.  (so i filed this as doc-bug.)

>How-To-Repeat:
        
>Fix:
        

>Unformatted:
        
        


Home | Main Index | Thread Index | Old Index