]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
move our small regex helper out of the pipe backend, we'll need it for the selective...
authorBert Hubert <bert.hubert@netherlabs.nl>
Fri, 11 Jan 2013 09:23:54 +0000 (09:23 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Fri, 11 Jan 2013 09:23:54 +0000 (09:23 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@3040 d19b8d6e-7fed-0310-83ef-9ca221ded41b

modules/pipebackend/pipebackend.hh
pdns/misc.cc
pdns/misc.hh

index c93c0b8774fbd8267fabbd86e8680ad405237a7c..94712c870b8901c522d3e9030f219cf3cafc3077 100644 (file)
@@ -9,34 +9,10 @@
 #include <string>
 #include <map>
 #include <sys/types.h>
-#include <regex.h>
 #include <boost/shared_ptr.hpp>
 
 #include "pdns/namespaces.hh"
-
-/** very small regex wrapper */
-class Regex
-{
-public:
-  /** constructor that accepts the expression to regex */
-  Regex(const string &expr)
-  {
-    if(regcomp(&d_preg, expr.c_str(), REG_ICASE|REG_NOSUB|REG_EXTENDED))
-      throw AhuException("Regular expression did not compile");
-  }
-  ~Regex()
-  {
-    regfree(&d_preg);
-  }
-  /** call this to find out if 'line' matches your expression */
-  bool match(const string &line)
-  {
-    return regexec(&d_preg,line.c_str(),0,0,0)==0;
-  }
-  
-private:
-  regex_t d_preg;
-};
+#include "pdns/misc.hh"
 
 
 /** The CoWrapper class wraps around a coprocess and restarts it if needed.
index 4739b6d969e7bb6e2b95385eb2fef228bfcabfba..1032adaca91a6cb98593717c3082d447318201d7 100644 (file)
@@ -778,3 +778,8 @@ bool stringfgets(FILE* fp, std::string& line)
   return true;
 }
 
+Regex::Regex(const string &expr)
+{
+  if(regcomp(&d_preg, expr.c_str(), REG_ICASE|REG_NOSUB|REG_EXTENDED))
+    throw AhuException("Regular expression did not compile");
+}
index 01993779b08079f0c2540084a5b30b4c3233d29a..b5cf0a978d8bf2fe21a5f9e6e2dc16ac276528f5 100644 (file)
@@ -20,6 +20,7 @@
 #include <inttypes.h>
 #include <cstring>
 #include <cstdio>
+#include <regex.h>
 #include <boost/algorithm/string.hpp>
 #include <boost/multi_index_container.hpp>
 #include <boost/multi_index/ordered_index.hpp>
@@ -449,4 +450,25 @@ replacing_insert(Index& i,const typename Index::value_type& x)
   return res;
 }
 
+/** very small regex wrapper */
+class Regex
+{
+public:
+  /** constructor that accepts the expression to regex */
+  Regex(const string &expr);
+  
+  ~Regex()
+  {
+    regfree(&d_preg);
+  }
+  /** call this to find out if 'line' matches your expression */
+  bool match(const string &line)
+  {
+    return regexec(&d_preg,line.c_str(),0,0,0)==0;
+  }
+  
+private:
+  regex_t d_preg;
+};
+
 #endif