diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-10-19 15:41:04 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-10-19 22:45:27 +0000 |
commit | 2b6c267a57fac77595b8e8b36490c12064d5649c (patch) | |
tree | 4c4d6cd650650d39695bb8b9a86301f98b2ea66e /epan/wmem | |
parent | ac55a6d2f5af1dc04b1e3a5c67eb03f8ac8aaa7a (diff) |
Eliminate use of ctype.h routines.
That way, we don't do locale-sensitive case-insensitivity (yes, the
locale can affect case-mapping - in a Turkish locale, "I" isn't the
upper-case version of "i", for example).
Change-Id: I5f7663e85160558ff3769617f924e45049c9c384
Reviewed-on: https://code.wireshark.org/review/4843
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/wmem')
-rw-r--r-- | epan/wmem/wmem_tree.c | 5 | ||||
-rw-r--r-- | epan/wmem/wmem_tree.h | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/epan/wmem/wmem_tree.c b/epan/wmem/wmem_tree.c index 9208cf9fef..4ad3df2913 100644 --- a/epan/wmem/wmem_tree.c +++ b/epan/wmem/wmem_tree.c @@ -24,7 +24,6 @@ #include "config.h" -#include <ctype.h> #include <string.h> #include <stdio.h> #include <glib.h> @@ -479,8 +478,8 @@ pack_string(const gchar *key, guint32 *divx, guint32 flags) ch = (unsigned char)key[i]; if (flags & WMEM_TREE_STRING_NOCASE) { - if (isupper(ch)) { - ch = tolower(ch); + if (g_ascii_isupper(ch)) { + ch = g_ascii_tolower(ch); } } tmp <<= 8; diff --git a/epan/wmem/wmem_tree.h b/epan/wmem/wmem_tree.h index e7e6b2dc34..4c22824e18 100644 --- a/epan/wmem/wmem_tree.h +++ b/epan/wmem/wmem_tree.h @@ -112,7 +112,10 @@ wmem_tree_lookup32_le(wmem_tree_t *tree, guint32 key); /** Insert a new value under a string key. Like wmem_tree_insert32 but where the * key is a null-terminated string instead of a guint32. You may pass * WMEM_TREE_STRING_NOCASE to the flags argument in order to make it store the - * key in a case-insensitive way. */ + * key in a case-insensitive way. (Note that "case-insensitive" refers + * only to the ASCII letters A-Z and a-z; it is locale-independent. + * Do not expect it to honor the rules of your language; for example, "I" + * will always be mapped to "i". */ WS_DLL_PUBLIC void wmem_tree_insert_string(wmem_tree_t *tree, const gchar* key, void *data, |