Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Dec 2005 10:39:27 -0800
From:      Julian Elischer <julian@elischer.org>
To:        Jason Evans <jasone@freebsd.org>
Cc:        freebsd-arch@freebsd.org
Subject:   Re: Adding RB_NFIND() to sys/tree.h
Message-ID:  <43B2DBDF.8000007@elischer.org>
In-Reply-To: <0F813D59-3329-47EC-AB17-24CE53293357@freebsd.org>
References:  <0F813D59-3329-47EC-AB17-24CE53293357@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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.





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?43B2DBDF.8000007>