From owner-freebsd-net@FreeBSD.ORG Tue Oct 8 14:15:12 2013 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id DF92B3AE for ; Tue, 8 Oct 2013 14:15:12 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6B0062651 for ; Tue, 8 Oct 2013 14:15:11 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.7/8.14.7) with ESMTP id r98EF4bQ023253; Tue, 8 Oct 2013 18:15:04 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.7/8.14.7/Submit) id r98EF4jC023252; Tue, 8 Oct 2013 18:15:04 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Tue, 8 Oct 2013 18:15:04 +0400 From: Gleb Smirnoff To: Eric van Gyzen Subject: Re: sys/net/radix.h: #define Free(p) for user-land Message-ID: <20131008141504.GA22563@FreeBSD.org> References: <5252D7F7.3030709@dell.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5252D7F7.3030709@dell.com> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-net@freebsd.org, Eric van Gyzen X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Oct 2013 14:15:12 -0000 Eric, On Mon, Oct 07, 2013 at 10:49:11AM -0500, Eric van Gyzen wrote: E> The user-land definition of the Free() macro in sys/net/radix.h is E> rather inconvenient. I work on a large C++ code-base, where several E> classes define Free() functions. This header file gets indirectly E> included in a few modules (via nested #includes), so we have to #undef E> Free to work around this macro definition. E> E> Ideally, radix.h would define a more unique name, such as R_Free(). If E> I were using a C code-base, you could say the same about my code, but E> it's C++, and Free() is already well qualified by classes and/or namespaces. E> E> Is this Free() macro considered a well-defined, widely known, and E> therefore mandatory part of the API, or could it be renamed to something E> more unique? Alternatively, could it be changed to an inline function E> definition, so as not to conflict with declarations in other E> namespaces? If any of these is possible, I'll gladly provide the E> blindingly trivial patch, although I don't have a commit bit. E> E> Finding in-tree consumers of this macro is difficult, due to its generic E> name. Its counterparts--R_Malloc and R_Zalloc--only appear in E> sys/net/{radix,route,rtsock}.c (on head). The recent ipfilter update E> removed the only [potential] in-tree user-land consumer. The easiest way to find consumers would be to build test the trivial patch :) -- Totus tuus, Glebius.