summaryrefslogtreecommitdiff
path: root/gnulib/lib/regexec.c
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2018-08-06 19:53:28 +0200
committerGuido Günther <agx@sigxcpu.org>2018-08-06 19:53:28 +0200
commitf2f787149e8079f6ecbb05067e38809c0f1e1934 (patch)
treee13176a7c23392a90b50de8da127b5053a8aaf19 /gnulib/lib/regexec.c
parentc2b3afcb78fa88936a69019203929c5e97aa457d (diff)
New upstream version 4.6.0
Diffstat (limited to 'gnulib/lib/regexec.c')
-rw-r--r--gnulib/lib/regexec.c43
1 files changed, 20 insertions, 23 deletions
diff --git a/gnulib/lib/regexec.c b/gnulib/lib/regexec.c
index 63aef9753..73644c234 100644
--- a/gnulib/lib/regexec.c
+++ b/gnulib/lib/regexec.c
@@ -3878,30 +3878,27 @@ check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx,
indirect = (const int32_t *)
_NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTMB);
int32_t idx = findidx (table, indirect, extra, &cp, elem_len);
+ int32_t rule = idx >> 24;
+ idx &= 0xffffff;
if (idx > 0)
- for (i = 0; i < cset->nequiv_classes; ++i)
- {
- int32_t equiv_class_idx = cset->equiv_classes[i];
- size_t weight_len = weights[idx & 0xffffff];
- if (weight_len == weights[equiv_class_idx & 0xffffff]
- && (idx >> 24) == (equiv_class_idx >> 24))
- {
- Idx cnt = 0;
-
- idx &= 0xffffff;
- equiv_class_idx &= 0xffffff;
-
- while (cnt <= weight_len
- && (weights[equiv_class_idx + 1 + cnt]
- == weights[idx + 1 + cnt]))
- ++cnt;
- if (cnt > weight_len)
- {
- match_len = elem_len;
- goto check_node_accept_bytes_match;
- }
- }
- }
+ {
+ size_t weight_len = weights[idx];
+ for (i = 0; i < cset->nequiv_classes; ++i)
+ {
+ int32_t equiv_class_idx = cset->equiv_classes[i];
+ int32_t equiv_class_rule = equiv_class_idx >> 24;
+ equiv_class_idx &= 0xffffff;
+ if (weights[equiv_class_idx] == weight_len
+ && equiv_class_rule == rule
+ && memcmp (weights + idx + 1,
+ weights + equiv_class_idx + 1,
+ weight_len) == 0)
+ {
+ match_len = elem_len;
+ goto check_node_accept_bytes_match;
+ }
+ }
+ }
}
}
else