From 5bc22db14b6ffd4cb39722a415d4cd176bb7fc0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Courr=C3=A8ges-Anglas?= Date: Fri, 22 Nov 2013 00:10:46 +0100 Subject: Cast char arguments to to*/is* ctype calls to unsigned char * those functions expect an int whose value is between -1 and 255. Cast to unsigned char so that sign extension when promoting to int doesn't bite us. --- src/history.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/history.c') diff --git a/src/history.c b/src/history.c index b48feb9..7a6cf15 100644 --- a/src/history.c +++ b/src/history.c @@ -54,9 +54,9 @@ extract_shell_part (const char *p) if (strncmp(p, "exec", 4) && strncmp(p, "verbexec", 8)) return NULL; - while( *p && !isspace(*p) ) + while (*p && !isspace ((unsigned char)*p)) p++; - while( *p && isspace(*p) ) + while (*p && isspace ((unsigned char)*p)) p++; if (*p) return p; @@ -114,7 +114,7 @@ history_add_upto (int history_id, const char *item, size_t max) struct history *h = histories + history_id; struct history_item *i; - if (item == NULL || *item == '\0' || isspace(*item)) + if (item == NULL || *item == '\0' || isspace((unsigned char)*item)) return; list_last (i, &histories[history_id].head, node); -- cgit v1.2.3