aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--regcomp.c13
-rw-r--r--regex_internal.c9
3 files changed, 19 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index bc02ffaf..d5336ea9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-08-26 Arnold D. Robbins <arnold@skeeve.com>
+
+ * regcomp.c, regex_internal.c: Sync with GBLIC. Why not.
+
2014-08-18 Arnold D. Robbins <arnold@skeeve.com>
* symbol.c: General formatting cleanup.
diff --git a/regcomp.c b/regcomp.c
index a62364c9..9774ae50 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -2215,7 +2215,11 @@ parse_reg_exp (re_string_t *regexp, regex_t *preg, re_token_t *token,
{
branch = parse_branch (regexp, preg, token, syntax, nest, err);
if (BE (*err != REG_NOERROR && branch == NULL, 0))
- return NULL;
+ {
+ if (tree != NULL)
+ postorder (tree, free_tree, NULL);
+ return NULL;
+ }
}
else
branch = NULL;
@@ -2476,8 +2480,7 @@ parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token,
while (token->type == OP_DUP_ASTERISK || token->type == OP_DUP_PLUS
|| token->type == OP_DUP_QUESTION || token->type == OP_OPEN_DUP_NUM)
{
- bin_tree_t *dup_tree = parse_dup_op (tree, regexp, dfa, token,
- syntax, err);
+ bin_tree_t *dup_tree = parse_dup_op (tree, regexp, dfa, token, syntax, err);
if (BE (*err != REG_NOERROR && dup_tree == NULL, 0))
{
if (tree != NULL)
@@ -2640,6 +2643,8 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa,
/* Duplicate ELEM before it is marked optional. */
elem = duplicate_tree (elem, dfa);
+ if (BE (elem == NULL, 0))
+ goto parse_dup_op_espace;
old_tree = tree;
}
else
@@ -3136,8 +3141,8 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
if (BE (sbcset == NULL, 0))
#endif /* RE_ENABLE_I18N */
{
-#ifdef RE_ENABLE_I18N
re_free (sbcset);
+#ifdef RE_ENABLE_I18N
re_free (mbcset);
#endif
*err = REG_ESPACE;
diff --git a/regex_internal.c b/regex_internal.c
index 056cff3d..9e427081 100644
--- a/regex_internal.c
+++ b/regex_internal.c
@@ -545,7 +545,10 @@ build_upper_buffer (re_string_t *pstr)
int ch = pstr->raw_mbs[pstr->raw_mbs_idx + char_idx];
if (BE (pstr->trans != NULL, 0))
ch = pstr->trans[ch];
- pstr->mbs[char_idx] = toupper (ch);
+ if (islower (ch))
+ pstr->mbs[char_idx] = toupper (ch);
+ else
+ pstr->mbs[char_idx] = ch;
}
pstr->valid_len = char_idx;
pstr->valid_raw_len = char_idx;
@@ -683,7 +686,7 @@ re_string_reconstruct (re_string_t *pstr, int idx, int eflags)
pstr->valid_len - offset);
pstr->valid_len -= offset;
pstr->valid_raw_len -= offset;
-#if DEBUG
+#if defined DEBUG && DEBUG
assert (pstr->valid_len > 0);
#endif
}
@@ -940,7 +943,7 @@ re_string_context_at (const re_string_t *input, int idx, int eflags)
int wc_idx = idx;
while(input->wcs[wc_idx] == WEOF)
{
-#ifdef DEBUG
+#if defined DEBUG && DEBUG
/* It must not happen. */
assert (wc_idx >= 0);
#endif