From owner-freebsd-arch@FreeBSD.ORG Wed Dec 28 18:39:30 2005 Return-Path: X-Original-To: freebsd-arch@freebsd.org Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 44E4616A41F; Wed, 28 Dec 2005 18:39:30 +0000 (GMT) (envelope-from julian@elischer.org) Received: from a50.ironport.com (a50.ironport.com [63.251.108.112]) by mx1.FreeBSD.org (Postfix) with ESMTP id 63B2043D67; Wed, 28 Dec 2005 18:39:29 +0000 (GMT) (envelope-from julian@elischer.org) Received: from unknown (HELO [10.251.17.229]) ([10.251.17.229]) by a50.ironport.com with ESMTP; 28 Dec 2005 10:39:28 -0800 X-IronPort-Anti-Spam-Filtered: true Message-ID: <43B2DBDF.8000007@elischer.org> Date: Wed, 28 Dec 2005 10:39:27 -0800 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.11) Gecko/20050727 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jason Evans References: <0F813D59-3329-47EC-AB17-24CE53293357@freebsd.org> In-Reply-To: <0F813D59-3329-47EC-AB17-24CE53293357@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-arch@freebsd.org Subject: Re: Adding RB_NFIND() to sys/tree.h X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2005 18:39:30 -0000 Jason Evans wrote: > [This is a slightly edited copy of email originally sent to - > current. The only response I received was that -arch is a better > list on which to ask for feedback on this issue.] > > I'd like to add RB_NFIND() to sys/tree.h, since I need it for the > malloc implementation I've been working on. sys/tree.h comes from > NetBSD, and up to now, the only changes we've made have been for the > purpose of avoiding compiler warnings. > > RB_NFIND() is like RB_FIND(), but if an exact match isn't found, > RB_NFIND() returns the next object in the tree (if there is one). > Emulating RB_NFIND() with the existing RB_*() API is possible, but > certainly not ideal. > > I would claim that RB_PFIND() isn't necessary, since it could be > easily (if not quite as efficiently) emulated with RB_NFIND(), > followed by RB_PREV(). However, there is no RB_PREV(), even though > there is RB_NEXT(). This seems to me like an API design oversight > (as is the omission of RB_FOREACH_REVERSE()), but it doesn't cause me > issues, so I haven't tackled it. > > A patch follows (manpage changes omitted). Are there any objections > to committing this? > > Thanks, > Jason I see no reason to not add it.