1 /* Copyright (C) 1999-2016 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
18 /* <bits/string.h> and <bits/string2.h> declare some extern inline
19 functions. These functions are declared additionally here if
20 inlining is not possible. */
22 #undef __USE_STRING_INLINES
23 #define __USE_STRING_INLINES
24 #define _FORCE_INLINES
25 #define __STRING_INLINE /* empty */
33 #include <bits/string.h>
34 #include <bits/string2.h>
36 #include "shlib-compat.h"
38 #if SHLIB_COMPAT (libc, GLIBC_2_1_1, GLIBC_2_24)
39 /* The inline functions are not used from GLIBC 2.24 and forward, however
40 they are required to provide the symbols through string-inlines.c
41 (if inlining is not possible for compatibility reasons). */
43 __old_strcspn_c1 (const char *__s
, int __reject
)
46 while (__s
[__result
] != '\0' && __s
[__result
] != __reject
)
50 compat_symbol (libc
, __old_strcspn_c1
, __strcspn_c1
, GLIBC_2_1_1
);
53 __old_strcspn_c2 (const char *__s
, int __reject1
, int __reject2
)
56 while (__s
[__result
] != '\0' && __s
[__result
] != __reject1
57 && __s
[__result
] != __reject2
)
61 compat_symbol (libc
, __old_strcspn_c2
, __strcspn_c2
, GLIBC_2_1_1
);
64 __old_strcspn_c3 (const char *__s
, int __reject1
, int __reject2
,
68 while (__s
[__result
] != '\0' && __s
[__result
] != __reject1
69 && __s
[__result
] != __reject2
&& __s
[__result
] != __reject3
)
73 compat_symbol (libc
, __old_strcspn_c3
, __strcspn_c3
, GLIBC_2_1_1
);
76 __old_strspn_c1 (const char *__s
, int __accept
)
79 /* Please note that __accept never can be '\0'. */
80 while (__s
[__result
] == __accept
)
84 compat_symbol (libc
, __old_strspn_c1
, __strspn_c1
, GLIBC_2_1_1
);
87 __old_strspn_c2 (const char *__s
, int __accept1
, int __accept2
)
90 /* Please note that __accept1 and __accept2 never can be '\0'. */
91 while (__s
[__result
] == __accept1
|| __s
[__result
] == __accept2
)
95 compat_symbol (libc
, __old_strspn_c2
, __strspn_c2
, GLIBC_2_1_1
);
98 __old_strspn_c3 (const char *__s
, int __accept1
, int __accept2
,
102 /* Please note that __accept1 to __accept3 never can be '\0'. */
103 while (__s
[__result
] == __accept1
|| __s
[__result
] == __accept2
104 || __s
[__result
] == __accept3
)
108 compat_symbol (libc
, __old_strspn_c3
, __strspn_c3
, GLIBC_2_1_1
);
111 __strpbrk_c2 (const char *__s
, int __accept1
, int __accept2
)
113 /* Please note that __accept1 and __accept2 never can be '\0'. */
114 while (*__s
!= '\0' && *__s
!= __accept1
&& *__s
!= __accept2
)
116 return *__s
== '\0' ? NULL
: (char *) (size_t) __s
;
118 compat_symbol (libc
, __old_strpbrk_c2
, __strpbrk_c2
, GLIBC_2_1_1
);
121 __strpbrk_c3 (const char *__s
, int __accept1
, int __accept2
, int __accept3
)
123 /* Please note that __accept1 to __accept3 never can be '\0'. */
124 while (*__s
!= '\0' && *__s
!= __accept1
&& *__s
!= __accept2
125 && *__s
!= __accept3
)
127 return *__s
== '\0' ? NULL
: (char *) (size_t) __s
;
129 compat_symbol (libc
, __old_strpbrk_c3
, __strpbrk_c3
, GLIBC_2_1_1
);