svn commit: r213002 - in stable/8: include lib/libc/gen

Gavin Atkinson gavin at FreeBSD.org
Wed Sep 22 18:43:47 UTC 2010


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
> 
> 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.
>   
>   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.

Are you sure?

Ours (just introduced):

    char * basename_r(path, bname)

Android (from [1]):

    int    basename_r(const char* path, char*  buffer, size_t  bufflen)

The semantics seem very different.  Ours allocates a buffer, on Android
you pass in a buffer, for a start.

Gavin

[1]
http://android.git.kernel.org/?p=platform/bionic.git;a=blob;f=libc/bionic/basename_r.c;h=e9080f058b6012f1bce77c72befc8f9fc213aed9;hb=a799b53f10e5a6fd51fef4436cfb7ec99836a516

-- 
Gavin Atkinson
FreeBSD committer and bugmeister
GPG: A093262B (313A A79F 697D 3A5C 216A  EDF5 935D EF44 A093 262B)


More information about the svn-src-stable mailing list