From 85a992176475155e72b369ef312220caf2880e69 Mon Sep 17 00:00:00 2001 From: rurban Date: Wed, 12 May 2004 19:27:48 +0000 Subject: [PATCH] revert wrong inline optimization. git-svn-id: svn://svn.code.sf.net/p/phpwiki/code/trunk@3477 96ab9672-09ca-45d6-a79d-3d69d39ca109 --- lib/InlineParser.php | 8 +++++--- lib/WikiDB.php | 11 +++++++++-- lib/prepend.php | 4 ++-- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/lib/InlineParser.php b/lib/InlineParser.php index 7b31e28a2..f6cba72ba 100644 --- a/lib/InlineParser.php +++ b/lib/InlineParser.php @@ -1,5 +1,5 @@ * Copyright (C) 2004 Reini Urban * @@ -89,6 +89,7 @@ class RegexpSet function RegexpSet ($regexps) { assert($regexps); $this->_regexps = array_unique($regexps); + if (!defined('_INLINE_OPTIMIZATION')) define('_INLINE_OPTIMIZATION',0); } /** @@ -143,7 +144,7 @@ class RegexpSet // If one of the regexps is an empty string, php will crash here: // sf.net: Fatal error: Allowed memory size of 8388608 bytes exhausted // (tried to allocate 634 bytes) - + if (_INLINE_OPTIMIZATION) { // So we try to minize memory usage, by looping explicitly, // and storing only those regexp which actually match. // There may be more than one, so we have to find the longest, @@ -165,6 +166,7 @@ class RegexpSet // To overcome ANCHORED: // We could sort by longest match and iterate over these. if (empty($matched)) return false; + } $match = new RegexpSet_match; // Optimization: if the matches are only "$" and another, then omit "$" @@ -173,7 +175,7 @@ class RegexpSet // s - DOTALL // A - ANCHORED // S - STUDY - if (count($matched) > 2) { + if (! _INLINE_OPTIMIZATION or count($matched) > 2) { // We could do much better, if we would know the matching markup for the // longest regexp match: $hugepat= "/ ( . $repeat ) ( (" . join(')|(', $regexps) . ") ) /Asx"; diff --git a/lib/WikiDB.php b/lib/WikiDB.php index bb788ca94..5b09d2b4e 100644 --- a/lib/WikiDB.php +++ b/lib/WikiDB.php @@ -1,5 +1,5 @@