From owner-svn-src-stable@FreeBSD.ORG Wed Sep 22 20:06:34 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9D87B1065694; Wed, 22 Sep 2010 20:06:34 +0000 (UTC) (envelope-from rpaulo@freebsd.org) Received: from karen.lavabit.com (karen.lavabit.com [72.249.41.33]) by mx1.freebsd.org (Postfix) with ESMTP id 7480F8FC0C; Wed, 22 Sep 2010 20:06:34 +0000 (UTC) Received: from d.earth.lavabit.com (d.earth.lavabit.com [192.168.111.13]) by karen.lavabit.com (Postfix) with ESMTP id DE42111BA22; Wed, 22 Sep 2010 14:48:06 -0500 (CDT) Received: from 10.0.10.3 (221.163.108.93.rev.vodafone.pt [93.108.163.221]) by lavabit.com with ESMTP id G4Q2GA9ZXZ1O; Wed, 22 Sep 2010 14:48:06 -0500 Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=us-ascii From: Rui Paulo In-Reply-To: <1285180346.65489.3.camel@buffy.york.ac.uk> Date: Wed, 22 Sep 2010 20:48:03 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <4461F6BE-707F-40D4-93F0-6661332A38C6@FreeBSD.org> References: <201009221800.o8MI0Ze3038214@svn.freebsd.org> <1285180346.65489.3.camel@buffy.york.ac.uk> To: Gavin Atkinson X-Mailer: Apple Mail (2.1081) Cc: svn-src-stable@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-stable-8@FreeBSD.org Subject: Re: svn commit: r213002 - in stable/8: include lib/libc/gen X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2010 20:06:34 -0000 On 22 Sep 2010, at 19:32, Gavin Atkinson wrote: > On Wed, 2010-09-22 at 18:00 +0000, Rui Paulo wrote: >> Author: rpaulo >> Date: Wed Sep 22 18:00:34 2010 >> New Revision: 213002 >> URL: http://svn.freebsd.org/changeset/base/213002 >>=20 >> Log: >> MFC r197804 (rwatson): >> Add basename_r(3) to complement basename(3). basename_r(3) which = accepts >> a caller-allocated buffer of at least MAXPATHLEN, rather than = using a >> global buffer. >>=20 >> Note about semantics: while this interface is not POSIXy, there's >> another major platform that uses it (Android) and the semantics = between >> the two platforms are pretty much the same. >=20 > Are you sure? >=20 > Ours (just introduced): >=20 > char * basename_r(path, bname) >=20 > Android (from [1]): >=20 > int basename_r(const char* path, char* buffer, size_t bufflen) >=20 > The semantics seem very different. Ours allocates a buffer, on = Android > you pass in a buffer, for a start. Hmm, I only looked at the function body... It seems that the best way to = overcome this is to just add a len parameter. The return value can also = be changed. P.S.: Our basename_r() performs no allocation. You were probably looking = at basename(). Regards, -- Rui Paulo