diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2016-05-04 20:56:04 +0200 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2016-05-05 00:28:25 +0200 |
commit | f6940dfa4627301bbd1a24530ac3f4fe3fe8494c (patch) | |
tree | e9f6400ff0e4757ab9a9a990c4b7b9c02c08b25b /src/util.h | |
parent | 6db772d648d2f2a79a4426e6b06fe1de298cd80c (diff) | |
download | android-node-v8-f6940dfa4627301bbd1a24530ac3f4fe3fe8494c.tar.gz android-node-v8-f6940dfa4627301bbd1a24530ac3f4fe3fe8494c.tar.bz2 android-node-v8-f6940dfa4627301bbd1a24530ac3f4fe3fe8494c.zip |
src: don't use locale-sensitive strcasecmp()
strcasecmp() is affected by the current locale as configured through
e.g. the LC_ALL environment variable and the setlocale() libc function.
It can result in unpredictable results across systems so replace it with
a function that isn't susceptible to that.
PR-URL: https://github.com/nodejs/node/pull/6582
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/util.h')
-rw-r--r-- | src/util.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/util.h b/src/util.h index 1f9f81cfd3..dce6c343b1 100644 --- a/src/util.h +++ b/src/util.h @@ -178,6 +178,12 @@ inline TypeName* Unwrap(v8::Local<v8::Object> object); inline void SwapBytes(uint16_t* dst, const uint16_t* src, size_t buflen); +// tolower() is locale-sensitive. Use ToLower() instead. +inline char ToLower(char c); + +// strcasecmp() is locale-sensitive. Use StringEqualNoCase() instead. +inline bool StringEqualNoCase(const char* a, const char* b); + // Allocates an array of member type T. For up to kStackStorageSize items, // the stack is used, otherwise malloc(). template <typename T, size_t kStackStorageSize = 1024> |