Commit e4073ee868da50a7c5197d5f95e3cf64895b2b4d
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,12 +951,11 @@ QPDFTokenizer::getToken(Token& token, bool& unread_char, char& ch) | ||
| 951 | unread_char = !this->in_token && !this->before_token; | 951 | unread_char = !this->in_token && !this->before_token; |
| 952 | ch = this->char_to_unread; | 952 | ch = this->char_to_unread; |
| 953 | if (ready) { | 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 | this->reset(); | 959 | this->reset(); |
| 961 | } | 960 | } |
| 962 | return ready; | 961 | return ready; |