Commit e4073ee868da50a7c5197d5f95e3cf64895b2b4d

Authored by m-holger
1 parent b45420a9

Remove unnecessary string copy in QPDFTokenizer::getToken

Showing 1 changed file with 5 additions and 6 deletions
libqpdf/QPDFTokenizer.cc
... ... @@ -951,12 +951,11 @@ QPDFTokenizer::getToken(Token& token, bool& unread_char, char& ch)
951 951 unread_char = !this->in_token && !this->before_token;
952 952 ch = this->char_to_unread;
953 953 if (ready) {
954   - if (this->type == tt_bad) {
955   - this->val.clear();
956   - this->val += this->raw_val;
957   - }
958   - token =
959   - Token(this->type, this->val, this->raw_val, this->error_message);
  954 + token = (this->type == tt_bad)
  955 + ? Token(
  956 + this->type, this->raw_val, this->raw_val, this->error_message)
  957 + : Token(this->type, this->val, this->raw_val, this->error_message);
  958 +
960 959 this->reset();
961 960 }
962 961 return ready;
... ...