- added implementation of stdc++ for haiku
- this differs slightly from the one that lives in buildtools/gcc as it has been "ported" to the newer libio that haiku uses as part of its own libroot git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9906 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
// The -*- C++ -*- null-terminated string header.
|
||||
// This file is part of the GNU ANSI C++ Library.
|
||||
|
||||
#ifndef __CSTRING__
|
||||
#define __CSTRING__
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#if 0 // Let's not bother with this just yet.
|
||||
#include <cstddef>
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "cstring"
|
||||
#endif
|
||||
|
||||
// The ANSI C prototypes for these functions have a const argument type and
|
||||
// non-const return type, so we can't use them.
|
||||
|
||||
extern "C++" {
|
||||
extern inline const char *
|
||||
_G_strchr (const char *s, int c)
|
||||
{
|
||||
return strchr (s, c);
|
||||
}
|
||||
|
||||
extern inline char *
|
||||
_G_strchr (char *s, int c)
|
||||
{
|
||||
return const_cast<char *> (strchr (s, c));
|
||||
}
|
||||
|
||||
extern inline const char *
|
||||
_G_strpbrk (const char *s1, const char *s2)
|
||||
{
|
||||
return strpbrk (s1, s2);
|
||||
}
|
||||
|
||||
extern inline char *
|
||||
_G_strpbrk (char *s1, const char *s2)
|
||||
{
|
||||
return const_cast<char *> (strpbrk (s1, s2));
|
||||
}
|
||||
|
||||
extern inline const char *
|
||||
_G_strrchr (const char *s, int c)
|
||||
{
|
||||
return strrchr (s, c);
|
||||
}
|
||||
|
||||
extern inline char *
|
||||
_G_strrchr (char *s, int c)
|
||||
{
|
||||
return const_cast<char *> (strrchr (s, c));
|
||||
}
|
||||
|
||||
extern inline const char *
|
||||
_G_strstr (const char *s1, const char *s2)
|
||||
{
|
||||
return strstr (s1, s2);
|
||||
}
|
||||
|
||||
extern inline char *
|
||||
_G_strstr (char *s1, const char *s2)
|
||||
{
|
||||
return const_cast<char *> (strstr (s1, s2));
|
||||
}
|
||||
|
||||
extern inline const void *
|
||||
_G_memchr (const void *s, int c, size_t n)
|
||||
{
|
||||
return memchr (s, c, n);
|
||||
}
|
||||
|
||||
extern inline void *
|
||||
_G_memchr (void *s, int c, size_t n)
|
||||
{
|
||||
return const_cast<void *> (memchr (s, c, n));
|
||||
}
|
||||
} // extern "C++"
|
||||
|
||||
// Lose any vendor macros for these functions.
|
||||
#undef strchr
|
||||
#undef strpbrk
|
||||
#undef strrchr
|
||||
#undef strstr
|
||||
#undef memchr
|
||||
|
||||
// Ewww, namespace pollution. Anyone have a better idea?
|
||||
#define strchr _G_strchr
|
||||
#define strpbrk _G_strpbrk
|
||||
#define strrchr _G_strrchr
|
||||
#define strstr _G_strstr
|
||||
#define memchr _G_memchr
|
||||
#endif // 0
|
||||
|
||||
#endif // !defined (__CSTRING__)
|
||||
Reference in New Issue
Block a user