Fix GNU/POSIX basename headers.
Including glibc's <libgen.h> will result in the user getting the POSIX version of basename always, regardless of when it is included relative to <string.h>. Prior to this patch, our implementation would result in the one that's included first winning. Bug: http://b/25459151 Change-Id: Id4aaf1670dad317d6bbc05763a84ee87596e8e59
This commit is contained in:
@@ -115,18 +115,18 @@ extern size_t strxfrm(char* __restrict, const char* __restrict, size_t);
|
||||
extern int strcoll_l(const char *, const char *, locale_t) __purefunc;
|
||||
extern size_t strxfrm_l(char* __restrict, const char* __restrict, size_t, locale_t);
|
||||
|
||||
#if defined(__USE_GNU) && !defined(__bionic_using_posix_basename)
|
||||
#if defined(__USE_GNU) && !defined(basename)
|
||||
/*
|
||||
* glibc has a basename in <string.h> that's different to the POSIX one in <libgen.h>.
|
||||
* It doesn't modify its argument, and in C++ it's const-correct.
|
||||
*/
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C++" char* basename(char*) __RENAME(__gnu_basename) __nonnull((1));
|
||||
extern "C++" const char* basename(const char*) __RENAME(__gnu_basename) __nonnull((1));
|
||||
#else
|
||||
extern char* basename(const char*) __RENAME(__gnu_basename) __nonnull((1));
|
||||
#endif
|
||||
#define __bionic_using_gnu_basename
|
||||
#endif
|
||||
|
||||
extern void* __memchr_chk(const void*, int, size_t, size_t);
|
||||
|
||||
Reference in New Issue
Block a user