blob: 2c50cfa6059d6c01d6086ab11736bb1161435c99 [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
36__BEGIN_DECLS
37
Elliott Hughes76f89162015-01-26 13:34:58 -080038#if defined(__USE_BSD)
39#include <strings.h>
40#endif
41
Nick Kralevich1c462b72013-05-07 10:00:21 -070042extern void* memccpy(void* __restrict, const void* __restrict, int, size_t);
Nick Kralevicha6779072012-03-21 08:48:18 -070043extern void* memchr(const void *, int, size_t) __purefunc;
44extern void* memrchr(const void *, int, size_t) __purefunc;
45extern int memcmp(const void *, const void *, size_t) __purefunc;
Nick Kralevich1c462b72013-05-07 10:00:21 -070046extern void* memcpy(void* __restrict, const void* __restrict, size_t);
Elliott Hughes3cfb52a2015-02-18 21:29:13 -080047#if defined(__USE_GNU)
48extern void* mempcpy(void* __restrict, const void* __restrict, size_t);
49#endif
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080050extern void* memmove(void *, const void *, size_t);
51extern void* memset(void *, int, size_t);
Nick Kralevicha6779072012-03-21 08:48:18 -070052extern void* memmem(const void *, size_t, const void *, size_t) __purefunc;
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080053
Nick Kralevicha6779072012-03-21 08:48:18 -070054extern char* strchr(const char *, int) __purefunc;
Pavel Chupin3c4b50f2013-07-26 16:50:11 +040055extern char* __strchr_chk(const char *, int, size_t);
Elliott Hughes7ac3c122015-08-26 09:59:29 -070056#if defined(__USE_GNU)
57#if defined(__cplusplus)
58extern "C++" char* strchrnul(char*, int) __RENAME(strchrnul) __purefunc;
59extern "C++" const char* strchrnul(const char*, int) __RENAME(strchrnul) __purefunc;
60#else
61char* strchrnul(const char*, int) __purefunc;
62#endif
63#endif
Pavel Chupin3c4b50f2013-07-26 16:50:11 +040064
Nick Kralevicha6779072012-03-21 08:48:18 -070065extern char* strrchr(const char *, int) __purefunc;
Elliott Hughes53e43292014-02-24 18:00:43 -080066extern char* __strrchr_chk(const char *, int, size_t);
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080067
Nick Kralevicha6779072012-03-21 08:48:18 -070068extern size_t strlen(const char *) __purefunc;
Nick Kralevichcf870192013-05-30 16:48:53 -070069extern size_t __strlen_chk(const char *, size_t);
Nick Kralevicha6779072012-03-21 08:48:18 -070070extern int strcmp(const char *, const char *) __purefunc;
Christopher Ferris950a58e2014-04-04 14:38:18 -070071extern char* stpcpy(char* __restrict, const char* __restrict);
Nick Kralevich1c462b72013-05-07 10:00:21 -070072extern char* strcpy(char* __restrict, const char* __restrict);
73extern char* strcat(char* __restrict, const char* __restrict);
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080074
Elliott Hughesb20c2442014-11-06 15:04:08 -080075int strcasecmp(const char*, const char*) __purefunc;
76int strcasecmp_l(const char*, const char*, locale_t) __purefunc;
77int strncasecmp(const char*, const char*, size_t) __purefunc;
78int strncasecmp_l(const char*, const char*, size_t, locale_t) __purefunc;
79
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080080extern char* strdup(const char *);
81
Nick Kralevicha6779072012-03-21 08:48:18 -070082extern char* strstr(const char *, const char *) __purefunc;
83extern char* strcasestr(const char *haystack, const char *needle) __purefunc;
Nick Kralevich1c462b72013-05-07 10:00:21 -070084extern char* strtok(char* __restrict, const char* __restrict);
85extern char* strtok_r(char* __restrict, const char* __restrict, char** __restrict);
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080086
Elliott Hughes416d7dd2014-08-18 17:28:32 -070087extern char* strerror(int);
Elliott Hughesb20c2442014-11-06 15:04:08 -080088extern char* strerror_l(int, locale_t);
Elliott Hughes416d7dd2014-08-18 17:28:32 -070089#if defined(__USE_GNU)
90extern char* strerror_r(int, char*, size_t) __RENAME(__gnu_strerror_r);
91#else /* POSIX */
92extern int strerror_r(int, char*, size_t);
93#endif
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080094
Nick Kralevicha6779072012-03-21 08:48:18 -070095extern size_t strnlen(const char *, size_t) __purefunc;
Nick Kralevich1c462b72013-05-07 10:00:21 -070096extern char* strncat(char* __restrict, const char* __restrict, size_t);
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080097extern char* strndup(const char *, size_t);
Nick Kralevicha6779072012-03-21 08:48:18 -070098extern int strncmp(const char *, const char *, size_t) __purefunc;
Christopher Ferris950a58e2014-04-04 14:38:18 -070099extern char* stpncpy(char* __restrict, const char* __restrict, size_t);
Nick Kralevich1c462b72013-05-07 10:00:21 -0700100extern char* strncpy(char* __restrict, const char* __restrict, size_t);
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800101
Nick Kralevich1c462b72013-05-07 10:00:21 -0700102extern size_t strlcat(char* __restrict, const char* __restrict, size_t);
103extern size_t strlcpy(char* __restrict, const char* __restrict, size_t);
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800104
Nick Kralevicha6779072012-03-21 08:48:18 -0700105extern size_t strcspn(const char *, const char *) __purefunc;
106extern char* strpbrk(const char *, const char *) __purefunc;
Nick Kralevich1c462b72013-05-07 10:00:21 -0700107extern char* strsep(char** __restrict, const char* __restrict);
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800108extern size_t strspn(const char *, const char *);
109
110extern char* strsignal(int sig);
111
Nick Kralevicha6779072012-03-21 08:48:18 -0700112extern int strcoll(const char *, const char *) __purefunc;
Nick Kralevich1c462b72013-05-07 10:00:21 -0700113extern size_t strxfrm(char* __restrict, const char* __restrict, size_t);
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800114
Dan Albertdfb5ce42014-07-09 22:51:34 +0000115extern int strcoll_l(const char *, const char *, locale_t) __purefunc;
116extern size_t strxfrm_l(char* __restrict, const char* __restrict, size_t, locale_t);
117
Elliott Hughes09c39d62014-08-19 14:30:30 -0700118#if defined(__USE_GNU) && !defined(__bionic_using_posix_basename)
119/*
120 * glibc has a basename in <string.h> that's different to the POSIX one in <libgen.h>.
121 * It doesn't modify its argument, and in C++ it's const-correct.
122 */
123#if defined(__cplusplus)
124extern "C++" char* basename(char*) __RENAME(__gnu_basename) __nonnull((1));
125extern "C++" const char* basename(const char*) __RENAME(__gnu_basename) __nonnull((1));
126#else
127extern char* basename(const char*) __RENAME(__gnu_basename) __nonnull((1));
128#endif
129#define __bionic_using_gnu_basename
130#endif
131
Daniel Micay4ae77362015-04-17 18:16:57 -0400132extern void* __memchr_chk(const void*, int, size_t, size_t);
133__errordecl(__memchr_buf_size_error, "memchr called with size bigger than buffer");
134
135extern void* __memrchr_chk(const void*, int, size_t, size_t);
136__errordecl(__memrchr_buf_size_error, "memrchr called with size bigger than buffer");
137extern void* __memrchr_real(const void*, int, size_t) __RENAME(memrchr);
138
Dan Albert658727e2014-10-07 11:10:36 -0700139extern char* __stpncpy_chk2(char* __restrict, const char* __restrict, size_t, size_t, size_t);
140extern char* __strncpy_chk2(char* __restrict, const char* __restrict, size_t, size_t, size_t);
141extern size_t __strlcpy_real(char* __restrict, const char* __restrict, size_t) __RENAME(strlcpy);
142extern size_t __strlcpy_chk(char *, const char *, size_t, size_t);
143extern size_t __strlcat_real(char* __restrict, const char* __restrict, size_t) __RENAME(strlcat);
144extern size_t __strlcat_chk(char* __restrict, const char* __restrict, size_t, size_t);
145
Elliott Hughes890c8ed2013-03-22 10:58:55 -0700146#if defined(__BIONIC_FORTIFY)
Nick Kralevich0a230152012-06-04 15:20:25 -0700147
148__BIONIC_FORTIFY_INLINE
Daniel Micay4ae77362015-04-17 18:16:57 -0400149void* memchr(const void *s, int c, size_t n) {
150 size_t bos = __bos(s);
151
152#if !defined(__clang__)
153 if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
154 return __builtin_memchr(s, c, n);
155 }
156
157 if (__builtin_constant_p(n) && (n > bos)) {
158 __memchr_buf_size_error();
159 }
160
161 if (__builtin_constant_p(n) && (n <= bos)) {
162 return __builtin_memchr(s, c, n);
163 }
164#endif
165
166 return __memchr_chk(s, c, n, bos);
167}
168
169__BIONIC_FORTIFY_INLINE
170void* memrchr(const void *s, int c, size_t n) {
171 size_t bos = __bos(s);
172
173#if !defined(__clang__)
174 if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
175 return __memrchr_real(s, c, n);
176 }
177
178 if (__builtin_constant_p(n) && (n > bos)) {
179 __memrchr_buf_size_error();
180 }
181
182 if (__builtin_constant_p(n) && (n <= bos)) {
183 return __memrchr_real(s, c, n);
184 }
185#endif
186
187 return __memrchr_chk(s, c, n, bos);
188}
189
190__BIONIC_FORTIFY_INLINE
Nick Kralevich16d1af12013-06-17 14:49:19 -0700191void* memcpy(void* __restrict dest, const void* __restrict src, size_t copy_amount) {
Nick Kralevichb84f6672014-10-05 06:52:24 -0700192 return __builtin___memcpy_chk(dest, src, copy_amount, __bos0(dest));
Nick Kralevich0a230152012-06-04 15:20:25 -0700193}
194
195__BIONIC_FORTIFY_INLINE
Nick Kralevich16d1af12013-06-17 14:49:19 -0700196void* memmove(void *dest, const void *src, size_t len) {
Nick Kralevichbd8e6742013-08-28 13:22:52 -0700197 return __builtin___memmove_chk(dest, src, len, __bos0(dest));
Nick Kralevich0a230152012-06-04 15:20:25 -0700198}
199
200__BIONIC_FORTIFY_INLINE
Christopher Ferris950a58e2014-04-04 14:38:18 -0700201char* stpcpy(char* __restrict dest, const char* __restrict src) {
202 return __builtin___stpcpy_chk(dest, src, __bos(dest));
203}
204
205__BIONIC_FORTIFY_INLINE
Nick Kralevich16d1af12013-06-17 14:49:19 -0700206char* strcpy(char* __restrict dest, const char* __restrict src) {
Nick Kralevich9020fd52013-04-30 11:31:35 -0700207 return __builtin___strcpy_chk(dest, src, __bos(dest));
Nick Kralevich0a230152012-06-04 15:20:25 -0700208}
209
Christopher Ferris950a58e2014-04-04 14:38:18 -0700210__BIONIC_FORTIFY_INLINE
211char* stpncpy(char* __restrict dest, const char* __restrict src, size_t n) {
212 size_t bos_dest = __bos(dest);
213 size_t bos_src = __bos(src);
Christopher Ferris950a58e2014-04-04 14:38:18 -0700214
215 if (bos_src == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
216 return __builtin___stpncpy_chk(dest, src, n, bos_dest);
217 }
218
219 if (__builtin_constant_p(n) && (n <= bos_src)) {
220 return __builtin___stpncpy_chk(dest, src, n, bos_dest);
221 }
222
223 size_t slen = __builtin_strlen(src);
224 if (__builtin_constant_p(slen)) {
225 return __builtin___stpncpy_chk(dest, src, n, bos_dest);
226 }
227
228 return __stpncpy_chk2(dest, src, n, bos_dest, bos_src);
229}
230
Nick Kralevich0a230152012-06-04 15:20:25 -0700231__BIONIC_FORTIFY_INLINE
Nick Kralevich16d1af12013-06-17 14:49:19 -0700232char* strncpy(char* __restrict dest, const char* __restrict src, size_t n) {
Nick Kralevich93501d32013-08-28 10:47:43 -0700233 size_t bos_dest = __bos(dest);
234 size_t bos_src = __bos(src);
Nick Kralevich93501d32013-08-28 10:47:43 -0700235
236 if (bos_src == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
237 return __builtin___strncpy_chk(dest, src, n, bos_dest);
238 }
239
Nick Kralevichd13c2b12013-09-27 13:21:24 -0700240 if (__builtin_constant_p(n) && (n <= bos_src)) {
241 return __builtin___strncpy_chk(dest, src, n, bos_dest);
242 }
243
Nick Kralevich93501d32013-08-28 10:47:43 -0700244 size_t slen = __builtin_strlen(src);
245 if (__builtin_constant_p(slen)) {
246 return __builtin___strncpy_chk(dest, src, n, bos_dest);
247 }
248
249 return __strncpy_chk2(dest, src, n, bos_dest, bos_src);
Nick Kralevich0a230152012-06-04 15:20:25 -0700250}
251
252__BIONIC_FORTIFY_INLINE
Nick Kralevich16d1af12013-06-17 14:49:19 -0700253char* strcat(char* __restrict dest, const char* __restrict src) {
Nick Kralevich9020fd52013-04-30 11:31:35 -0700254 return __builtin___strcat_chk(dest, src, __bos(dest));
Nick Kralevich0a230152012-06-04 15:20:25 -0700255}
256
257__BIONIC_FORTIFY_INLINE
Nick Kralevich1c462b72013-05-07 10:00:21 -0700258char *strncat(char* __restrict dest, const char* __restrict src, size_t n) {
Nick Kralevich9020fd52013-04-30 11:31:35 -0700259 return __builtin___strncat_chk(dest, src, n, __bos(dest));
Nick Kralevich0a230152012-06-04 15:20:25 -0700260}
261
Nick Kralevich71a18dd2012-06-07 14:01:26 -0700262__BIONIC_FORTIFY_INLINE
Nick Kralevich16d1af12013-06-17 14:49:19 -0700263void* memset(void *s, int c, size_t n) {
Nick Kralevichbd8e6742013-08-28 13:22:52 -0700264 return __builtin___memset_chk(s, c, n, __bos0(s));
Nick Kralevich71a18dd2012-06-07 14:01:26 -0700265}
266
Nick Kralevich8df49ad2012-06-13 16:57:27 -0700267__BIONIC_FORTIFY_INLINE
Nick Kralevich1c462b72013-05-07 10:00:21 -0700268size_t strlcpy(char* __restrict dest, const char* __restrict src, size_t size) {
Nick Kralevich9020fd52013-04-30 11:31:35 -0700269 size_t bos = __bos(dest);
Nick Kralevich8df49ad2012-06-13 16:57:27 -0700270
Nick Kralevich8bafa742013-06-20 12:17:44 -0700271#if !defined(__clang__)
Nick Kralevich8df49ad2012-06-13 16:57:27 -0700272 // Compiler doesn't know destination size. Don't call __strlcpy_chk
Nick Kralevich9b6cc222012-07-13 14:46:36 -0700273 if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
Nick Kralevichcb228fb2012-06-26 16:05:19 -0700274 return __strlcpy_real(dest, src, size);
Nick Kralevich8df49ad2012-06-13 16:57:27 -0700275 }
276
277 // Compiler can prove, at compile time, that the passed in size
278 // is always <= the actual object size. Don't call __strlcpy_chk
279 if (__builtin_constant_p(size) && (size <= bos)) {
Nick Kralevichcb228fb2012-06-26 16:05:19 -0700280 return __strlcpy_real(dest, src, size);
Nick Kralevich8df49ad2012-06-13 16:57:27 -0700281 }
Nick Kralevich8bafa742013-06-20 12:17:44 -0700282#endif /* !defined(__clang__) */
Nick Kralevich8df49ad2012-06-13 16:57:27 -0700283
284 return __strlcpy_chk(dest, src, size, bos);
285}
286
Nick Kralevich8df49ad2012-06-13 16:57:27 -0700287
288__BIONIC_FORTIFY_INLINE
Nick Kralevich1c462b72013-05-07 10:00:21 -0700289size_t strlcat(char* __restrict dest, const char* __restrict src, size_t size) {
Nick Kralevich9020fd52013-04-30 11:31:35 -0700290 size_t bos = __bos(dest);
Nick Kralevich8df49ad2012-06-13 16:57:27 -0700291
Nick Kralevicha6cde392013-06-29 08:15:25 -0700292#if !defined(__clang__)
Nick Kralevich8df49ad2012-06-13 16:57:27 -0700293 // Compiler doesn't know destination size. Don't call __strlcat_chk
Nick Kralevich9b6cc222012-07-13 14:46:36 -0700294 if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
Nick Kralevichcb228fb2012-06-26 16:05:19 -0700295 return __strlcat_real(dest, src, size);
Nick Kralevich8df49ad2012-06-13 16:57:27 -0700296 }
297
298 // Compiler can prove, at compile time, that the passed in size
299 // is always <= the actual object size. Don't call __strlcat_chk
300 if (__builtin_constant_p(size) && (size <= bos)) {
Nick Kralevichcb228fb2012-06-26 16:05:19 -0700301 return __strlcat_real(dest, src, size);
Nick Kralevich8df49ad2012-06-13 16:57:27 -0700302 }
Nick Kralevicha6cde392013-06-29 08:15:25 -0700303#endif /* !defined(__clang__) */
Nick Kralevich8df49ad2012-06-13 16:57:27 -0700304
305 return __strlcat_chk(dest, src, size, bos);
306}
307
Nick Kralevich260bf8c2012-07-13 11:27:06 -0700308__BIONIC_FORTIFY_INLINE
309size_t strlen(const char *s) {
Nick Kralevich9020fd52013-04-30 11:31:35 -0700310 size_t bos = __bos(s);
Nick Kralevich9b6cc222012-07-13 14:46:36 -0700311
Nick Kralevich16d1af12013-06-17 14:49:19 -0700312#if !defined(__clang__)
Nick Kralevich9b6cc222012-07-13 14:46:36 -0700313 // Compiler doesn't know destination size. Don't call __strlen_chk
314 if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
Nick Kralevicha44e9af2013-01-17 15:41:33 -0800315 return __builtin_strlen(s);
316 }
317
318 size_t slen = __builtin_strlen(s);
319 if (__builtin_constant_p(slen)) {
320 return slen;
Nick Kralevich260bf8c2012-07-13 11:27:06 -0700321 }
Nick Kralevich16d1af12013-06-17 14:49:19 -0700322#endif /* !defined(__clang__) */
Nick Kralevich9b6cc222012-07-13 14:46:36 -0700323
Nick Kralevich260bf8c2012-07-13 11:27:06 -0700324 return __strlen_chk(s, bos);
325}
Nick Kralevich8df49ad2012-06-13 16:57:27 -0700326
Nick Kralevich049e5832012-11-30 15:15:58 -0800327__BIONIC_FORTIFY_INLINE
328char* strchr(const char *s, int c) {
Nick Kralevich9020fd52013-04-30 11:31:35 -0700329 size_t bos = __bos(s);
Nick Kralevich049e5832012-11-30 15:15:58 -0800330
Nick Kralevich16d1af12013-06-17 14:49:19 -0700331#if !defined(__clang__)
Nick Kralevich049e5832012-11-30 15:15:58 -0800332 // Compiler doesn't know destination size. Don't call __strchr_chk
333 if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
Nick Kralevicha44e9af2013-01-17 15:41:33 -0800334 return __builtin_strchr(s, c);
335 }
336
337 size_t slen = __builtin_strlen(s);
338 if (__builtin_constant_p(slen) && (slen < bos)) {
339 return __builtin_strchr(s, c);
Nick Kralevich049e5832012-11-30 15:15:58 -0800340 }
Nick Kralevich16d1af12013-06-17 14:49:19 -0700341#endif /* !defined(__clang__) */
Nick Kralevich049e5832012-11-30 15:15:58 -0800342
343 return __strchr_chk(s, c, bos);
344}
345
Nick Kralevich9a4d3052012-12-03 10:36:13 -0800346__BIONIC_FORTIFY_INLINE
347char* strrchr(const char *s, int c) {
Nick Kralevich3b2e6bc2013-04-30 14:19:23 -0700348 size_t bos = __bos(s);
Nick Kralevich9a4d3052012-12-03 10:36:13 -0800349
Nick Kralevich16d1af12013-06-17 14:49:19 -0700350#if !defined(__clang__)
Nick Kralevich9a4d3052012-12-03 10:36:13 -0800351 // Compiler doesn't know destination size. Don't call __strrchr_chk
352 if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
Nick Kralevicha44e9af2013-01-17 15:41:33 -0800353 return __builtin_strrchr(s, c);
354 }
355
356 size_t slen = __builtin_strlen(s);
357 if (__builtin_constant_p(slen) && (slen < bos)) {
358 return __builtin_strrchr(s, c);
Nick Kralevich9a4d3052012-12-03 10:36:13 -0800359 }
Nick Kralevich16d1af12013-06-17 14:49:19 -0700360#endif /* !defined(__clang__) */
Nick Kralevich9a4d3052012-12-03 10:36:13 -0800361
362 return __strrchr_chk(s, c, bos);
363}
364
Nick Kralevich049e5832012-11-30 15:15:58 -0800365
Elliott Hughes890c8ed2013-03-22 10:58:55 -0700366#endif /* defined(__BIONIC_FORTIFY) */
Nick Kralevich0a230152012-06-04 15:20:25 -0700367
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800368__END_DECLS
369
Elliott Hughes09c39d62014-08-19 14:30:30 -0700370#endif /* _STRING_H */