summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-03-23 10:50:37 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-03-23 10:55:25 -0700
commit451fc9a8a4a6ad7e85e81e8186a0061da91b37c9 (patch)
tree8aa8c086f102ed718a07b700cc467b639e9d10cc
parent7aaa5c0d95c1bcef8a56463fda722bd1baa76fdc (diff)
downloadc-snippets-451fc9a8a4a6ad7e85e81e8186a0061da91b37c9.tar.gz
c-snippets-451fc9a8a4a6ad7e85e81e8186a0061da91b37c9.tar.bz2
c-snippets-451fc9a8a4a6ad7e85e81e8186a0061da91b37c9.zip
Don't pass negative value to <ctype.h> functions.
-rw-r--r--autotab.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/autotab.c b/autotab.c
index 278c568..93c3500 100644
--- a/autotab.c
+++ b/autotab.c
@@ -256,14 +256,14 @@ static int fgrep(line_t *list, const char *pattern)
int munge_char(int ch)
{
+ if (ch < 0 || isalnum(ch) || ch == '_')
+ return TOKEN[0];
if (isspace(ch) || iscntrl(ch))
return SPACE[0];
if (strchr("([{<", ch))
return OPGRP[0];
if (strchr(")]}>", ch))
return CLGRP[0];
- if (isalnum(ch) || ch == '_')
- return TOKEN[0];
return PUNCT[0];
}