summaryrefslogtreecommitdiffstats
path: root/libcxx/include/string
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2015-02-12 23:34:52 +0000
committerMarshall Clow <mclow.lists@gmail.com>2015-02-12 23:34:52 +0000
commitf3e0e3acdafb2b52eb197b4d8251aa2f91886d81 (patch)
tree3096e9ae50b921fdc723d0a68dc17fd839d454fc /libcxx/include/string
parentb6a812ebb10c074266d6e4f9d2e2405bf57e4788 (diff)
downloadbcm5719-llvm-f3e0e3acdafb2b52eb197b4d8251aa2f91886d81.tar.gz
bcm5719-llvm-f3e0e3acdafb2b52eb197b4d8251aa2f91886d81.zip
Move the test for zero-length into the char_traits (from string_view). Add tests to char_traits specializations
llvm-svn: 228981
Diffstat (limited to 'libcxx/include/string')
-rw-r--r--libcxx/include/string4
1 files changed, 2 insertions, 2 deletions
diff --git a/libcxx/include/string b/libcxx/include/string
index fe42bbf1d99..9f4007afc18 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -636,7 +636,7 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits<char>
{return (unsigned char)__c1 < (unsigned char)__c2;}
static inline int compare(const char_type* __s1, const char_type* __s2, size_t __n)
- {return memcmp(__s1, __s2, __n);}
+ {return __n == 0 ? 0 : memcmp(__s1, __s2, __n);}
static inline size_t length(const char_type* __s) {return strlen(__s);}
static inline const char_type* find(const char_type* __s, size_t __n, const char_type& __a)
{return (const char_type*)memchr(__s, to_int_type(__a), __n);}
@@ -681,7 +681,7 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits<wchar_t>
{return __c1 < __c2;}
static inline int compare(const char_type* __s1, const char_type* __s2, size_t __n)
- {return wmemcmp(__s1, __s2, __n);}
+ {return __n == 0 ? 0 : wmemcmp(__s1, __s2, __n);}
static inline size_t length(const char_type* __s)
{return wcslen(__s);}
static inline const char_type* find(const char_type* __s, size_t __n, const char_type& __a)
OpenPOWER on IntegriCloud