]> granicus.if.org Git - pdns/commitdiff
move away from chomp in geobackend
authorBert Hubert <bert.hubert@netherlabs.nl>
Sun, 3 Aug 2008 20:16:59 +0000 (20:16 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Sun, 3 Aug 2008 20:16:59 +0000 (20:16 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1247 d19b8d6e-7fed-0310-83ef-9ca221ded41b

modules/geobackend/geobackend.cc

index b21d008a603a26f48e8f27e579667d7d87d4a061..44b5ad18205067825e778636e12bef4d21e6503e 100644 (file)
 #include <pdns/misc.hh>
 #include <pdns/lock.hh>
 #include <pdns/dnspacket.hh>
-
+#include <boost/algorithm/string.hpp>
 #include "geobackend.hh"
 
+using boost::trim_right;
+
 // Static members
 
 IPPrefTree * GeoBackend::ipt;
@@ -344,7 +346,7 @@ void GeoBackend::loadIPLocationMap() {
        
        while (getline(ifs, line)) {
                linenr++;               
-               chomp(line, " \t");     // Erase whitespace
+               trim_right(line);       // Erase whitespace
                
                if (line[0] == '#')
                        continue;       // Skip comments
@@ -489,7 +491,7 @@ void GeoBackend::loadDirectorMap(GeoRecord &gr) {
        
        string line;
        while(getline(ifs, line)) {
-               chomp(line, " \t");     // Erase whitespace
+               trim_right(line);       // Erase whitespace
 
                if (line.empty() || line[0] == '#')
                        continue;       // Skip empty lines and comments
@@ -497,7 +499,7 @@ void GeoBackend::loadDirectorMap(GeoRecord &gr) {
                // Parse $RECORD
                if (line.substr(0, 7) == "$RECORD") {
                        gr.qname = line.substr(8);
-                       chomp(gr.qname, " \t");
+                       trim_right(gr.qname);
                        if (gr.qname[gr.qname.size()-1] != '.')
                                gr.qname += '.' + zoneName;
                        else {
@@ -512,7 +514,7 @@ void GeoBackend::loadDirectorMap(GeoRecord &gr) {
                // Parse $ORIGIN
                if (line.substr(0, 7) == "$ORIGIN") {
                        gr.origin = line.substr(8);
-                       chomp(gr.origin, " \t.");
+                       trim_right(gr.origin);
                        gr.origin.insert(0, ".");
                        continue;
                }