1*7c82a1ecSDimitry Andric // -*- C++ -*-
2*7c82a1ecSDimitry Andric //===--------------------------- string.h ---------------------------------===//
3*7c82a1ecSDimitry Andric //
4*7c82a1ecSDimitry Andric // The LLVM Compiler Infrastructure
5*7c82a1ecSDimitry Andric //
6*7c82a1ecSDimitry Andric // This file is distributed under the University of Illinois Open Source
7*7c82a1ecSDimitry Andric // License. See LICENSE.TXT for details.
8*7c82a1ecSDimitry Andric //
9*7c82a1ecSDimitry Andric //===----------------------------------------------------------------------===//
10*7c82a1ecSDimitry Andric
11*7c82a1ecSDimitry Andric #ifndef _LIBCPP_STRING_H
12*7c82a1ecSDimitry Andric #define _LIBCPP_STRING_H
13*7c82a1ecSDimitry Andric
14*7c82a1ecSDimitry Andric /*
15*7c82a1ecSDimitry Andric string.h synopsis
16*7c82a1ecSDimitry Andric
17*7c82a1ecSDimitry Andric Macros:
18*7c82a1ecSDimitry Andric
19*7c82a1ecSDimitry Andric NULL
20*7c82a1ecSDimitry Andric
21*7c82a1ecSDimitry Andric Types:
22*7c82a1ecSDimitry Andric
23*7c82a1ecSDimitry Andric size_t
24*7c82a1ecSDimitry Andric
25*7c82a1ecSDimitry Andric void* memcpy(void* restrict s1, const void* restrict s2, size_t n);
26*7c82a1ecSDimitry Andric void* memmove(void* s1, const void* s2, size_t n);
27*7c82a1ecSDimitry Andric char* strcpy (char* restrict s1, const char* restrict s2);
28*7c82a1ecSDimitry Andric char* strncpy(char* restrict s1, const char* restrict s2, size_t n);
29*7c82a1ecSDimitry Andric char* strcat (char* restrict s1, const char* restrict s2);
30*7c82a1ecSDimitry Andric char* strncat(char* restrict s1, const char* restrict s2, size_t n);
31*7c82a1ecSDimitry Andric int memcmp(const void* s1, const void* s2, size_t n);
32*7c82a1ecSDimitry Andric int strcmp (const char* s1, const char* s2);
33*7c82a1ecSDimitry Andric int strncmp(const char* s1, const char* s2, size_t n);
34*7c82a1ecSDimitry Andric int strcoll(const char* s1, const char* s2);
35*7c82a1ecSDimitry Andric size_t strxfrm(char* restrict s1, const char* restrict s2, size_t n);
36*7c82a1ecSDimitry Andric const void* memchr(const void* s, int c, size_t n);
37*7c82a1ecSDimitry Andric void* memchr( void* s, int c, size_t n);
38*7c82a1ecSDimitry Andric const char* strchr(const char* s, int c);
39*7c82a1ecSDimitry Andric char* strchr( char* s, int c);
40*7c82a1ecSDimitry Andric size_t strcspn(const char* s1, const char* s2);
41*7c82a1ecSDimitry Andric const char* strpbrk(const char* s1, const char* s2);
42*7c82a1ecSDimitry Andric char* strpbrk( char* s1, const char* s2);
43*7c82a1ecSDimitry Andric const char* strrchr(const char* s, int c);
44*7c82a1ecSDimitry Andric char* strrchr( char* s, int c);
45*7c82a1ecSDimitry Andric size_t strspn(const char* s1, const char* s2);
46*7c82a1ecSDimitry Andric const char* strstr(const char* s1, const char* s2);
47*7c82a1ecSDimitry Andric char* strstr( char* s1, const char* s2);
48*7c82a1ecSDimitry Andric char* strtok(char* restrict s1, const char* restrict s2);
49*7c82a1ecSDimitry Andric void* memset(void* s, int c, size_t n);
50*7c82a1ecSDimitry Andric char* strerror(int errnum);
51*7c82a1ecSDimitry Andric size_t strlen(const char* s);
52*7c82a1ecSDimitry Andric
53*7c82a1ecSDimitry Andric */
54*7c82a1ecSDimitry Andric
55*7c82a1ecSDimitry Andric #include <__config>
56*7c82a1ecSDimitry Andric
57*7c82a1ecSDimitry Andric #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
58*7c82a1ecSDimitry Andric #pragma GCC system_header
59*7c82a1ecSDimitry Andric #endif
60*7c82a1ecSDimitry Andric
61*7c82a1ecSDimitry Andric #include_next <string.h>
62*7c82a1ecSDimitry Andric
63*7c82a1ecSDimitry Andric // MSVCRT, GNU libc and its derivates may already have the correct prototype in
64*7c82a1ecSDimitry Andric // <string.h>. This macro can be defined by users if their C library provides
65*7c82a1ecSDimitry Andric // the right signature.
66*7c82a1ecSDimitry Andric #if defined(__CORRECT_ISO_CPP_STRING_H_PROTO) || defined(_LIBCPP_MSVCRT) || \
67*7c82a1ecSDimitry Andric defined(__sun__) || defined(_STRING_H_CPLUSPLUS_98_CONFORMANCE_)
68*7c82a1ecSDimitry Andric #define _LIBCPP_STRING_H_HAS_CONST_OVERLOADS
69*7c82a1ecSDimitry Andric #endif
70*7c82a1ecSDimitry Andric
71*7c82a1ecSDimitry Andric #if defined(__cplusplus) && !defined(_LIBCPP_STRING_H_HAS_CONST_OVERLOADS) && defined(_LIBCPP_PREFERRED_OVERLOAD)
72*7c82a1ecSDimitry Andric extern "C++" {
73*7c82a1ecSDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
__libcpp_strchr(const char * __s,int __c)74*7c82a1ecSDimitry Andric char* __libcpp_strchr(const char* __s, int __c) {return (char*)strchr(__s, __c);}
75*7c82a1ecSDimitry Andric inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
strchr(const char * __s,int __c)76*7c82a1ecSDimitry Andric const char* strchr(const char* __s, int __c) {return __libcpp_strchr(__s, __c);}
77*7c82a1ecSDimitry Andric inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
strchr(char * __s,int __c)78*7c82a1ecSDimitry Andric char* strchr( char* __s, int __c) {return __libcpp_strchr(__s, __c);}
79*7c82a1ecSDimitry Andric
80*7c82a1ecSDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
__libcpp_strpbrk(const char * __s1,const char * __s2)81*7c82a1ecSDimitry Andric char* __libcpp_strpbrk(const char* __s1, const char* __s2) {return (char*)strpbrk(__s1, __s2);}
82*7c82a1ecSDimitry Andric inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
strpbrk(const char * __s1,const char * __s2)83*7c82a1ecSDimitry Andric const char* strpbrk(const char* __s1, const char* __s2) {return __libcpp_strpbrk(__s1, __s2);}
84*7c82a1ecSDimitry Andric inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
strpbrk(char * __s1,const char * __s2)85*7c82a1ecSDimitry Andric char* strpbrk( char* __s1, const char* __s2) {return __libcpp_strpbrk(__s1, __s2);}
86*7c82a1ecSDimitry Andric
87*7c82a1ecSDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
__libcpp_strrchr(const char * __s,int __c)88*7c82a1ecSDimitry Andric char* __libcpp_strrchr(const char* __s, int __c) {return (char*)strrchr(__s, __c);}
89*7c82a1ecSDimitry Andric inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
strrchr(const char * __s,int __c)90*7c82a1ecSDimitry Andric const char* strrchr(const char* __s, int __c) {return __libcpp_strrchr(__s, __c);}
91*7c82a1ecSDimitry Andric inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
strrchr(char * __s,int __c)92*7c82a1ecSDimitry Andric char* strrchr( char* __s, int __c) {return __libcpp_strrchr(__s, __c);}
93*7c82a1ecSDimitry Andric
94*7c82a1ecSDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
__libcpp_memchr(const void * __s,int __c,size_t __n)95*7c82a1ecSDimitry Andric void* __libcpp_memchr(const void* __s, int __c, size_t __n) {return (void*)memchr(__s, __c, __n);}
96*7c82a1ecSDimitry Andric inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
memchr(const void * __s,int __c,size_t __n)97*7c82a1ecSDimitry Andric const void* memchr(const void* __s, int __c, size_t __n) {return __libcpp_memchr(__s, __c, __n);}
98*7c82a1ecSDimitry Andric inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
memchr(void * __s,int __c,size_t __n)99*7c82a1ecSDimitry Andric void* memchr( void* __s, int __c, size_t __n) {return __libcpp_memchr(__s, __c, __n);}
100*7c82a1ecSDimitry Andric
101*7c82a1ecSDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
__libcpp_strstr(const char * __s1,const char * __s2)102*7c82a1ecSDimitry Andric char* __libcpp_strstr(const char* __s1, const char* __s2) {return (char*)strstr(__s1, __s2);}
103*7c82a1ecSDimitry Andric inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
strstr(const char * __s1,const char * __s2)104*7c82a1ecSDimitry Andric const char* strstr(const char* __s1, const char* __s2) {return __libcpp_strstr(__s1, __s2);}
105*7c82a1ecSDimitry Andric inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
strstr(char * __s1,const char * __s2)106*7c82a1ecSDimitry Andric char* strstr( char* __s1, const char* __s2) {return __libcpp_strstr(__s1, __s2);}
107*7c82a1ecSDimitry Andric }
108*7c82a1ecSDimitry Andric #endif
109*7c82a1ecSDimitry Andric
110*7c82a1ecSDimitry Andric #endif // _LIBCPP_STRING_H
111