From owner-freebsd-arch@FreeBSD.ORG Wed Dec 28 20:37:23 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 C947716A41F; Wed, 28 Dec 2005 20:37:23 +0000 (GMT) (envelope-from glebius@FreeBSD.org) Received: from cell.sick.ru (cell.sick.ru [217.72.144.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id DA15A43D49; Wed, 28 Dec 2005 20:37:22 +0000 (GMT) (envelope-from glebius@FreeBSD.org) Received: from cell.sick.ru (glebius@localhost [127.0.0.1]) by cell.sick.ru (8.13.3/8.13.3) with ESMTP id jBSKbKnO035258 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 28 Dec 2005 23:37:20 +0300 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.sick.ru (8.13.3/8.13.1/Submit) id jBSKbKO1035257; Wed, 28 Dec 2005 23:37:20 +0300 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.sick.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Wed, 28 Dec 2005 23:37:19 +0300 From: Gleb Smirnoff To: Jason Evans Message-ID: <20051228203719.GD31008@FreeBSD.org> References: <0F813D59-3329-47EC-AB17-24CE53293357@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <0F813D59-3329-47EC-AB17-24CE53293357@freebsd.org> User-Agent: Mutt/1.5.6i 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 20:37:23 -0000 On Wed, Dec 28, 2005 at 06:58:20AM -0800, Jason Evans wrote: J> [This is a slightly edited copy of email originally sent to - J> current. The only response I received was that -arch is a better J> list on which to ask for feedback on this issue.] J> J> I'd like to add RB_NFIND() to sys/tree.h, since I need it for the J> malloc implementation I've been working on. sys/tree.h comes from J> NetBSD, and up to now, the only changes we've made have been for the J> purpose of avoiding compiler warnings. J> J> RB_NFIND() is like RB_FIND(), but if an exact match isn't found, J> RB_NFIND() returns the next object in the tree (if there is one). J> Emulating RB_NFIND() with the existing RB_*() API is possible, but J> certainly not ideal. J> J> I would claim that RB_PFIND() isn't necessary, since it could be J> easily (if not quite as efficiently) emulated with RB_NFIND(), J> followed by RB_PREV(). However, there is no RB_PREV(), even though J> there is RB_NEXT(). This seems to me like an API design oversight J> (as is the omission of RB_FOREACH_REVERSE()), but it doesn't cause me J> issues, so I haven't tackled it. J> J> A patch follows (manpage changes omitted). Are there any objections J> to committing this? I see it useful, and probably will utilize soon in ipfw(4). Thanks. -- Totus tuus, Glebius. GLEBIUS-RIPN GLEB-RIPE