diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-04-14 12:05:27 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-04-14 12:05:27 +0000 |
commit | 8ffcf6fc3d039d29294506dfe8309107e8b5f459 (patch) | |
tree | f754be2e94f2b9387754077da84473167e72dfae /src/modules/extra | |
parent | 5289be42682b6d80bc54b3667e3e4d8530119f16 (diff) |
Working in m_filter_pcre.
Thanks DarkPrince (PingBad) for the idea we messed with - when a match is successful move that match to the head of the list (O(1) operation)
The original suggestion was to sort, this would be far too expensive
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6794 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/extra')
-rw-r--r-- | src/modules/extra/m_filter_pcre.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/modules/extra/m_filter_pcre.cpp b/src/modules/extra/m_filter_pcre.cpp index e35094ac0..8a3119f20 100644 --- a/src/modules/extra/m_filter_pcre.cpp +++ b/src/modules/extra/m_filter_pcre.cpp @@ -34,6 +34,10 @@ class PCREFilter : public FilterResult : FilterResult::FilterResult(pat, rea, act, gline_time), regexp(r) { } + + PCREFilter() + { + } }; class ModuleFilterPCRE : public FilterBase @@ -42,6 +46,7 @@ class ModuleFilterPCRE : public FilterBase pcre *re; const char *error; int erroffset; + PCREFilter fr; public: ModuleFilterPCRE(InspIRCd* Me) @@ -60,14 +65,13 @@ class ModuleFilterPCRE : public FilterBase { if (pcre_exec(index->regexp, NULL, text.c_str(), text.length(), 0, 0, NULL, 0) > -1) { - PCREFilter* fr = &(*index); + fr = *index; if (index != filters.begin()) { filters.erase(index); - filters.insert(filters.begin(), *fr); - index = filters.begin(); + filters.insert(filters.begin(), fr); } - return &(*index); + return &fr; } } return NULL; |