Index: compiled/filter/RegExpFilter.cpp |
=================================================================== |
--- a/compiled/filter/RegExpFilter.cpp |
+++ b/compiled/filter/RegExpFilter.cpp |
@@ -15,19 +15,18 @@ |
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
*/ |
#include <cctype> |
#include <climits> |
#include <cstdio> |
#include <string> |
-#include <emscripten.h> |
- |
#include "RegExpFilter.h" |
+#include "../library.h" |
#include "../StringScanner.h" |
#include "../StringMap.h" |
namespace |
{ |
enum |
{ |
TYPE_OTHER = 0x1, |
@@ -132,21 +131,16 @@ namespace |
} |
result.append(currChar); |
} |
prevChar = currChar; |
} |
return result; |
} |
- int GenerateRegExp(const String& regexp, bool matchCase) |
- { |
- return EM_ASM_INT(return regexps.create($0, $1), ®exp, matchCase); |
- } |
- |
void NormalizeWhitespace(DependentString& text) |
{ |
// We want to remove all spaces but bail out early in the common scenario |
// that the string contains no spaces. |
// Look for the first space |
String::size_type len = text.length(); |
String::size_type pos; |
@@ -286,17 +280,17 @@ namespace |
RegExpFilter::RegExpFilter(Type type, const String& text, const RegExpFilterData& data) |
: ActiveFilter(type, text, true), mData(data) |
{ |
} |
RegExpFilter::~RegExpFilter() |
{ |
if (mData.HasRegExp()) |
- EM_ASM_ARGS(regexps.delete($0), mData.mRegexpId); |
+ DeleteRegExp(mData.mRegexpId); |
} |
Filter::Type RegExpFilter::Parse(DependentString& text, DependentString& error, |
RegExpFilterData& data) |
{ |
NormalizeWhitespace(text); |
Filter::Type type = Type::BLOCKING; |
@@ -394,10 +388,10 @@ bool RegExpFilter::Matches(const String& |
return false; |
} |
if (!mData.RegExpParsingDone()) |
{ |
const OwnedString pattern(mData.GetRegExpSource(mText)); |
mData.SetRegExp(GenerateRegExp(RegExpFromSource(pattern), mData.mMatchCase)); |
} |
- return EM_ASM_INT(return regexps.test($0, $1), mData.mRegexpId, &location); |
+ return TestRegExp(mData.mRegexpId, location); |
} |