Adding RB_NFIND() to sys/tree.h
Julian Elischer
julian at elischer.org
Wed Dec 28 10:39:30 PST 2005
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.
More information about the freebsd-arch
mailing list