diff options
author | Alexey Samsonov <samsonov@google.com> | 2012-06-04 13:27:49 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2012-06-04 13:27:49 +0000 |
commit | c0d78c1de1f2607c874020d27b72cf989c5ce092 (patch) | |
tree | 4c1053f2f20bb38a8fc9b203713d321c51f5f4ba /lib/sanitizer_common/sanitizer_libc.cc | |
parent | 5f2fe37bd979f18703a6b3b5bf71d18fca19b245 (diff) | |
download | compiler-rt-c0d78c1de1f2607c874020d27b72cf989c5ce092.tar.gz |
[Sanitizer]: move internal_strcmp to sanitizer_common
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@157926 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_libc.cc')
-rw-r--r-- | lib/sanitizer_common/sanitizer_libc.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/sanitizer_common/sanitizer_libc.cc b/lib/sanitizer_common/sanitizer_libc.cc index 6c07864fe..6e1c2818f 100644 --- a/lib/sanitizer_common/sanitizer_libc.cc +++ b/lib/sanitizer_common/sanitizer_libc.cc @@ -18,6 +18,18 @@ namespace __sanitizer { void MiniLibcStub() { } +int internal_strcmp(const char *s1, const char *s2) { + while (true) { + unsigned c1 = *s1; + unsigned c2 = *s2; + if (c1 != c2) return (c1 < c2) ? -1 : 1; + if (c1 == 0) break; + s1++; + s2++; + } + return 0; +} + char *internal_strncpy(char *dst, const char *src, uptr n) { uptr i; for (i = 0; i < n && src[i]; i++) |