Commit b13dbb91eaac4d653df5fccd9c180cc8c80ff092

Carlos Martín Nieto 2012-02-18T01:32:13

regex: fix sign warnings

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)