diff options
author | Jim Meyering <meyering@fb.com> | 2014-09-24 08:44:28 -0700 |
---|---|---|
committer | Jim Meyering <meyering@fb.com> | 2015-07-05 14:16:51 -0700 |
commit | 5dffb9cbf9223c5cd923f5c0da9583db95b9e8d0 (patch) | |
tree | b4a46105d3f7282a42589d33b05fb8edb7d2d414 | |
parent | ebd293f8a18a3ebbbbf108a04b58d417c6e34516 (diff) | |
download | grep-5dffb9cbf9223c5cd923f5c0da9583db95b9e8d0.tar.gz |
maint: dfa: used unsigned types where appropriate
* src/dfa.c (case_folded_counterparts): Return unsigned int, not int.
Change type of two locals to unsigned int, to reflect that their
values are never negative.
(parse_bracket_exp): Adjust type of result at each use, as well
as that of related index variables.
-rw-r--r-- | src/dfa.c | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -910,11 +910,11 @@ enum /* Find the characters equal to C after case-folding, other than C itself, and store them into FOLDED. Return the number of characters stored. */ -static int +static unsigned int case_folded_counterparts (wchar_t c, wchar_t folded[CASE_FOLDED_BUFSIZE]) { - int i; - int n = 0; + unsigned int i; + unsigned int n = 0; wint_t uc = towupper (c); wint_t lc = towlower (uc); if (uc != c) @@ -1201,9 +1201,10 @@ parse_bracket_exp (void) else { wchar_t folded[CASE_FOLDED_BUFSIZE + 1]; - int i; - int n = (case_fold ? case_folded_counterparts (wc, folded + 1) + 1 - : 1); + unsigned int i; + unsigned int n = (case_fold + ? case_folded_counterparts (wc, folded + 1) + 1 + : 1); folded[0] = wc; for (i = 0; i < n; i++) if (!setbit_wc (folded[i], ccl)) @@ -1829,7 +1830,7 @@ atom (void) if (case_fold) { wchar_t folded[CASE_FOLDED_BUFSIZE]; - int i, n = case_folded_counterparts (wctok, folded); + unsigned int i, n = case_folded_counterparts (wctok, folded); for (i = 0; i < n; i++) { addtok_wc (folded[i]); |