summaryrefslogtreecommitdiffstats
path: root/libdm/regex
diff options
context:
space:
mode:
authorAlasdair Kergon <agk@redhat.com>2010-04-22 23:09:18 +0000
committerAlasdair Kergon <agk@redhat.com>2010-04-22 23:09:18 +0000
commit616eda51e35e99e4997df00e0d21754d3b3f950b (patch)
tree0e3c73d5d882a258a2db01ae278188d2d6af5b2a /libdm/regex
parente07803f976e06c37eb978242e47b3ce6b57df891 (diff)
downloadlvm2-616eda51e35e99e4997df00e0d21754d3b3f950b.tar.gz
lvm2-616eda51e35e99e4997df00e0d21754d3b3f950b.tar.xz
lvm2-616eda51e35e99e4997df00e0d21754d3b3f950b.zip
don't optimise anything with TARGET_TRANS to avoid intefering with the matcher's counting
Diffstat (limited to 'libdm/regex')
-rw-r--r--libdm/regex/matcher.c2
-rw-r--r--libdm/regex/parse_rx.c7
-rw-r--r--libdm/regex/parse_rx.h2
3 files changed, 8 insertions, 3 deletions
diff --git a/libdm/regex/matcher.c b/libdm/regex/matcher.c
index fe3979d4..350a3530 100644
--- a/libdm/regex/matcher.c
+++ b/libdm/regex/matcher.c
@@ -37,8 +37,6 @@ struct dm_regex { /* Instance variables for the lexer */
struct dm_pool *scratch, *mem;
};
-#define TARGET_TRANS '\0'
-
static int _count_nodes(struct rx_node *rx)
{
int r = 1;
diff --git a/libdm/regex/parse_rx.c b/libdm/regex/parse_rx.c
index fe38c7a8..20f8c30e 100644
--- a/libdm/regex/parse_rx.c
+++ b/libdm/regex/parse_rx.c
@@ -452,7 +452,12 @@ static int _nodes_equal(struct rx_node *l, struct rx_node *r)
return _nodes_equal(l->left, r->left);
case CHARSET:
- return dm_bitset_equal(l->charset, r->charset);
+ /*
+ * Never change anything containing TARGET_TRANS
+ * used by matcher as boundary marker between concatenated
+ * expressions.
+ */
+ return (!dm_bit(l->charset, TARGET_TRANS) && dm_bitset_equal(l->charset, r->charset));
}
/* NOTREACHED */
diff --git a/libdm/regex/parse_rx.h b/libdm/regex/parse_rx.h
index 1c2393fc..4a5d8b94 100644
--- a/libdm/regex/parse_rx.h
+++ b/libdm/regex/parse_rx.h
@@ -33,6 +33,8 @@ enum {
#define HAT_CHAR 0x2
#define DOLLAR_CHAR 0x3
+#define TARGET_TRANS '\0'
+
struct rx_node {
int type;
dm_bitset_t charset;