The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 1 | /* |
| 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 Hughes | 09c39d6 | 2014-08-19 14:30:30 -0700 | [diff] [blame] | 28 | |
| 29 | #ifndef _STRING_H |
| 30 | #define _STRING_H |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 31 | |
| 32 | #include <sys/cdefs.h> |
| 33 | #include <stddef.h> |
Dan Albert | dfb5ce4 | 2014-07-09 22:51:34 +0000 | [diff] [blame] | 34 | #include <xlocale.h> |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 35 | |
Josh Gao | c3cec27 | 2016-04-07 13:39:49 -0700 | [diff] [blame] | 36 | #include <bits/strcasecmp.h> |
| 37 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 38 | __BEGIN_DECLS |
| 39 | |
Elliott Hughes | 76f8916 | 2015-01-26 13:34:58 -0800 | [diff] [blame] | 40 | #if defined(__USE_BSD) |
| 41 | #include <strings.h> |
| 42 | #endif |
| 43 | |
Elliott Hughes | 684c31a | 2017-08-18 15:07:41 -0700 | [diff] [blame] | 44 | void* memccpy(void* __dst, const void* __src, int __stop_char, size_t __n); |
George Burgess IV | 9024235 | 2018-02-06 12:51:31 -0800 | [diff] [blame] | 45 | void* memchr(const void* __s, int __ch, size_t __n) __attribute_pure__; |
Elliott Hughes | df9a489 | 2017-08-23 14:34:03 -0700 | [diff] [blame] | 46 | #if defined(__cplusplus) |
| 47 | extern "C++" void* memrchr(void* __s, int __ch, size_t __n) __RENAME(memrchr) __attribute_pure__; |
| 48 | extern "C++" const void* memrchr(const void* __s, int __ch, size_t __n) __RENAME(memrchr) __attribute_pure__; |
| 49 | #else |
George Burgess IV | 9024235 | 2018-02-06 12:51:31 -0800 | [diff] [blame] | 50 | void* memrchr(const void* __s, int __ch, size_t __n) __attribute_pure__; |
Elliott Hughes | df9a489 | 2017-08-23 14:34:03 -0700 | [diff] [blame] | 51 | #endif |
Elliott Hughes | 684c31a | 2017-08-18 15:07:41 -0700 | [diff] [blame] | 52 | int memcmp(const void* __lhs, const void* __rhs, size_t __n) __attribute_pure__; |
George Burgess IV | 9024235 | 2018-02-06 12:51:31 -0800 | [diff] [blame] | 53 | void* memcpy(void*, const void*, size_t); |
Elliott Hughes | 3cfb52a | 2015-02-18 21:29:13 -0800 | [diff] [blame] | 54 | #if defined(__USE_GNU) |
Elliott Hughes | 684c31a | 2017-08-18 15:07:41 -0700 | [diff] [blame] | 55 | void* mempcpy(void* __dst, const void* __src, size_t __n) __INTRODUCED_IN(23); |
Elliott Hughes | 3cfb52a | 2015-02-18 21:29:13 -0800 | [diff] [blame] | 56 | #endif |
George Burgess IV | 9024235 | 2018-02-06 12:51:31 -0800 | [diff] [blame] | 57 | void* memmove(void* __dst, const void* __src, size_t __n); |
Elliott Hughes | 0d64243 | 2022-08-10 23:35:03 +0000 | [diff] [blame] | 58 | |
| 59 | /** |
| 60 | * [memset(3)](http://man7.org/linux/man-pages/man3/memset.3.html) writes the |
| 61 | * bottom 8 bits of the given int to the next `n` bytes of `dst`. |
| 62 | * |
| 63 | * Returns `dst`. |
| 64 | */ |
George Burgess IV | 9024235 | 2018-02-06 12:51:31 -0800 | [diff] [blame] | 65 | void* memset(void* __dst, int __ch, size_t __n); |
Elliott Hughes | 0d64243 | 2022-08-10 23:35:03 +0000 | [diff] [blame] | 66 | |
| 67 | /** |
| 68 | * [memset_explicit(3)](http://man7.org/linux/man-pages/man3/memset_explicit.3.html) |
| 69 | * writes the bottom 8 bits of the given int to the next `n` bytes of `dst`, |
| 70 | * but won't be optimized out by the compiler. |
| 71 | * |
| 72 | * Returns `dst`. |
| 73 | */ |
| 74 | void* memset_explicit(void* __dst, int __ch, size_t __n) __INTRODUCED_IN(34); |
| 75 | |
Elliott Hughes | 684c31a | 2017-08-18 15:07:41 -0700 | [diff] [blame] | 76 | void* memmem(const void* __haystack, size_t __haystack_size, const void* __needle, size_t __needle_size) __attribute_pure__; |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 77 | |
George Burgess IV | 9024235 | 2018-02-06 12:51:31 -0800 | [diff] [blame] | 78 | char* strchr(const char* __s, int __ch) __attribute_pure__; |
Elliott Hughes | 684c31a | 2017-08-18 15:07:41 -0700 | [diff] [blame] | 79 | char* __strchr_chk(const char* __s, int __ch, size_t __n) __INTRODUCED_IN(18); |
Elliott Hughes | 7ac3c12 | 2015-08-26 09:59:29 -0700 | [diff] [blame] | 80 | #if defined(__USE_GNU) |
| 81 | #if defined(__cplusplus) |
Elliott Hughes | 684c31a | 2017-08-18 15:07:41 -0700 | [diff] [blame] | 82 | extern "C++" char* strchrnul(char* __s, int __ch) __RENAME(strchrnul) __attribute_pure__ __INTRODUCED_IN(24); |
| 83 | extern "C++" const char* strchrnul(const char* __s, int __ch) __RENAME(strchrnul) __attribute_pure__ __INTRODUCED_IN(24); |
Elliott Hughes | 7ac3c12 | 2015-08-26 09:59:29 -0700 | [diff] [blame] | 84 | #else |
Elliott Hughes | 684c31a | 2017-08-18 15:07:41 -0700 | [diff] [blame] | 85 | char* strchrnul(const char* __s, int __ch) __attribute_pure__ __INTRODUCED_IN(24); |
Elliott Hughes | 7ac3c12 | 2015-08-26 09:59:29 -0700 | [diff] [blame] | 86 | #endif |
| 87 | #endif |
Pavel Chupin | 3c4b50f | 2013-07-26 16:50:11 +0400 | [diff] [blame] | 88 | |
George Burgess IV | 9024235 | 2018-02-06 12:51:31 -0800 | [diff] [blame] | 89 | char* strrchr(const char* __s, int __ch) __attribute_pure__; |
Elliott Hughes | 684c31a | 2017-08-18 15:07:41 -0700 | [diff] [blame] | 90 | char* __strrchr_chk(const char* __s, int __ch, size_t __n) __INTRODUCED_IN(18); |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 91 | |
George Burgess IV | 9024235 | 2018-02-06 12:51:31 -0800 | [diff] [blame] | 92 | size_t strlen(const char* __s) __attribute_pure__; |
Elliott Hughes | 684c31a | 2017-08-18 15:07:41 -0700 | [diff] [blame] | 93 | size_t __strlen_chk(const char* __s, size_t __n) __INTRODUCED_IN(17); |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 94 | |
Elliott Hughes | 684c31a | 2017-08-18 15:07:41 -0700 | [diff] [blame] | 95 | int strcmp(const char* __lhs, const char* __rhs) __attribute_pure__; |
George Burgess IV | 9024235 | 2018-02-06 12:51:31 -0800 | [diff] [blame] | 96 | char* stpcpy(char* __dst, const char* __src) __INTRODUCED_IN(21); |
| 97 | char* strcpy(char* __dst, const char* __src); |
| 98 | char* strcat(char* __dst, const char* __src); |
Elliott Hughes | 684c31a | 2017-08-18 15:07:41 -0700 | [diff] [blame] | 99 | char* strdup(const char* __s); |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 100 | |
Elliott Hughes | 684c31a | 2017-08-18 15:07:41 -0700 | [diff] [blame] | 101 | char* strstr(const char* __haystack, const char* __needle) __attribute_pure__; |
Elliott Hughes | df9a489 | 2017-08-23 14:34:03 -0700 | [diff] [blame] | 102 | #if defined(__cplusplus) |
| 103 | extern "C++" char* strcasestr(char*, const char*) __RENAME(strcasestr) __attribute_pure__; |
| 104 | extern "C++" const char* strcasestr(const char*, const char*) __RENAME(strcasestr) __attribute_pure__; |
| 105 | #else |
Elliott Hughes | 684c31a | 2017-08-18 15:07:41 -0700 | [diff] [blame] | 106 | char* strcasestr(const char* __haystack, const char* __needle) __attribute_pure__; |
Elliott Hughes | df9a489 | 2017-08-23 14:34:03 -0700 | [diff] [blame] | 107 | #endif |
Elliott Hughes | 684c31a | 2017-08-18 15:07:41 -0700 | [diff] [blame] | 108 | char* strtok(char* __s, const char* __delimiter); |
| 109 | char* strtok_r(char* __s, const char* __delimiter, char** __pos_ptr); |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 110 | |
Elliott Hughes | 684c31a | 2017-08-18 15:07:41 -0700 | [diff] [blame] | 111 | char* strerror(int __errno_value); |
| 112 | char* strerror_l(int __errno_value, locale_t __l) __INTRODUCED_IN(23); |
Dan Albert | 8b154b1 | 2017-02-14 16:33:06 -0800 | [diff] [blame] | 113 | #if defined(__USE_GNU) && __ANDROID_API__ >= 23 |
Elliott Hughes | 684c31a | 2017-08-18 15:07:41 -0700 | [diff] [blame] | 114 | char* strerror_r(int __errno_value, char* __buf, size_t __n) __RENAME(__gnu_strerror_r) __INTRODUCED_IN(23); |
Elliott Hughes | 416d7dd | 2014-08-18 17:28:32 -0700 | [diff] [blame] | 115 | #else /* POSIX */ |
Elliott Hughes | 684c31a | 2017-08-18 15:07:41 -0700 | [diff] [blame] | 116 | int strerror_r(int __errno_value, char* __buf, size_t __n); |
Elliott Hughes | 416d7dd | 2014-08-18 17:28:32 -0700 | [diff] [blame] | 117 | #endif |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 118 | |
Elliott Hughes | 684c31a | 2017-08-18 15:07:41 -0700 | [diff] [blame] | 119 | size_t strnlen(const char* __s, size_t __n) __attribute_pure__; |
George Burgess IV | 9024235 | 2018-02-06 12:51:31 -0800 | [diff] [blame] | 120 | char* strncat(char* __dst, const char* __src, size_t __n); |
Elliott Hughes | 684c31a | 2017-08-18 15:07:41 -0700 | [diff] [blame] | 121 | char* strndup(const char* __s, size_t __n); |
| 122 | int strncmp(const char* __lhs, const char* __rhs, size_t __n) __attribute_pure__; |
George Burgess IV | 9024235 | 2018-02-06 12:51:31 -0800 | [diff] [blame] | 123 | char* stpncpy(char* __dst, const char* __src, size_t __n) __INTRODUCED_IN(21); |
| 124 | char* strncpy(char* __dst, const char* __src, size_t __n); |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 125 | |
George Burgess IV | 9024235 | 2018-02-06 12:51:31 -0800 | [diff] [blame] | 126 | size_t strlcat(char* __dst, const char* __src, size_t __n); |
| 127 | size_t strlcpy(char* __dst, const char* __src, size_t __n); |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 128 | |
Elliott Hughes | 684c31a | 2017-08-18 15:07:41 -0700 | [diff] [blame] | 129 | size_t strcspn(const char* __s, const char* __reject) __attribute_pure__; |
| 130 | char* strpbrk(const char* __s, const char* __accept) __attribute_pure__; |
| 131 | char* strsep(char** __s_ptr, const char* __delimiter); |
| 132 | size_t strspn(const char* __s, const char* __accept); |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 133 | |
Elliott Hughes | 684c31a | 2017-08-18 15:07:41 -0700 | [diff] [blame] | 134 | char* strsignal(int __signal); |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 135 | |
Elliott Hughes | 684c31a | 2017-08-18 15:07:41 -0700 | [diff] [blame] | 136 | int strcoll(const char* __lhs, const char* __rhs) __attribute_pure__; |
| 137 | size_t strxfrm(char* __dst, const char* __src, size_t __n); |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 138 | |
Elliott Hughes | 95c6cd7 | 2019-12-20 13:26:14 -0800 | [diff] [blame] | 139 | #if __ANDROID_API__ >= 21 |
Elliott Hughes | 684c31a | 2017-08-18 15:07:41 -0700 | [diff] [blame] | 140 | int strcoll_l(const char* __lhs, const char* __rhs, locale_t __l) __attribute_pure__ __INTRODUCED_IN(21); |
| 141 | size_t strxfrm_l(char* __dst, const char* __src, size_t __n, locale_t __l) __INTRODUCED_IN(21); |
Josh Gao | 6cd9fb0 | 2016-09-23 14:06:05 -0700 | [diff] [blame] | 142 | #else |
| 143 | // Implemented as static inlines before 21. |
| 144 | #endif |
Dan Albert | dfb5ce4 | 2014-07-09 22:51:34 +0000 | [diff] [blame] | 145 | |
Josh Gao | eb9b925 | 2015-11-03 18:46:02 -0800 | [diff] [blame] | 146 | #if defined(__USE_GNU) && !defined(basename) |
Elliott Hughes | 09c39d6 | 2014-08-19 14:30:30 -0700 | [diff] [blame] | 147 | /* |
| 148 | * glibc has a basename in <string.h> that's different to the POSIX one in <libgen.h>. |
| 149 | * It doesn't modify its argument, and in C++ it's const-correct. |
| 150 | */ |
| 151 | #if defined(__cplusplus) |
Elliott Hughes | 684c31a | 2017-08-18 15:07:41 -0700 | [diff] [blame] | 152 | extern "C++" char* basename(char* __path) __RENAME(__gnu_basename) __INTRODUCED_IN(23); |
| 153 | extern "C++" const char* basename(const char* __path) __RENAME(__gnu_basename) __INTRODUCED_IN(23); |
Elliott Hughes | 09c39d6 | 2014-08-19 14:30:30 -0700 | [diff] [blame] | 154 | #else |
Elliott Hughes | 684c31a | 2017-08-18 15:07:41 -0700 | [diff] [blame] | 155 | char* basename(const char* __path) __RENAME(__gnu_basename) __INTRODUCED_IN(23); |
Elliott Hughes | 09c39d6 | 2014-08-19 14:30:30 -0700 | [diff] [blame] | 156 | #endif |
Elliott Hughes | 09c39d6 | 2014-08-19 14:30:30 -0700 | [diff] [blame] | 157 | #endif |
| 158 | |
George Burgess IV | b97049c | 2017-07-24 15:05:05 -0700 | [diff] [blame] | 159 | #if defined(__BIONIC_INCLUDE_FORTIFY_HEADERS) |
| 160 | #include <bits/fortify/string.h> |
| 161 | #endif |
Nick Kralevich | 0a23015 | 2012-06-04 15:20:25 -0700 | [diff] [blame] | 162 | |
George Burgess IV | bd3d208 | 2017-04-04 17:34:02 -0700 | [diff] [blame] | 163 | /* Const-correct overloads. Placed after FORTIFY so we call those functions, if possible. */ |
Elliott Hughes | 0d1a8a5 | 2018-07-24 19:36:51 +0000 | [diff] [blame] | 164 | #if defined(__cplusplus) |
George Burgess IV | bd3d208 | 2017-04-04 17:34:02 -0700 | [diff] [blame] | 165 | /* |
| 166 | * Use two enable_ifs so these overloads don't conflict with + are preferred over libcxx's. This can |
| 167 | * be reduced to 1 after libcxx recognizes that we have const-correct overloads. |
| 168 | */ |
| 169 | #define __prefer_this_overload __enable_if(true, "preferred overload") __enable_if(true, "") |
| 170 | extern "C++" { |
| 171 | inline __always_inline |
Elliott Hughes | 3f66e74 | 2017-08-01 13:24:40 -0700 | [diff] [blame] | 172 | void* __bionic_memchr(const void* const s __pass_object_size, int c, size_t n) { |
George Burgess IV | bd3d208 | 2017-04-04 17:34:02 -0700 | [diff] [blame] | 173 | return memchr(s, c, n); |
| 174 | } |
| 175 | |
| 176 | inline __always_inline |
Elliott Hughes | 3f66e74 | 2017-08-01 13:24:40 -0700 | [diff] [blame] | 177 | const void* memchr(const void* const s __pass_object_size, int c, size_t n) |
George Burgess IV | bd3d208 | 2017-04-04 17:34:02 -0700 | [diff] [blame] | 178 | __prefer_this_overload { |
| 179 | return __bionic_memchr(s, c, n); |
| 180 | } |
| 181 | |
| 182 | inline __always_inline |
Elliott Hughes | 3f66e74 | 2017-08-01 13:24:40 -0700 | [diff] [blame] | 183 | void* memchr(void* const s __pass_object_size, int c, size_t n) __prefer_this_overload { |
George Burgess IV | bd3d208 | 2017-04-04 17:34:02 -0700 | [diff] [blame] | 184 | return __bionic_memchr(s, c, n); |
| 185 | } |
| 186 | |
| 187 | inline __always_inline |
Elliott Hughes | 3f66e74 | 2017-08-01 13:24:40 -0700 | [diff] [blame] | 188 | char* __bionic_strchr(const char* const s __pass_object_size, int c) { |
George Burgess IV | bd3d208 | 2017-04-04 17:34:02 -0700 | [diff] [blame] | 189 | return strchr(s, c); |
| 190 | } |
| 191 | |
| 192 | inline __always_inline |
Elliott Hughes | 3f66e74 | 2017-08-01 13:24:40 -0700 | [diff] [blame] | 193 | const char* strchr(const char* const s __pass_object_size, int c) |
George Burgess IV | bd3d208 | 2017-04-04 17:34:02 -0700 | [diff] [blame] | 194 | __prefer_this_overload { |
| 195 | return __bionic_strchr(s, c); |
| 196 | } |
| 197 | |
| 198 | inline __always_inline |
Elliott Hughes | 3f66e74 | 2017-08-01 13:24:40 -0700 | [diff] [blame] | 199 | char* strchr(char* const s __pass_object_size, int c) |
George Burgess IV | bd3d208 | 2017-04-04 17:34:02 -0700 | [diff] [blame] | 200 | __prefer_this_overload { |
| 201 | return __bionic_strchr(s, c); |
| 202 | } |
| 203 | |
| 204 | inline __always_inline |
Elliott Hughes | 3f66e74 | 2017-08-01 13:24:40 -0700 | [diff] [blame] | 205 | char* __bionic_strrchr(const char* const s __pass_object_size, int c) { |
George Burgess IV | bd3d208 | 2017-04-04 17:34:02 -0700 | [diff] [blame] | 206 | return strrchr(s, c); |
| 207 | } |
| 208 | |
| 209 | inline __always_inline |
Elliott Hughes | 3f66e74 | 2017-08-01 13:24:40 -0700 | [diff] [blame] | 210 | const char* strrchr(const char* const s __pass_object_size, int c) __prefer_this_overload { |
George Burgess IV | bd3d208 | 2017-04-04 17:34:02 -0700 | [diff] [blame] | 211 | return __bionic_strrchr(s, c); |
| 212 | } |
| 213 | |
| 214 | inline __always_inline |
Elliott Hughes | 3f66e74 | 2017-08-01 13:24:40 -0700 | [diff] [blame] | 215 | char* strrchr(char* const s __pass_object_size, int c) __prefer_this_overload { |
George Burgess IV | bd3d208 | 2017-04-04 17:34:02 -0700 | [diff] [blame] | 216 | return __bionic_strrchr(s, c); |
| 217 | } |
| 218 | |
| 219 | /* Functions with no FORTIFY counterpart. */ |
| 220 | inline __always_inline |
Elliott Hughes | 3f66e74 | 2017-08-01 13:24:40 -0700 | [diff] [blame] | 221 | char* __bionic_strstr(const char* h, const char* n) { return strstr(h, n); } |
George Burgess IV | bd3d208 | 2017-04-04 17:34:02 -0700 | [diff] [blame] | 222 | |
| 223 | inline __always_inline |
Elliott Hughes | 3f66e74 | 2017-08-01 13:24:40 -0700 | [diff] [blame] | 224 | const char* strstr(const char* h, const char* n) __prefer_this_overload { |
George Burgess IV | bd3d208 | 2017-04-04 17:34:02 -0700 | [diff] [blame] | 225 | return __bionic_strstr(h, n); |
| 226 | } |
| 227 | |
| 228 | inline __always_inline |
Elliott Hughes | 3f66e74 | 2017-08-01 13:24:40 -0700 | [diff] [blame] | 229 | char* strstr(char* h, const char* n) __prefer_this_overload { |
George Burgess IV | bd3d208 | 2017-04-04 17:34:02 -0700 | [diff] [blame] | 230 | return __bionic_strstr(h, n); |
| 231 | } |
| 232 | |
| 233 | inline __always_inline |
Elliott Hughes | 3f66e74 | 2017-08-01 13:24:40 -0700 | [diff] [blame] | 234 | char* __bionic_strpbrk(const char* h, const char* n) { return strpbrk(h, n); } |
George Burgess IV | bd3d208 | 2017-04-04 17:34:02 -0700 | [diff] [blame] | 235 | |
| 236 | inline __always_inline |
Elliott Hughes | 3f66e74 | 2017-08-01 13:24:40 -0700 | [diff] [blame] | 237 | char* strpbrk(char* h, const char* n) __prefer_this_overload { |
George Burgess IV | bd3d208 | 2017-04-04 17:34:02 -0700 | [diff] [blame] | 238 | return __bionic_strpbrk(h, n); |
| 239 | } |
| 240 | |
| 241 | inline __always_inline |
Elliott Hughes | 3f66e74 | 2017-08-01 13:24:40 -0700 | [diff] [blame] | 242 | const char* strpbrk(const char* h, const char* n) __prefer_this_overload { |
George Burgess IV | bd3d208 | 2017-04-04 17:34:02 -0700 | [diff] [blame] | 243 | return __bionic_strpbrk(h, n); |
| 244 | } |
| 245 | } |
| 246 | #undef __prefer_this_overload |
| 247 | #endif |
| 248 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 249 | __END_DECLS |
| 250 | |
Elliott Hughes | 684c31a | 2017-08-18 15:07:41 -0700 | [diff] [blame] | 251 | #endif |