From: bert hubert Date: Fri, 29 Jan 2016 10:41:15 +0000 (+0100) Subject: more methods to get line number of an error from the zoneparser X-Git-Tag: dnsdist-1.0.0-alpha2~24^2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c91effc8686f2d76793374ed3e4ddf4abb5b1811;p=thirdparty%2Fpdns.git more methods to get line number of an error from the zoneparser --- diff --git a/pdns/zoneparser-tng.cc b/pdns/zoneparser-tng.cc index 569aef0db4..eedbc1c666 100644 --- a/pdns/zoneparser-tng.cc +++ b/pdns/zoneparser-tng.cc @@ -249,6 +249,11 @@ string ZoneParserTNG::getLineOfFile() return "on line "+std::to_string(d_filestates.top().d_lineno)+" of file '"+d_filestates.top().d_filename+"'"; } +pair ZoneParserTNG::getLineNumAndFile() +{ + return {d_filestates.top().d_filename, d_filestates.top().d_lineno}; +} + // ODD: this function never fills out the prio field! rest of pdns compensates though bool ZoneParserTNG::get(DNSResourceRecord& rr, std::string* comment) { diff --git a/pdns/zoneparser-tng.hh b/pdns/zoneparser-tng.hh index 94fea3b2e8..64d36c6d86 100644 --- a/pdns/zoneparser-tng.hh +++ b/pdns/zoneparser-tng.hh @@ -40,7 +40,8 @@ public: typedef runtime_error exception; typedef deque > parts_t; DNSName getZoneName(); - string getLineOfFile(); + string getLineOfFile(); // for error reporting purposes + pair getLineNumAndFile(); // idem private: bool getLine(); bool getTemplateLine();