Parcourir la source

[2375] Return a reference to the token

The copy is shallow anyway, so it wouldn't survive for long.
Michal 'vorner' Vaner il y a 12 ans
Parent
commit
e27a2922bc
2 fichiers modifiés avec 2 ajouts et 2 suppressions
  1. 1 1
      src/lib/dns/master_lexer.cc
  2. 1 1
      src/lib/dns/master_lexer.h

+ 1 - 1
src/lib/dns/master_lexer.cc

@@ -164,7 +164,7 @@ MasterLexer::getSourceLine() const {
     return (impl_->sources_.back()->getCurrentLine());
     return (impl_->sources_.back()->getCurrentLine());
 }
 }
 
 
-MasterLexer::Token
+const MasterLexer::Token&
 MasterLexer::getNextToken(Options options) {
 MasterLexer::getNextToken(Options options) {
     // If the source is not available
     // If the source is not available
     if (impl_->source_ == NULL) {
     if (impl_->source_ == NULL) {

+ 1 - 1
src/lib/dns/master_lexer.h

@@ -213,7 +213,7 @@ public:
     ///     source (eg. I/O error in the file on the disk).
     ///     source (eg. I/O error in the file on the disk).
     /// \throw std::bad_alloc in case allocation of some internal resources
     /// \throw std::bad_alloc in case allocation of some internal resources
     ///     or the token fail.
     ///     or the token fail.
-    Token getNextToken(Options options = NONE);
+    const Token& getNextToken(Options options = NONE);
 
 
     /// \brief Return the last token back to the lexer.
     /// \brief Return the last token back to the lexer.
     ///
     ///