NetBSD Problem Report #46034

From yamt@NetBSD.org  Fri Feb 17 07:01:13 2012
Return-Path: <yamt@NetBSD.org>
Received: by www.NetBSD.org (Postfix, from userid 1270)
	id F252463D712; Fri, 17 Feb 2012 07:01:12 +0000 (UTC)
Message-Id: <20120217070112.F252463D712@www.NetBSD.org>
Date: Fri, 17 Feb 2012 07:01:12 +0000 (UTC)
From: yamt@NetBSD.org
Reply-To: yamt@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: rbtree code/manual mismatch
X-Send-Pr-Version: 3.95

>Number:         46034
>Category:       lib
>Synopsis:       rbtree code/manual mismatch
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          closed
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 17 07:05:00 +0000 2012
>Closed-Date:    Thu Mar 14 18:31:54 +0000 2013
>Last-Modified:  Mon Oct 27 05:55:00 +0000 2014
>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:


>Release-Note:

>Audit-Trail:
From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/46034 CVS commit: src/share/man/man3
Date: Wed, 13 Mar 2013 13:38:06 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Wed Mar 13 13:38:05 UTC 2013

 Modified Files:
 	src/share/man/man3: rbtree.3

 Log Message:
 Fix documentation of rbtree(3) iteration.

 . Fix sense of rb_tree_iterate(rbt, NULL, ...).
 . Document RB_TREE_MIN/RB_TREE_MAX to avoid relying on that sense.
 . Document RB_TREE_FOREACH and RB_TREE_FOREACH_REVERSE to simplify
 iteration.

 Addresses PR lib/46034 and PR lib/47144.  It would have been nice to
 make `x = NULL; while ((x = rb_tree_iterate(t, NULL, ...)) != NULL)'
 DTRT to traverse t, but it's too much late for that now.

 We probably ought to have an RB_TREE_FOREACH{,_REVERSE}_SAFE too.

 ok christos


 To generate a diff of this commit:
 cvs rdiff -u -r1.7 -r1.8 src/share/man/man3/rbtree.3

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Thu, 14 Mar 2013 18:31:54 +0000
State-Changed-Why:
man page fixed


From: "SAITOH Masanobu" <msaitoh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/46034 CVS commit: [netbsd-6] src/share/man/man3
Date: Mon, 27 Oct 2014 05:51:57 +0000

 Module Name:	src
 Committed By:	msaitoh
 Date:		Mon Oct 27 05:51:57 UTC 2014

 Modified Files:
 	src/share/man/man3 [netbsd-6]: rbtree.3

 Log Message:
 Pull up following revision(s) (requested by riastradh in ticket #1136):
 	share/man/man3/rbtree.3: revision 1.8
 Fix documentation of rbtree(3) iteration.
 . Fix sense of rb_tree_iterate(rbt, NULL, ...).
 . Document RB_TREE_MIN/RB_TREE_MAX to avoid relying on that sense.
 . Document RB_TREE_FOREACH and RB_TREE_FOREACH_REVERSE to simplify
 iteration.
 Addresses PR lib/46034 and PR lib/47144.  It would have been nice to
 make `x = NULL; while ((x = rb_tree_iterate(t, NULL, ...)) != NULL)'
 DTRT to traverse t, but it's too much late for that now.
 We probably ought to have an RB_TREE_FOREACH{,_REVERSE}_SAFE too.
 ok christos


 To generate a diff of this commit:
 cvs rdiff -u -r1.5.6.1 -r1.5.6.2 src/share/man/man3/rbtree.3

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.