git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/6] compat/regex/regex_internal.c: reduce scope of variables

From
Elia Pinto <gitter.spiros@gmail.com>
Date
Apr 16, 2014, 09:33 UTC
Message-ID
<1397640811-17719-2-git-send-email-gitter.spiros@gmail.com>
In-Reply-To
<1397640811-17719-1-git-send-email-gitter.spiros@gmail.com>
Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
---
 compat/regex/regex_internal.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/compat/regex/regex_internal.c b/compat/regex/regex_internal.c
index d4121f2..a7a71ec 100644
--- a/compat/regex/regex_internal.c
+++ b/compat/regex/regex_internal.c
@@ -707,7 +707,6 @@ re_string_reconstruct (re_string_t *pstr, int idx, int eflags)
 #ifdef RE_ENABLE_I18N
 	  if (pstr->mb_cur_max > 1)
 	    {
-	      int wcs_idx;
 	      wint_t wc = WEOF;
 
 	      if (pstr->is_utf8)
@@ -738,11 +737,11 @@ re_string_reconstruct (re_string_t *pstr, int idx, int eflags)
 			  mbstate_t cur_state;
 			  wchar_t wc2;
 			  int mlen = raw + pstr->len - p;
-			  unsigned char buf[6];
 			  size_t mbclen;
 
 			  if (BE (pstr->trans != NULL, 0))
 			    {
+                              unsigned char buf[6];
 			      int i = mlen < 6 ? mlen : 6;
 			      while (--i >= 0)
 				buf[i] = pstr->trans[p[i]];
@@ -778,6 +777,7 @@ re_string_reconstruct (re_string_t *pstr, int idx, int eflags)
 					? CONTEXT_NEWLINE : 0));
 	      if (BE (pstr->valid_len, 0))
 		{
+                  int wcs_idx;
 		  for (wcs_idx = 0; wcs_idx < pstr->valid_len; ++wcs_idx)
 		    pstr->wcs[wcs_idx] = WEOF;
 		  if (pstr->mbs_allocated)
@@ -925,7 +925,6 @@ static unsigned int
 internal_function
 re_string_context_at (const re_string_t *input, int idx, int eflags)
 {
-  int c;
   if (BE (idx < 0, 0))
     /* In this case, we use the value stored in input->tip_context,
        since we can't know the character in input->mbs[-1] here.  */
@@ -957,6 +956,7 @@ re_string_context_at (const re_string_t *input, int idx, int eflags)
   else
 #endif
     {
+      int c;
       c = re_string_byte_at (input, idx);
       if (bitset_contain (input->word_char, c))
 	return CONTEXT_WORD;
-- 
1.7.10.4
Previous: Elia PintoNext: Elia Pinto
Message 2 of 10 in “compat/regex/regcomp.c: reduce scope of variables”
  1. 1/6 compat/regex/regcomp.c: reduce scope of variablesElia Pinto, Apr 16, 2014
  2. 2/6 compat/regex/regex_internal.c: reduce scope of variablesElia Pinto, Apr 16, 2014
  3. 3/6 compat/regex/regexec.c: reduce scope of variablesElia Pinto, Apr 16, 2014
  4. 4/6 contrib/credential/osxkeychain/git-credential-osxkeychain.c: reduce scope of variablesElia Pinto, Apr 16, 2014
  5. Erik Faye-LundApr 16, 2014
  6. 5/6 contrib/credential/wincred/git-credential-wincred.c: reduce scope of variablesElia Pinto, Apr 16, 2014
  7. Erik Faye-LundApr 16, 2014
  8. 6/6 xdiff/xprepare.c: reduce scope of variablesElia Pinto, Apr 16, 2014
  9. Erik Faye-LundApr 16, 2014
  10. Jonathan NiederApr 16, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.