summaryrefslogtreecommitdiff
path: root/mask.cc
diff options
context:
space:
mode:
Diffstat (limited to 'mask.cc')
-rw-r--r--mask.cc39
1 files changed, 2 insertions, 37 deletions
diff --git a/mask.cc b/mask.cc
index ea621206..11700a51 100644
--- a/mask.cc
+++ b/mask.cc
@@ -4,13 +4,10 @@
#include <cstdlib>
-#include <pcre.h>
-
mask_t::mask_t(const std::string& pat) : exclude(false)
{
- TRACE_CTOR("mask_t(const std::string&)");
-
const char * p = pat.c_str();
+
if (*p == '-') {
exclude = true;
p++;
@@ -22,38 +19,6 @@ mask_t::mask_t(const std::string& pat) : exclude(false)
while (std::isspace(*p))
p++;
}
- pattern = p;
-
- const char *error;
- int erroffset;
- regexp = pcre_compile(pattern.c_str(), PCRE_CASELESS,
- &error, &erroffset, NULL);
- if (! regexp)
- throw new mask_error(std::string("Failed to compile regexp '") +
- pattern + "'");
-}
-
-mask_t::mask_t(const mask_t& m) : exclude(m.exclude), pattern(m.pattern)
-{
- TRACE_CTOR("mask_t(copy)");
-
- const char *error;
- int erroffset;
- regexp = pcre_compile(pattern.c_str(), PCRE_CASELESS,
- &error, &erroffset, NULL);
- assert(regexp);
-}
-mask_t::~mask_t() {
- TRACE_DTOR("mask_t");
- if (regexp)
- pcre_free((pcre *)regexp);
-}
-
-bool mask_t::match(const std::string& str) const
-{
- static int ovec[30];
- int result = pcre_exec((pcre *)regexp, NULL,
- str.c_str(), str.length(), 0, 0, ovec, 30);
- return result >= 0 && ! exclude;
+ expr.assign(p);
}