git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6] compat/regex/regcomp.c: reduce scope of variables
@ 2014-04-16  9:33 Elia Pinto
  2014-04-16  9:33 ` [PATCH 2/6] compat/regex/regex_internal.c: " Elia Pinto
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Elia Pinto @ 2014-04-16  9:33 UTC (permalink / raw)
  To: git; +Cc: Elia Pinto

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
---
 compat/regex/regcomp.c |   17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/compat/regex/regcomp.c b/compat/regex/regcomp.c
index 06f3088..c7da378 100644
--- a/compat/regex/regcomp.c
+++ b/compat/regex/regcomp.c
@@ -368,7 +368,6 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
       else if (type == COMPLEX_BRACKET)
 	{
 	  re_charset_t *cset = dfa->nodes[node].opr.mbcset;
-	  int i;
 
 # ifdef _LIBC
 	  /* See if we have to try all bytes which start multiple collation
@@ -380,6 +379,7 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
 	      if (_NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES) != 0
 		  && (cset->ncoll_syms || cset->nranges))
 		{
+		  int i;
 		  const int32_t *table = (const int32_t *)
 		    _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEMB);
 		  for (i = 0; i < SBC_MAX; ++i)
@@ -598,7 +598,7 @@ static bitset_t utf8_sb_map;
 static void
 free_dfa_content (re_dfa_t *dfa)
 {
-  int i, j;
+  int i;
 
   if (dfa->nodes)
     for (i = 0; i < dfa->nodes_len; ++i)
@@ -621,6 +621,7 @@ free_dfa_content (re_dfa_t *dfa)
   if (dfa->state_table)
     for (i = 0; i <= dfa->state_hash_mask; ++i)
       {
+	int j;
 	struct re_state_table_entry *entry = dfa->state_table + i;
 	for (j = 0; j < entry->num; ++j)
 	  {
@@ -994,7 +995,7 @@ free_workarea_compile (regex_t *preg)
 static reg_errcode_t
 create_initial_state (re_dfa_t *dfa)
 {
-  int first, i;
+  int first;
   reg_errcode_t err;
   re_node_set init_nodes;
 
@@ -1011,6 +1012,8 @@ create_initial_state (re_dfa_t *dfa)
      Then we add epsilon closures of the nodes which are the next nodes of
      the back-references.  */
   if (dfa->nbackref > 0)
+    {
+    int i;
     for (i = 0; i < init_nodes.nelem; ++i)
       {
 	int node_idx = init_nodes.elems[i];
@@ -1044,6 +1047,7 @@ create_initial_state (re_dfa_t *dfa)
 	      }
 	  }
       }
+    }
 
   /* It must be the first time to invoke acquire_state.  */
   dfa->init_state = re_acquire_state_context (&err, dfa, &init_nodes, 0);
@@ -1682,7 +1686,6 @@ static reg_errcode_t
 calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, int node, int root)
 {
   reg_errcode_t err;
-  int i;
   re_node_set eclosure;
   int ret;
   int incomplete = 0;
@@ -1708,6 +1711,8 @@ calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, int node, int root)
 
   /* Expand each epsilon destination nodes.  */
   if (IS_EPSILON_NODE(dfa->nodes[node].type))
+    {
+    int i;
     for (i = 0; i < dfa->edests[node].nelem; ++i)
       {
 	re_node_set eclosure_elem;
@@ -1741,6 +1746,7 @@ calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, int node, int root)
 	    re_node_set_free (&eclosure_elem);
 	  }
       }
+    }
 
   /* An epsilon closure includes itself.  */
   ret = re_node_set_insert (&eclosure, node);
@@ -2630,7 +2636,6 @@ build_range_exp (bitset_t sbcset, bracket_elem_t *start_elem,
 		 bracket_elem_t *end_elem)
 # endif /* not RE_ENABLE_I18N */
 {
-  unsigned int start_ch, end_ch;
   /* Equivalence Classes and Character Classes can't be a range start/end.  */
   if (BE (start_elem->type == EQUIV_CLASS || start_elem->type == CHAR_CLASS
 	  || end_elem->type == EQUIV_CLASS || end_elem->type == CHAR_CLASS,
@@ -2647,6 +2652,7 @@ build_range_exp (bitset_t sbcset, bracket_elem_t *start_elem,
 
 # ifdef RE_ENABLE_I18N
   {
+    unsigned int start_ch, end_ch;
     wchar_t wc;
     wint_t start_wc;
     wint_t end_wc;
@@ -2728,6 +2734,7 @@ build_range_exp (bitset_t sbcset, bracket_elem_t *start_elem,
 # else /* not RE_ENABLE_I18N */
   {
     unsigned int ch;
+    unsigned int start_ch, end_ch;
     start_ch = ((start_elem->type == SB_CHAR ) ? start_elem->opr.ch
 		: ((start_elem->type == COLL_SYM) ? start_elem->opr.name[0]
 		   : 0));
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-04-16 16:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-16  9:33 [PATCH 1/6] compat/regex/regcomp.c: reduce scope of variables Elia Pinto
2014-04-16  9:33 ` [PATCH 2/6] compat/regex/regex_internal.c: " Elia Pinto
2014-04-16  9:33 ` [PATCH 3/6] compat/regex/regexec.c: " Elia Pinto
2014-04-16  9:33 ` [PATCH 4/6] contrib/credential/osxkeychain/git-credential-osxkeychain.c: " Elia Pinto
2014-04-16  9:55   ` Erik Faye-Lund
2014-04-16  9:33 ` [PATCH 5/6] contrib/credential/wincred/git-credential-wincred.c: " Elia Pinto
2014-04-16  9:54   ` Erik Faye-Lund
2014-04-16  9:33 ` [PATCH 6/6] xdiff/xprepare.c: " Elia Pinto
2014-04-16  9:55   ` Erik Faye-Lund
2014-04-16 16:49 ` [PATCH 1/6] compat/regex/regcomp.c: " Jonathan Nieder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).