From: Alasdair Kergon Date: Thu, 22 Apr 2010 23:09:18 +0000 (+0000) Subject: don't optimise anything with TARGET_TRANS to avoid intefering with the matcher's... X-Git-Tag: old-v2_02_64~26 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=a32e8441d028899d083b3c6885dc4198ab66d25f;p=lvm2.git don't optimise anything with TARGET_TRANS to avoid intefering with the matcher's counting --- diff --git a/libdm/regex/matcher.c b/libdm/regex/matcher.c index fe3979d41..350a35303 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 fe38c7a81..20f8c30e2 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 1c2393fc1..4a5d8b94d 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;