diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-10-17 16:10:53 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-10-17 23:11:18 +0000 |
commit | 033f096ee909b63c0692b80416797f743940d054 (patch) | |
tree | 0ec827ec1bfa5a7893c19e81f27d782797a66644 /epan/prefs.c | |
parent | 344c2bbb5e2a23764fe21adeaf2439d267960a96 (diff) |
Don't use ctype.h routines.
That avoids locale dependency and handles possibly-signed chars (which
we weren't always doing before).
Change-Id: Ieceb93029252f646397b6488f2df8a57c6d2a23d
Reviewed-on: https://code.wireshark.org/review/4794
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/prefs.c')
-rw-r--r-- | epan/prefs.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/epan/prefs.c b/epan/prefs.c index 4e1bd18b1d..00fa01ebd9 100644 --- a/epan/prefs.c +++ b/epan/prefs.c @@ -24,7 +24,6 @@ #include <stdlib.h> #include <string.h> -#include <ctype.h> #include <errno.h> #ifdef HAVE_UNISTD_H @@ -367,9 +366,8 @@ prefs_register_module_or_subtree(module_t *parent, const char *name, * shifting, etc. */ for (p = name; (c = *p) != '\0'; p++) - g_assert(isascii(c) && - (islower(c) || isdigit(c) || c == '_' || - c == '-' || c == '.')); + g_assert(g_ascii_islower(c) || g_ascii_isdigit(c) || c == '_' || + c == '-' || c == '.'); /* * Make sure there's not already a module with that @@ -749,8 +747,7 @@ register_preference(module_t *module, const char *name, const char *title, * and shouldn't require quoting, shifting, etc. */ for (p = name; *p != '\0'; p++) - if (!(isascii((guchar)*p) && - (islower((guchar)*p) || isdigit((guchar)*p) || *p == '_' || *p == '.'))) + if (!(g_ascii_islower(*p) || g_ascii_isdigit(*p) || *p == '_' || *p == '.')) g_error("Preference %s.%s contains invalid characters", module->name, name); /* @@ -2668,7 +2665,7 @@ prefs_get_string_list(const gchar *str) state = PRE_STRING; slstr = (gchar *) g_malloc(sizeof(gchar) * COL_MAX_LEN); j = 0; - } else if (!isspace(cur_c) || state != PRE_STRING) { + } else if (!g_ascii_isspace(cur_c) || state != PRE_STRING) { /* Either this isn't a white-space character, or we've started a string (i.e., already seen a non-white-space character for that string and put it into the string). @@ -3324,7 +3321,7 @@ read_prefs_file(const char *pf_path, FILE *pf, switch (state) { case START: - if (isalnum(got_c)) { + if (g_ascii_isalnum(got_c)) { if (cur_var->len > 0) { if (got_val) { if (cur_val->len > 0) { @@ -3386,7 +3383,7 @@ read_prefs_file(const char *pf_path, FILE *pf, g_string_truncate(cur_var, 0); g_string_append_c(cur_var, (gchar) got_c); pline = fline; - } else if (isspace(got_c) && cur_var->len > 0 && got_val) { + } else if (g_ascii_isspace(got_c) && cur_var->len > 0 && got_val) { state = PRE_VAL; } else if (got_c == '#') { state = IN_SKIP; @@ -3409,7 +3406,7 @@ read_prefs_file(const char *pf_path, FILE *pf, } break; case PRE_VAL: - if (!isspace(got_c)) { + if (!g_ascii_isspace(got_c)) { state = IN_VAL; g_string_append_c(cur_val, (gchar) got_c); } @@ -3487,7 +3484,7 @@ prefs_set_uat_pref(char *uat_entry) { * as we allow it in the preferences file, we might as well * allow it here). */ - while (isspace((guchar)*p)) + while (g_ascii_isspace(*p)) p++; if (*p == '\0') { /* @@ -3545,7 +3542,7 @@ prefs_set_pref(char *prefarg) * as we allow it in the preferences file, we might as well * allow it here). */ - while (isspace((guchar)*p)) + while (g_ascii_isspace(*p)) p++; if (*p == '\0') { /* |