blob: dada52bb863a6cc7f23bd4b1177e4c06e53019e9 [file] [log] [blame]
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001/*
2 * Copyright (C) 2008 The Android Open Source Project
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in
12 * the documentation and/or other materials provided with the
13 * distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
Elliott Hughes09c39d62014-08-19 14:30:30 -070028
29#ifndef _STRING_H
30#define _STRING_H
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080031
32#include <sys/cdefs.h>
33#include <stddef.h>
Dan Albertdfb5ce42014-07-09 22:51:34 +000034#include <xlocale.h>
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080035
Josh Gaoc3cec272016-04-07 13:39:49 -070036#include <bits/strcasecmp.h>
37
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080038__BEGIN_DECLS
39
Elliott Hughes76f89162015-01-26 13:34:58 -080040#if defined(__USE_BSD)
41#include <strings.h>
42#endif
43
Nick Kralevich1c462b72013-05-07 10:00:21 -070044extern void* memccpy(void* __restrict, const void* __restrict, int, size_t);
Nick Kralevicha6779072012-03-21 08:48:18 -070045extern void* memchr(const void *, int, size_t) __purefunc;
46extern void* memrchr(const void *, int, size_t) __purefunc;
47extern int memcmp(const void *, const void *, size_t) __purefunc;
Nick Kralevich1c462b72013-05-07 10:00:21 -070048extern void* memcpy(void* __restrict, const void* __restrict, size_t);
Elliott Hughes3cfb52a2015-02-18 21:29:13 -080049#if defined(__USE_GNU)
50extern void* mempcpy(void* __restrict, const void* __restrict, size_t);
51#endif
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080052extern void* memmove(void *, const void *, size_t);
53extern void* memset(void *, int, size_t);
Nick Kralevicha6779072012-03-21 08:48:18 -070054extern void* memmem(const void *, size_t, const void *, size_t) __purefunc;
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080055
Nick Kralevicha6779072012-03-21 08:48:18 -070056extern char* strchr(const char *, int) __purefunc;
Pavel Chupin3c4b50f2013-07-26 16:50:11 +040057extern char* __strchr_chk(const char *, int, size_t);
Elliott Hughes7ac3c122015-08-26 09:59:29 -070058#if defined(__USE_GNU)
59#if defined(__cplusplus)
60extern "C++" char* strchrnul(char*, int) __RENAME(strchrnul) __purefunc;
61extern "C++" const char* strchrnul(const char*, int) __RENAME(strchrnul) __purefunc;
62#else
63char* strchrnul(const char*, int) __purefunc;
64#endif
65#endif
Pavel Chupin3c4b50f2013-07-26 16:50:11 +040066
Nick Kralevicha6779072012-03-21 08:48:18 -070067extern char* strrchr(const char *, int) __purefunc;
Elliott Hughes53e43292014-02-24 18:00:43 -080068extern char* __strrchr_chk(const char *, int, size_t);
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080069
Nick Kralevicha6779072012-03-21 08:48:18 -070070extern size_t strlen(const char *) __purefunc;
Nick Kralevichcf870192013-05-30 16:48:53 -070071extern size_t __strlen_chk(const char *, size_t);
Nick Kralevicha6779072012-03-21 08:48:18 -070072extern int strcmp(const char *, const char *) __purefunc;
Christopher Ferris950a58e2014-04-04 14:38:18 -070073extern char* stpcpy(char* __restrict, const char* __restrict);
Nick Kralevich1c462b72013-05-07 10:00:21 -070074extern char* strcpy(char* __restrict, const char* __restrict);
75extern char* strcat(char* __restrict, const char* __restrict);
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080076
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080077extern char* strdup(const char *);
78
Nick Kralevicha6779072012-03-21 08:48:18 -070079extern char* strstr(const char *, const char *) __purefunc;
80extern char* strcasestr(const char *haystack, const char *needle) __purefunc;
Nick Kralevich1c462b72013-05-07 10:00:21 -070081extern char* strtok(char* __restrict, const char* __restrict);
82extern char* strtok_r(char* __restrict, const char* __restrict, char** __restrict);
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080083
Elliott Hughes416d7dd2014-08-18 17:28:32 -070084extern char* strerror(int);
Elliott Hughesb20c2442014-11-06 15:04:08 -080085extern char* strerror_l(int, locale_t);
Elliott Hughes416d7dd2014-08-18 17:28:32 -070086#if defined(__USE_GNU)
87extern char* strerror_r(int, char*, size_t) __RENAME(__gnu_strerror_r);
88#else /* POSIX */
89extern int strerror_r(int, char*, size_t);
90#endif
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080091
Nick Kralevicha6779072012-03-21 08:48:18 -070092extern size_t strnlen(const char *, size_t) __purefunc;
Nick Kralevich1c462b72013-05-07 10:00:21 -070093extern char* strncat(char* __restrict, const char* __restrict, size_t);
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080094extern char* strndup(const char *, size_t);
Nick Kralevicha6779072012-03-21 08:48:18 -070095extern int strncmp(const char *, const char *, size_t) __purefunc;
Christopher Ferris950a58e2014-04-04 14:38:18 -070096extern char* stpncpy(char* __restrict, const char* __restrict, size_t);
Nick Kralevich1c462b72013-05-07 10:00:21 -070097extern char* strncpy(char* __restrict, const char* __restrict, size_t);
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080098
Nick Kralevich1c462b72013-05-07 10:00:21 -070099extern size_t strlcat(char* __restrict, const char* __restrict, size_t);
100extern size_t strlcpy(char* __restrict, const char* __restrict, size_t);
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800101
Nick Kralevicha6779072012-03-21 08:48:18 -0700102extern size_t strcspn(const char *, const char *) __purefunc;
103extern char* strpbrk(const char *, const char *) __purefunc;
Nick Kralevich1c462b72013-05-07 10:00:21 -0700104extern char* strsep(char** __restrict, const char* __restrict);
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800105extern size_t strspn(const char *, const char *);
106
107extern char* strsignal(int sig);
108
Nick Kralevicha6779072012-03-21 08:48:18 -0700109extern int strcoll(const char *, const char *) __purefunc;
Nick Kralevich1c462b72013-05-07 10:00:21 -0700110extern size_t strxfrm(char* __restrict, const char* __restrict, size_t);
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800111
Dan Albertdfb5ce42014-07-09 22:51:34 +0000112extern int strcoll_l(const char *, const char *, locale_t) __purefunc;
113extern size_t strxfrm_l(char* __restrict, const char* __restrict, size_t, locale_t);
114
Josh Gaoeb9b9252015-11-03 18:46:02 -0800115#if defined(__USE_GNU) && !defined(basename)
Elliott Hughes09c39d62014-08-19 14:30:30 -0700116/*
117 * glibc has a basename in <string.h> that's different to the POSIX one in <libgen.h>.
118 * It doesn't modify its argument, and in C++ it's const-correct.
119 */
Josh Gaoeb9b9252015-11-03 18:46:02 -0800120
Elliott Hughes09c39d62014-08-19 14:30:30 -0700121#if defined(__cplusplus)
122extern "C++" char* basename(char*) __RENAME(__gnu_basename) __nonnull((1));
123extern "C++" const char* basename(const char*) __RENAME(__gnu_basename) __nonnull((1));
124#else
125extern char* basename(const char*) __RENAME(__gnu_basename) __nonnull((1));
126#endif
Elliott Hughes09c39d62014-08-19 14:30:30 -0700127#endif
128
Daniel Micay4ae77362015-04-17 18:16:57 -0400129extern void* __memchr_chk(const void*, int, size_t, size_t);
130__errordecl(__memchr_buf_size_error, "memchr called with size bigger than buffer");
131
132extern void* __memrchr_chk(const void*, int, size_t, size_t);
133__errordecl(__memrchr_buf_size_error, "memrchr called with size bigger than buffer");
134extern void* __memrchr_real(const void*, int, size_t) __RENAME(memrchr);
135
Dan Albert658727e2014-10-07 11:10:36 -0700136extern char* __stpncpy_chk2(char* __restrict, const char* __restrict, size_t, size_t, size_t);
137extern char* __strncpy_chk2(char* __restrict, const char* __restrict, size_t, size_t, size_t);
138extern size_t __strlcpy_real(char* __restrict, const char* __restrict, size_t) __RENAME(strlcpy);
139extern size_t __strlcpy_chk(char *, const char *, size_t, size_t);
140extern size_t __strlcat_real(char* __restrict, const char* __restrict, size_t) __RENAME(strlcat);
141extern size_t __strlcat_chk(char* __restrict, const char* __restrict, size_t, size_t);
142
Elliott Hughes890c8ed2013-03-22 10:58:55 -0700143#if defined(__BIONIC_FORTIFY)
Nick Kralevich0a230152012-06-04 15:20:25 -0700144
145__BIONIC_FORTIFY_INLINE
Daniel Micay4ae77362015-04-17 18:16:57 -0400146void* memchr(const void *s, int c, size_t n) {
147 size_t bos = __bos(s);
148
149#if !defined(__clang__)
150 if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
151 return __builtin_memchr(s, c, n);
152 }
153
154 if (__builtin_constant_p(n) && (n > bos)) {
155 __memchr_buf_size_error();
156 }
157
158 if (__builtin_constant_p(n) && (n <= bos)) {
159 return __builtin_memchr(s, c, n);
160 }
161#endif
162
163 return __memchr_chk(s, c, n, bos);
164}
165
166__BIONIC_FORTIFY_INLINE
167void* memrchr(const void *s, int c, size_t n) {
168 size_t bos = __bos(s);
169
170#if !defined(__clang__)
171 if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
172 return __memrchr_real(s, c, n);
173 }
174
175 if (__builtin_constant_p(n) && (n > bos)) {
176 __memrchr_buf_size_error();
177 }
178
179 if (__builtin_constant_p(n) && (n <= bos)) {
180 return __memrchr_real(s, c, n);
181 }
182#endif
183
184 return __memrchr_chk(s, c, n, bos);
185}
186
187__BIONIC_FORTIFY_INLINE
Nick Kralevich16d1af12013-06-17 14:49:19 -0700188void* memcpy(void* __restrict dest, const void* __restrict src, size_t copy_amount) {
Nick Kralevichb84f6672014-10-05 06:52:24 -0700189 return __builtin___memcpy_chk(dest, src, copy_amount, __bos0(dest));
Nick Kralevich0a230152012-06-04 15:20:25 -0700190}
191
192__BIONIC_FORTIFY_INLINE
Nick Kralevich16d1af12013-06-17 14:49:19 -0700193void* memmove(void *dest, const void *src, size_t len) {
Nick Kralevichbd8e6742013-08-28 13:22:52 -0700194 return __builtin___memmove_chk(dest, src, len, __bos0(dest));
Nick Kralevich0a230152012-06-04 15:20:25 -0700195}
196
197__BIONIC_FORTIFY_INLINE
Christopher Ferris950a58e2014-04-04 14:38:18 -0700198char* stpcpy(char* __restrict dest, const char* __restrict src) {
199 return __builtin___stpcpy_chk(dest, src, __bos(dest));
200}
201
202__BIONIC_FORTIFY_INLINE
Nick Kralevich16d1af12013-06-17 14:49:19 -0700203char* strcpy(char* __restrict dest, const char* __restrict src) {
Nick Kralevich9020fd52013-04-30 11:31:35 -0700204 return __builtin___strcpy_chk(dest, src, __bos(dest));
Nick Kralevich0a230152012-06-04 15:20:25 -0700205}
206
Christopher Ferris950a58e2014-04-04 14:38:18 -0700207__BIONIC_FORTIFY_INLINE
208char* stpncpy(char* __restrict dest, const char* __restrict src, size_t n) {
209 size_t bos_dest = __bos(dest);
210 size_t bos_src = __bos(src);
Christopher Ferris950a58e2014-04-04 14:38:18 -0700211
212 if (bos_src == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
213 return __builtin___stpncpy_chk(dest, src, n, bos_dest);
214 }
215
216 if (__builtin_constant_p(n) && (n <= bos_src)) {
217 return __builtin___stpncpy_chk(dest, src, n, bos_dest);
218 }
219
220 size_t slen = __builtin_strlen(src);
221 if (__builtin_constant_p(slen)) {
222 return __builtin___stpncpy_chk(dest, src, n, bos_dest);
223 }
224
225 return __stpncpy_chk2(dest, src, n, bos_dest, bos_src);
226}
227
Nick Kralevich0a230152012-06-04 15:20:25 -0700228__BIONIC_FORTIFY_INLINE
Nick Kralevich16d1af12013-06-17 14:49:19 -0700229char* strncpy(char* __restrict dest, const char* __restrict src, size_t n) {
Nick Kralevich93501d32013-08-28 10:47:43 -0700230 size_t bos_dest = __bos(dest);
231 size_t bos_src = __bos(src);
Nick Kralevich93501d32013-08-28 10:47:43 -0700232
233 if (bos_src == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
234 return __builtin___strncpy_chk(dest, src, n, bos_dest);
235 }
236
Nick Kralevichd13c2b12013-09-27 13:21:24 -0700237 if (__builtin_constant_p(n) && (n <= bos_src)) {
238 return __builtin___strncpy_chk(dest, src, n, bos_dest);
239 }
240
Nick Kralevich93501d32013-08-28 10:47:43 -0700241 size_t slen = __builtin_strlen(src);
242 if (__builtin_constant_p(slen)) {
243 return __builtin___strncpy_chk(dest, src, n, bos_dest);
244 }
245
246 return __strncpy_chk2(dest, src, n, bos_dest, bos_src);
Nick Kralevich0a230152012-06-04 15:20:25 -0700247}
248
249__BIONIC_FORTIFY_INLINE
Nick Kralevich16d1af12013-06-17 14:49:19 -0700250char* strcat(char* __restrict dest, const char* __restrict src) {
Nick Kralevich9020fd52013-04-30 11:31:35 -0700251 return __builtin___strcat_chk(dest, src, __bos(dest));
Nick Kralevich0a230152012-06-04 15:20:25 -0700252}
253
254__BIONIC_FORTIFY_INLINE
Nick Kralevich1c462b72013-05-07 10:00:21 -0700255char *strncat(char* __restrict dest, const char* __restrict src, size_t n) {
Nick Kralevich9020fd52013-04-30 11:31:35 -0700256 return __builtin___strncat_chk(dest, src, n, __bos(dest));
Nick Kralevich0a230152012-06-04 15:20:25 -0700257}
258
Nick Kralevich71a18dd2012-06-07 14:01:26 -0700259__BIONIC_FORTIFY_INLINE
Nick Kralevich16d1af12013-06-17 14:49:19 -0700260void* memset(void *s, int c, size_t n) {
Nick Kralevichbd8e6742013-08-28 13:22:52 -0700261 return __builtin___memset_chk(s, c, n, __bos0(s));
Nick Kralevich71a18dd2012-06-07 14:01:26 -0700262}
263
Nick Kralevich8df49ad2012-06-13 16:57:27 -0700264__BIONIC_FORTIFY_INLINE
Nick Kralevich1c462b72013-05-07 10:00:21 -0700265size_t strlcpy(char* __restrict dest, const char* __restrict src, size_t size) {
Nick Kralevich9020fd52013-04-30 11:31:35 -0700266 size_t bos = __bos(dest);
Nick Kralevich8df49ad2012-06-13 16:57:27 -0700267
Nick Kralevich8bafa742013-06-20 12:17:44 -0700268#if !defined(__clang__)
Nick Kralevich8df49ad2012-06-13 16:57:27 -0700269 // Compiler doesn't know destination size. Don't call __strlcpy_chk
Nick Kralevich9b6cc222012-07-13 14:46:36 -0700270 if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
Nick Kralevichcb228fb2012-06-26 16:05:19 -0700271 return __strlcpy_real(dest, src, size);
Nick Kralevich8df49ad2012-06-13 16:57:27 -0700272 }
273
274 // Compiler can prove, at compile time, that the passed in size
275 // is always <= the actual object size. Don't call __strlcpy_chk
276 if (__builtin_constant_p(size) && (size <= bos)) {
Nick Kralevichcb228fb2012-06-26 16:05:19 -0700277 return __strlcpy_real(dest, src, size);
Nick Kralevich8df49ad2012-06-13 16:57:27 -0700278 }
Nick Kralevich8bafa742013-06-20 12:17:44 -0700279#endif /* !defined(__clang__) */
Nick Kralevich8df49ad2012-06-13 16:57:27 -0700280
281 return __strlcpy_chk(dest, src, size, bos);
282}
283
Nick Kralevich8df49ad2012-06-13 16:57:27 -0700284
285__BIONIC_FORTIFY_INLINE
Nick Kralevich1c462b72013-05-07 10:00:21 -0700286size_t strlcat(char* __restrict dest, const char* __restrict src, size_t size) {
Nick Kralevich9020fd52013-04-30 11:31:35 -0700287 size_t bos = __bos(dest);
Nick Kralevich8df49ad2012-06-13 16:57:27 -0700288
Nick Kralevicha6cde392013-06-29 08:15:25 -0700289#if !defined(__clang__)
Nick Kralevich8df49ad2012-06-13 16:57:27 -0700290 // Compiler doesn't know destination size. Don't call __strlcat_chk
Nick Kralevich9b6cc222012-07-13 14:46:36 -0700291 if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
Nick Kralevichcb228fb2012-06-26 16:05:19 -0700292 return __strlcat_real(dest, src, size);
Nick Kralevich8df49ad2012-06-13 16:57:27 -0700293 }
294
295 // Compiler can prove, at compile time, that the passed in size
296 // is always <= the actual object size. Don't call __strlcat_chk
297 if (__builtin_constant_p(size) && (size <= bos)) {
Nick Kralevichcb228fb2012-06-26 16:05:19 -0700298 return __strlcat_real(dest, src, size);
Nick Kralevich8df49ad2012-06-13 16:57:27 -0700299 }
Nick Kralevicha6cde392013-06-29 08:15:25 -0700300#endif /* !defined(__clang__) */
Nick Kralevich8df49ad2012-06-13 16:57:27 -0700301
302 return __strlcat_chk(dest, src, size, bos);
303}
304
Nick Kralevich260bf8c2012-07-13 11:27:06 -0700305__BIONIC_FORTIFY_INLINE
306size_t strlen(const char *s) {
Nick Kralevich9020fd52013-04-30 11:31:35 -0700307 size_t bos = __bos(s);
Nick Kralevich9b6cc222012-07-13 14:46:36 -0700308
Nick Kralevich16d1af12013-06-17 14:49:19 -0700309#if !defined(__clang__)
Nick Kralevich9b6cc222012-07-13 14:46:36 -0700310 // Compiler doesn't know destination size. Don't call __strlen_chk
311 if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
Nick Kralevicha44e9af2013-01-17 15:41:33 -0800312 return __builtin_strlen(s);
313 }
314
315 size_t slen = __builtin_strlen(s);
316 if (__builtin_constant_p(slen)) {
317 return slen;
Nick Kralevich260bf8c2012-07-13 11:27:06 -0700318 }
Nick Kralevich16d1af12013-06-17 14:49:19 -0700319#endif /* !defined(__clang__) */
Nick Kralevich9b6cc222012-07-13 14:46:36 -0700320
Nick Kralevich260bf8c2012-07-13 11:27:06 -0700321 return __strlen_chk(s, bos);
322}
Nick Kralevich8df49ad2012-06-13 16:57:27 -0700323
Nick Kralevich049e5832012-11-30 15:15:58 -0800324__BIONIC_FORTIFY_INLINE
325char* strchr(const char *s, int c) {
Nick Kralevich9020fd52013-04-30 11:31:35 -0700326 size_t bos = __bos(s);
Nick Kralevich049e5832012-11-30 15:15:58 -0800327
Nick Kralevich16d1af12013-06-17 14:49:19 -0700328#if !defined(__clang__)
Nick Kralevich049e5832012-11-30 15:15:58 -0800329 // Compiler doesn't know destination size. Don't call __strchr_chk
330 if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
Nick Kralevicha44e9af2013-01-17 15:41:33 -0800331 return __builtin_strchr(s, c);
332 }
333
334 size_t slen = __builtin_strlen(s);
335 if (__builtin_constant_p(slen) && (slen < bos)) {
336 return __builtin_strchr(s, c);
Nick Kralevich049e5832012-11-30 15:15:58 -0800337 }
Nick Kralevich16d1af12013-06-17 14:49:19 -0700338#endif /* !defined(__clang__) */
Nick Kralevich049e5832012-11-30 15:15:58 -0800339
340 return __strchr_chk(s, c, bos);
341}
342
Nick Kralevich9a4d3052012-12-03 10:36:13 -0800343__BIONIC_FORTIFY_INLINE
344char* strrchr(const char *s, int c) {
Nick Kralevich3b2e6bc2013-04-30 14:19:23 -0700345 size_t bos = __bos(s);
Nick Kralevich9a4d3052012-12-03 10:36:13 -0800346
Nick Kralevich16d1af12013-06-17 14:49:19 -0700347#if !defined(__clang__)
Nick Kralevich9a4d3052012-12-03 10:36:13 -0800348 // Compiler doesn't know destination size. Don't call __strrchr_chk
349 if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
Nick Kralevicha44e9af2013-01-17 15:41:33 -0800350 return __builtin_strrchr(s, c);
351 }
352
353 size_t slen = __builtin_strlen(s);
354 if (__builtin_constant_p(slen) && (slen < bos)) {
355 return __builtin_strrchr(s, c);
Nick Kralevich9a4d3052012-12-03 10:36:13 -0800356 }
Nick Kralevich16d1af12013-06-17 14:49:19 -0700357#endif /* !defined(__clang__) */
Nick Kralevich9a4d3052012-12-03 10:36:13 -0800358
359 return __strrchr_chk(s, c, bos);
360}
361
Nick Kralevich049e5832012-11-30 15:15:58 -0800362
Elliott Hughes890c8ed2013-03-22 10:58:55 -0700363#endif /* defined(__BIONIC_FORTIFY) */
Nick Kralevich0a230152012-06-04 15:20:25 -0700364
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800365__END_DECLS
366
Elliott Hughes09c39d62014-08-19 14:30:30 -0700367#endif /* _STRING_H */