aboutsummaryrefslogtreecommitdiff
path: root/libstdc++/cstring
blob: d8d03a765b65cdc8d20a7f83cba10a410635d0e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
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__)