]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2373] refactoring: extend skipComment to include 'escaped' consideration.
authorJINMEI Tatuya <jinmei@isc.org>
Thu, 15 Nov 2012 03:04:02 +0000 (19:04 -0800)
committerJINMEI Tatuya <jinmei@isc.org>
Thu, 15 Nov 2012 03:04:02 +0000 (19:04 -0800)
this will help constify 'c' in String::handle.

src/lib/dns/master_lexer.cc

index 977459cdc9482fa8b9ccf09fc4f0b2857120e122..7d79e0d063652bb6623e08fcae10f25b1cca886c 100644 (file)
@@ -51,8 +51,8 @@ struct MasterLexer::MasterLexerImpl {
     // commonly used by state classes.  It returns the corresponding "end-of"
     // character in case it's a comment; otherwise it simply returns the
     // current character.
-    int skipComment(int c) {
-        if (c == ';') {
+    int skipComment(int c, bool escaped = false) {
+        if (c == ';' && !escaped) {
             while (true) {
                 c = source_->getChar();
                 if (c == '\n' || c == InputSource::END_OF_STREAM) {
@@ -325,10 +325,8 @@ String::handle(MasterLexer& lexer) const {
 
     bool escaped = false;
     while (true) {
-        int c = getLexerImpl(lexer)->source_->getChar();
-        if (!escaped) {
-            c = getLexerImpl(lexer)->skipComment(c);
-        }
+        const int c = getLexerImpl(lexer)->skipComment(
+            getLexerImpl(lexer)->source_->getChar(), escaped);
 
         if (getLexerImpl(lexer)->isTokenEnd(c, escaped)) {
             getLexerImpl(lexer)->source_->ungetChar();