diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2011-10-09 17:43:26 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2011-10-09 17:43:26 +0200 |
commit | 2fe0064b083bcc394c3334a301af4cf92247416f (patch) | |
tree | 7409d73f66d01a9da1897b4e5f0078608043d1eb /dfa.c | |
parent | 6735db9861e32576ece279f7e9e0ecaa314786a2 (diff) | |
download | egawk-2fe0064b083bcc394c3334a301af4cf92247416f.tar.gz egawk-2fe0064b083bcc394c3334a301af4cf92247416f.tar.bz2 egawk-2fe0064b083bcc394c3334a301af4cf92247416f.zip |
Fix unsigned-ness issue in dfa.c.
Diffstat (limited to 'dfa.c')
-rw-r--r-- | dfa.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -117,6 +117,11 @@ is_blank (int c) /* Sets of unsigned characters are stored as bit vectors in arrays of ints. */ typedef int charclass[CHARCLASS_INTS]; +/* Convert a possibly-signed character to an unsigned character. This is + a bit safer than casting to unsigned char, since it catches some type + errors that the cast doesn't. */ +static inline unsigned char to_uchar (char ch) { return ch; } + /* Sometimes characters can only be matched depending on the surrounding context. Such context decisions depend on what the previous character was, and the value of the current (lookahead) character. Context @@ -716,7 +721,7 @@ static unsigned char const *buf_end; /* reference to end in dfaexec(). */ { \ cur_mb_len = 1; \ --lexleft; \ - (wc) = (c) = (unsigned char) *lexptr++; \ + (wc) = (c) = to_uchar (*lexptr++); \ } \ else \ { \ @@ -745,7 +750,7 @@ static unsigned char const *buf_end; /* reference to end in dfaexec(). */ else \ return lasttok = END; \ } \ - (c) = (unsigned char) *lexptr++; \ + (c) = to_uchar (*lexptr++); \ --lexleft; \ } while(0) |