public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: agk@sourceware.org
To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org
Subject: LVM2 ./WHATS_NEW libdm/regex/parse_rx.c
Date: Tue, 02 Nov 2010 19:56:00 -0000	[thread overview]
Message-ID: <20101102195634.18032.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2010-11-02 19:56:33

Modified files:
	.              : WHATS_NEW 
	libdm/regex    : parse_rx.c 

Log message:
	Fix regex optimiser not to ignore RHS of OR nodes in _find_leftmost_common.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1786&r2=1.1787
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/regex/parse_rx.c.diff?cvsroot=lvm2&r1=1.13&r2=1.14

--- LVM2/WHATS_NEW	2010/11/01 14:17:35	1.1786
+++ LVM2/WHATS_NEW	2010/11/02 19:56:33	1.1787
@@ -1,5 +1,6 @@
 Version 2.02.76 - 
 ===================================
+  Fix regex optimiser not to ignore RHS of OR nodes in _find_leftmost_common.
   Fix handling of online filesystem resize (using new fsadm return code).
   Add DIAGNOSTICS section to fsadm man page.
   Modify fsadm to return different status code for check of mounted filesystem.
--- LVM2/libdm/regex/parse_rx.c	2010/08/09 10:29:42	1.13
+++ LVM2/libdm/regex/parse_rx.c	2010/11/02 19:56:33	1.14
@@ -473,16 +473,19 @@
 	unsigned left_depth = _depth(left, leftmost);
 	unsigned right_depth = _depth(right, leftmost);
 
-	while (left_depth > right_depth) {
+	while (left_depth > right_depth && left->type != OR) {
 		left = LEFT(left);
 		left_depth--;
 	}
 
-	while (right_depth > left_depth) {
+	while (right_depth > left_depth && right->type != OR) {
 		right = LEFT(right);
 		right_depth--;
 	}
 
+	if (left_depth != right_depth)
+		return 0;
+
 	while (left_depth) {
 		if (left->type == CAT && right->type == CAT) {
 			if (_nodes_equal(LEFT(left), LEFT(right))) {
@@ -491,6 +494,8 @@
 				return 1;
 			}
 		}
+		if (left->type == OR || right->type == OR)
+			break;
 		left = LEFT(left);
 		right = LEFT(right);
 		left_depth--;
@@ -568,7 +573,6 @@
 	case QUEST:
 		if (!(r->left = _pass(mem, r->left, changed)))
 			return_NULL;
-		break;
 
 	case OR:
 		/* It's important we optimise sub nodes first */
@@ -577,7 +581,6 @@
 
 		if (!(r->right = _pass(mem, r->right, changed)))
 			return_NULL;
-
 		/*
 		 * If rotate_ors changes the tree, left and right are stale,
 		 * so just set 'changed' to repeat the search.


                 reply	other threads:[~2010-11-02 19:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101102195634.18032.qmail@sourceware.org \
    --to=agk@sourceware.org \
    --cc=lvm-devel@redhat.com \
    --cc=lvm2-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).