From: Alasdair Kergon Date: Thu, 22 Apr 2010 20:15:00 +0000 (+0000) Subject: avoid ORs rightmost X-Git-Tag: old-v2_02_64~28 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=792992997911171aa802896d5e91a837bb545308;p=lvm2.git avoid ORs rightmost --- diff --git a/libdm/regex/parse_rx.c b/libdm/regex/parse_rx.c index d0894fe52..fe38c7a81 100644 --- a/libdm/regex/parse_rx.c +++ b/libdm/regex/parse_rx.c @@ -421,16 +421,10 @@ static struct rx_node *_or_term(struct parse_sp *ps) static unsigned _depth(struct rx_node *r, unsigned leftmost) { int count = 1; - int or_count = 0; - while (r->type != CHARSET && LEFT(r)) { + while (r->type != CHARSET && LEFT(r) && (leftmost || r->type != OR)) { count++; r = LEFT(r); - /* Stop if we pass another OR */ - if (or_count) - break; - if (r->type == OR) - or_count++; } return count;