[04/17] Regex: Fix use of or add RE_ENABLE_I18N.
Commit Message
This patch makes better use of RE_ENABLE_I18N so that variables needed
only in that case are not declared otherwise. This avoids "unused variable"
warnings from various compilers.
2017-11-27 Arnold D. Robbins <arnold@skeeve.com>
* posix/regex_internal.c (re_string_reconstruct): Fix use of and/or
add #ifdef RE_ENABLE_I18N.
* posix/regexec.c (check_arrival_add_next_nodes): Ditto.
Comments
This patch looks good. It is essentially the same as this Gnulib patch:
https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=d2822d2338678c7deaa404d848ddbcf52fa9de31
@@ -681,10 +681,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;
@@ -2990,7 +2990,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)