[PATCH] compat/regex: define out variables only used under RE_ENABLE_I18N

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?=
Date: Thursday, August 19, 2010 - 11:30 am

Wrap variables that were only used RE_ENABLE_I18N in `#ifdef
RE_ENABLE_I18N`. This eliminates compiler warnings when compiling with
NO_REGEX=YesPlease.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---

On Thu, Aug 19, 2010 at 18:05, Aharon Robbins <arnold@skeeve.com> wrote:

Cool that someone else is teasing useful code out of glibc so I don't
have to :)


Junio, here's a version of this patch for our tree.


That's good to know. B.t.w. we have to compile with -DNO_MBSUPPORT
because regex_internal.h will pull in mbsupport.h if it's defined,
which is a GPLv3 header, the rest being LGPL 2.1.

I don't even know if we want mbsupport.h, but if it's possible to
relicense mbsupport.h to LGPL 2.1 it'd be easier for projects like Git
to pull in the gawk regex engine.

 compat/regex/regex_internal.c |    2 +-
 compat/regex/regexec.c        |    2 ++
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/compat/regex/regex_internal.c b/compat/regex/regex_internal.c
index dad17a8..193854c 100644
--- a/compat/regex/regex_internal.c
+++ b/compat/regex/regex_internal.c
@@ -692,10 +692,10 @@ re_string_reconstruct (re_string_t *pstr, int idx, int eflags)
 	}
       else
 	{
+#ifdef RE_ENABLE_I18N
 	  /* No, skip all characters until IDX.  */
 	  int prev_valid_len = pstr->valid_len;
 
-#ifdef RE_ENABLE_I18N
 	  if (BE (pstr->offsets_needed, 0))
 	    {
 	      pstr->len = pstr->raw_len - idx + offset;
diff --git a/compat/regex/regexec.c b/compat/regex/regexec.c
index aee502d..0c2b054 100644
--- a/compat/regex/regexec.c
+++ b/compat/regex/regexec.c
@@ -3059,7 +3059,9 @@ check_arrival_add_next_nodes (re_match_context_t *mctx, int str_idx,
   const re_dfa_t *const dfa = mctx->dfa;
   int result;
   int cur_idx;
+#ifdef RE_ENABLE_I18N
   reg_errcode_t err = REG_NOERROR;
+#endif
   re_node_set union_set;
   re_node_set_init_empty (&union_set);
   for (cur_idx = 0; cur_idx < cur_nodes->nelem; ++cur_idx)
-- 
1.7.2.1.446.g168052

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
What's cooking in git.git (Aug 2010, #04; Wed, 18), Junio C Hamano, (Wed Aug 18, 3:27 pm)
Re: What's cooking in git.git (Aug 2010, #04; Wed, 18), Jonathan Nieder, (Wed Aug 18, 8:02 pm)
jn/update-contrib-example-merge in pu, Jonathan Nieder, (Wed Aug 18, 8:22 pm)
Re: What's cooking in git.git (Aug 2010, #04; Wed, 18), Johannes Sixt, (Thu Aug 19, 1:06 am)
Re: What's cooking in git.git (Aug 2010, #04; Wed, 18), Ævar Arnfjörð Bjarmason, (Thu Aug 19, 5:48 am)
Re: What's cooking in git.git (Aug 2010, #04; Wed, 18), Ævar Arnfjörð Bjarmason, (Thu Aug 19, 5:53 am)
Re: What's cooking in git.git (Aug 2010, #04; Wed, 18), Ævar Arnfjörð Bjarmason, (Thu Aug 19, 8:04 am)
Re: What's cooking in git.git (Aug 2010, #04; Wed, 18), Ævar Arnfjörð Bjarmason, (Thu Aug 19, 8:27 am)
Re: Fwd: What's cooking in git.git (Aug 2010, #04; Wed, 18), Aharon Robbins, (Thu Aug 19, 11:05 am)
[PATCH] compat/regex: define out variables only used under ..., =?UTF-8?q?=C3=86var= ..., (Thu Aug 19, 11:30 am)
Re: [PATCH] compat/regex: define out variables only used u ..., Ævar Arnfjörð Bjarmason, (Thu Aug 19, 1:31 pm)
Re: [PATCH] compat/regex: define out variables only used u ..., Ævar Arnfjörð Bjarmason, (Thu Aug 19, 2:30 pm)
[PATCH] compat/regex: get rid of old-style definition, Junio C Hamano, (Thu Aug 19, 3:45 pm)
Re: [PATCH] compat/regex: get rid of old-style definition, Ævar Arnfjörð Bjarmason, (Fri Aug 20, 12:47 am)
Re: [PATCH] compat/regex: get rid of old-style definition, Karsten Blees, (Wed Aug 25, 11:24 am)
[PATCH] Fix compat/regex ANSIfication on MinGW, Johannes Sixt, (Thu Aug 26, 12:58 am)
Re: [PATCH] Fix compat/regex ANSIfication on MinGW, Ævar Arnfjörð Bjarmason, (Thu Aug 26, 1:34 pm)
Re: [PATCH] Fix compat/regex ANSIfication on MinGW, Ævar Arnfjörð Bjarmason, (Fri Sep 3, 3:21 pm)
Re: [PATCH] Fix compat/regex ANSIfication on MinGW, Junio C Hamano, (Fri Sep 3, 10:22 pm)