summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_libc.cc
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2012-08-21 09:26:26 +0000
committerAlexey Samsonov <samsonov@google.com>2012-08-21 09:26:26 +0000
commit251134734f71a7e21a7bd17bc7b5821f07c803b2 (patch)
tree48eee00fb9ea1f54e6b71868456540e5c87125d2 /lib/sanitizer_common/sanitizer_libc.cc
parent2bf265b3faf8be1710e9a0441fe9344e105e991c (diff)
downloadcompiler-rt-251134734f71a7e21a7bd17bc7b5821f07c803b2.tar.gz
[Sanitizer] implement internal_strcspn
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@162272 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_libc.cc')
-rw-r--r--lib/sanitizer_common/sanitizer_libc.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/sanitizer_common/sanitizer_libc.cc b/lib/sanitizer_common/sanitizer_libc.cc
index c4332423b..6fa05e49d 100644
--- a/lib/sanitizer_common/sanitizer_libc.cc
+++ b/lib/sanitizer_common/sanitizer_libc.cc
@@ -56,6 +56,15 @@ void *internal_memset(void* s, int c, uptr n) {
return s;
}
+uptr internal_strcspn(const char *s, const char *reject) {
+ uptr i;
+ for (i = 0; s[i]; i++) {
+ if (internal_strchr(reject, s[i]) != 0)
+ return i;
+ }
+ return i;
+}
+
char* internal_strdup(const char *s) {
uptr len = internal_strlen(s);
char *s2 = (char*)InternalAlloc(len + 1);