aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDFTokenizer.cc
diff options
context:
space:
mode:
authorm-holger <m-holger@kubitscheck.org>2022-08-23 20:37:31 +0200
committerm-holger <m-holger@kubitscheck.org>2022-08-25 12:31:09 +0200
commite4073ee868da50a7c5197d5f95e3cf64895b2b4d (patch)
treeb50a671143d70f3a536c8a0eb97a680420c56f96 /libqpdf/QPDFTokenizer.cc
parentb45420a98038829e4d8d505d4332edc14caa340f (diff)
downloadqpdf-e4073ee868da50a7c5197d5f95e3cf64895b2b4d.tar.zst
Remove unnecessary string copy in QPDFTokenizer::getToken
Diffstat (limited to 'libqpdf/QPDFTokenizer.cc')
-rw-r--r--libqpdf/QPDFTokenizer.cc11
1 files changed, 5 insertions, 6 deletions
diff --git a/libqpdf/QPDFTokenizer.cc b/libqpdf/QPDFTokenizer.cc
index 07f6bfb7..6e492f2b 100644
--- a/libqpdf/QPDFTokenizer.cc
+++ b/libqpdf/QPDFTokenizer.cc
@@ -951,12 +951,11 @@ QPDFTokenizer::getToken(Token& token, bool& unread_char, char& ch)
unread_char = !this->in_token && !this->before_token;
ch = this->char_to_unread;
if (ready) {
- if (this->type == tt_bad) {
- this->val.clear();
- this->val += this->raw_val;
- }
- token =
- Token(this->type, this->val, this->raw_val, this->error_message);
+ token = (this->type == tt_bad)
+ ? Token(
+ this->type, this->raw_val, this->raw_val, this->error_message)
+ : Token(this->type, this->val, this->raw_val, this->error_message);
+
this->reset();
}
return ready;