summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@fb.com>2014-09-24 08:44:28 -0700
committerJim Meyering <meyering@fb.com>2015-07-05 14:16:51 -0700
commit5dffb9cbf9223c5cd923f5c0da9583db95b9e8d0 (patch)
treeb4a46105d3f7282a42589d33b05fb8edb7d2d414
parentebd293f8a18a3ebbbbf108a04b58d417c6e34516 (diff)
downloadgrep-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.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/dfa.c b/src/dfa.c
index 2f822824..565446d1 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -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]);