regex: fix sign warnings
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
diff --git a/deps/regex/regcomp.c b/deps/regex/regcomp.c
index 200415e..7373fbc 100644
--- a/deps/regex/regcomp.c
+++ b/deps/regex/regcomp.c
@@ -598,7 +598,8 @@ static bitset_t utf8_sb_map;
static void
free_dfa_content (re_dfa_t *dfa)
{
- int i, j;
+ unsigned int i;
+ int j;
if (dfa->nodes)
for (i = 0; i < dfa->nodes_len; ++i)
@@ -1134,7 +1135,7 @@ analyze (regex_t *preg)
dfa->subexp_map = re_malloc (int, preg->re_nsub);
if (dfa->subexp_map != NULL)
{
- int i;
+ unsigned int i;
for (i = 0; i < preg->re_nsub; i++)
dfa->subexp_map[i] = i;
preorder (dfa->str_tree, optimize_subexps, dfa);
@@ -1583,13 +1584,15 @@ duplicate_node (re_dfa_t *dfa, int org_idx, unsigned int constraint)
static reg_errcode_t
calc_inveclosure (re_dfa_t *dfa)
{
- int src, idx, ret;
+ int ret;
+ unsigned int src, idx;
for (idx = 0; idx < dfa->nodes_len; ++idx)
re_node_set_init_empty (dfa->inveclosures + idx);
for (src = 0; src < dfa->nodes_len; ++src)
{
int *elems = dfa->eclosures[src].elems;
+ int idx;
for (idx = 0; idx < dfa->eclosures[src].nelem; ++idx)
{
ret = re_node_set_insert_last (dfa->inveclosures + elems[idx], src);
diff --git a/deps/regex/regexec.c b/deps/regex/regexec.c
index 0194965..5eb6f1f 100644
--- a/deps/regex/regexec.c
+++ b/deps/regex/regexec.c
@@ -51,7 +51,7 @@ static int re_search_stub (struct re_pattern_buffer *bufp,
int range, int stop, struct re_registers *regs,
int ret_len);
static unsigned re_copy_regs (struct re_registers *regs, regmatch_t *pmatch,
- int nregs, int regs_allocated);
+ unsigned int nregs, int regs_allocated);
static reg_errcode_t prune_impossible_nodes (re_match_context_t *mctx);
static int check_matching (re_match_context_t *mctx, int fl_longest_match,
int *p_match_first) internal_function;
@@ -486,11 +486,11 @@ re_search_stub (struct re_pattern_buffer *bufp,
static unsigned
re_copy_regs (struct re_registers *regs,
regmatch_t *pmatch,
- int nregs, int regs_allocated)
+ unsigned int nregs, int regs_allocated)
{
int rval = REGS_REALLOCATE;
- int i;
- int need_regs = nregs + 1;
+ unsigned int i;
+ unsigned int need_regs = nregs + 1;
/* We need one extra element beyond `num_regs' for the `-1' marker GNU code
uses. */
@@ -624,7 +624,7 @@ re_search_internal (const regex_t *preg,
const re_dfa_t *dfa = (const re_dfa_t *) preg->buffer;
int left_lim, right_lim, incr;
int fl_longest_match, match_first, match_kind, match_last = -1;
- int extra_nmatch;
+ unsigned int extra_nmatch;
int sb, ch;
#if defined _LIBC || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)
re_match_context_t mctx = { .dfa = dfa };
@@ -870,7 +870,7 @@ re_search_internal (const regex_t *preg,
/* Set pmatch[] if we need. */
if (nmatch > 0)
{
- int reg_idx;
+ unsigned int reg_idx;
/* Initialize registers. */
for (reg_idx = 1; reg_idx < nmatch; ++reg_idx)
@@ -1446,7 +1446,7 @@ set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch,
if (idx == pmatch[0].rm_eo && cur_node == mctx->last_node)
{
- int reg_idx;
+ unsigned int reg_idx;
if (fs)
{
for (reg_idx = 0; reg_idx < nmatch; ++reg_idx)