From 63ab36be9266f79d92ac37e632299c8f0e2244f1 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Thu, 16 Oct 2014 23:41:29 -0700 Subject: [PATCH] Don't use macros, and eliminate an include of . This avoids locale-dependent tests, and fixes cases where we passed signed char values to those macros (which is not safe with char being signed, as it is on most, but not all, platforms). Change-Id: Iea962cd7e4dfaf33c3c873ba43814cc6ed298d94 Reviewed-on: https://code.wireshark.org/review/4764 Reviewed-by: Guy Harris --- ui/gtk/dfilter_expr_dlg.c | 5 ++--- ui/persfilepath_opt.c | 3 +-- ui/recent.c | 3 +-- ui/time_shift.c | 3 +-- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/ui/gtk/dfilter_expr_dlg.c b/ui/gtk/dfilter_expr_dlg.c index 1e7ae8a7fd..381d13bbdc 100644 --- a/ui/gtk/dfilter_expr_dlg.c +++ b/ui/gtk/dfilter_expr_dlg.c @@ -38,7 +38,6 @@ */ #include "config.h" -#include #include #include @@ -781,7 +780,7 @@ dfilter_expr_dlg_accept_cb(GtkWidget *w, gpointer filter_te_arg) */ pos = gtk_editable_get_position(GTK_EDITABLE(filter_te)); chars = gtk_editable_get_chars(GTK_EDITABLE(filter_te), pos, pos + 1); - if (strcmp(chars, "") != 0 && !isspace((unsigned char)chars[0])) + if (strcmp(chars, "") != 0 && !g_ascii_isspace(chars[0])) gtk_editable_insert_text(GTK_EDITABLE(filter_te), " ", 1, &pos); g_free(chars); @@ -844,7 +843,7 @@ dfilter_expr_dlg_accept_cb(GtkWidget *w, gpointer filter_te_arg) g_free(value_str); } chars = gtk_editable_get_chars(GTK_EDITABLE(filter_te), pos + 1, pos + 2); - if (strcmp(chars, "") != 0 && !isspace((unsigned char)chars[0])) + if (strcmp(chars, "") != 0 && !g_ascii_isspace(chars[0])) gtk_editable_insert_text(GTK_EDITABLE(filter_te), " ", 1, &pos); g_free(chars); diff --git a/ui/persfilepath_opt.c b/ui/persfilepath_opt.c index cbd894e58f..d1569605a7 100644 --- a/ui/persfilepath_opt.c +++ b/ui/persfilepath_opt.c @@ -24,7 +24,6 @@ #include "config.h" #include -#include #include #include @@ -55,7 +54,7 @@ persfilepath_opt(int opt _U_, const char *optstr) * 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') { /* diff --git a/ui/recent.c b/ui/recent.c index 45193bf95c..b8eeda637f 100644 --- a/ui/recent.c +++ b/ui/recent.c @@ -26,7 +26,6 @@ #include #include #include -#include #include #include "capture_opts.h" @@ -1183,7 +1182,7 @@ recent_set_arg(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') { /* diff --git a/ui/time_shift.c b/ui/time_shift.c index 177a11b935..3363c50f40 100644 --- a/ui/time_shift.c +++ b/ui/time_shift.c @@ -25,7 +25,6 @@ #include #include -#include #include #include @@ -138,7 +137,7 @@ time_string_parse(const gchar *time_text, int *year, int *month, int *day, gbool return "Unable to convert time."; /* strip whitespace */ - while (isspace(pts[0])) + while (g_ascii_isspace(pts[0])) ++pts; if (year && month && day) {