Commit e1ea18bdb6e22d2521987708dca367eb5240ce8c
1 parent
0d48b0e6
Tune JSON::JSON_string
Remove member encoded and encode strings only when required. Encoded is only used when writing JSON. Since most JSON writing is now done on the fly without creating a JSON representation, creating and storing the encoded string in almost all cases no longer serves any purpose.
Showing
2 changed files
with
2 additions
and
4 deletions
include/qpdf/JSON.hh
libqpdf/JSON.cc
| ... | ... | @@ -120,15 +120,14 @@ JSON::JSON_array::write(Pipeline* p, size_t depth) const |
| 120 | 120 | |
| 121 | 121 | JSON::JSON_string::JSON_string(std::string const& utf8) : |
| 122 | 122 | JSON_value(vt_string), |
| 123 | - utf8(utf8), | |
| 124 | - encoded(Writer::encode_string(utf8)) | |
| 123 | + utf8(utf8) | |
| 125 | 124 | { |
| 126 | 125 | } |
| 127 | 126 | |
| 128 | 127 | void |
| 129 | 128 | JSON::JSON_string::write(Pipeline* p, size_t) const |
| 130 | 129 | { |
| 131 | - *p << std::string("\"") + encoded + "\""; | |
| 130 | + *p << std::string("\"") + Writer::encode_string(utf8) + "\""; | |
| 132 | 131 | } |
| 133 | 132 | |
| 134 | 133 | JSON::JSON_number::JSON_number(long long value) : | ... | ... |