summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/inspircd.cpp89
-rw-r--r--src/modules/m_antibottler.cpp2
2 files changed, 90 insertions, 1 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 858862e9d..3ccdfca54 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -40,6 +40,8 @@
#include "typedefs.h"
#include "command_parse.h"
#include "exitcodes.h"
+#include "wildcard.h"
+
#ifdef WIN32
@@ -1150,6 +1152,93 @@ int InspIRCd::Run()
int main(int argc, char** argv)
{
+ struct timeval start, stop;
+ std::string str;
+ std::string pattern;
+ char *strp, *patternp;
+
+ if (argc < 3)
+ {
+ printf("not enough args: pattern string\n");
+ exit(0);
+ }
+
+ pattern = argv[1];
+ str = argv[2];
+
+ patternp = argv[1];
+ strp = argv[2];
+
+ printf("result of std::string.find: ");
+
+ if (str.find(pattern) != string::npos)
+ {
+ printf("true\n");
+ }
+ else
+ {
+ printf("false\n");
+ }
+
+ printf("result of match(): ");
+
+ if (match(strp, patternp))
+ {
+ printf("true\n");
+ }
+ else
+ {
+ printf("false\n");
+ }
+
+
+ printf("result of strstr(): ");
+
+ if (strstr(strp, patternp))
+ {
+ printf("true\n");
+ }
+ else
+ {
+ printf("false\n");
+ }
+
+ gettimeofday(&start, NULL);
+ for (int i = 0; i < 30000; i++)
+ {
+ str.find(pattern);
+ }
+ gettimeofday(&stop, NULL);
+
+ printf("std::string.find: %lds and %ldus\n", stop.tv_sec - start.tv_sec, stop.tv_usec - start.tv_usec);
+
+
+ gettimeofday(&start, NULL);
+ for (int i = 0; i < 30000; i++)
+ {
+ match(strp, patternp);
+ }
+ gettimeofday(&stop, NULL);
+
+ printf("match(): %lds and %ldus\n", stop.tv_sec - start.tv_sec, stop.tv_usec - start.tv_usec);
+
+
+
+ gettimeofday(&start, NULL);
+ for (int i = 0; i < 30000; i++)
+ {
+ strstr(strp, patternp);
+ }
+ gettimeofday(&stop, NULL);
+
+ printf("strstr(): %lds and %ldus\n", stop.tv_sec - start.tv_sec, stop.tv_usec - start.tv_usec);
+
+ exit(0);
+
+
+
+
+
SI = new InspIRCd(argc, argv);
SI->Run();
delete SI;
diff --git a/src/modules/m_antibottler.cpp b/src/modules/m_antibottler.cpp
index 2c96495a4..e8dac81d0 100644
--- a/src/modules/m_antibottler.cpp
+++ b/src/modules/m_antibottler.cpp
@@ -83,7 +83,7 @@ class ModuleAntiBottler : public Module
if (!not_bottler)
{
std::string strgecos = std::string(gecos) + "[Possible bottler, ident: " + std::string(ident) + "]";
- const char* modified[3];
+ const char* modified[4];
modified[0] = "bottler";
modified[1] = local;
modified[2] = remote;