diff options
author | Jay Berkenbilt <ejb@ql.org> | 2020-04-09 02:14:04 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2020-04-09 02:45:26 +0200 |
commit | 1a7d3700a665a5ae29c8bab67ddc7fee7040b731 (patch) | |
tree | 625e79f255f5c57ea438816cb7714628ca0c66a2 /qpdf/fix-qdf.cc | |
parent | b89b1d772db935ed36b8abe8a21ee6468ada3d23 (diff) | |
download | qpdf-1a7d3700a665a5ae29c8bab67ddc7fee7040b731.tar.zst |
Fix unnecessary copies in auto iter (fixes #426)
Also switch to colon-style iteration in some cases. Thanks to Dean
Scarff for drawing this to my attention after detecting some
unnecessary copies with
https://clang.llvm.org/extra/clang-tidy/checks/performance-for-range-copy.html
Diffstat (limited to 'qpdf/fix-qdf.cc')
-rw-r--r-- | qpdf/fix-qdf.cc | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/qpdf/fix-qdf.cc b/qpdf/fix-qdf.cc index 2516a0bd..c50f7b5a 100644 --- a/qpdf/fix-qdf.cc +++ b/qpdf/fix-qdf.cc @@ -387,13 +387,12 @@ QdfFixer::writeOstream() auto onum = ostream_id; std::string offsets; auto n = ostream_offsets.size(); - for (auto iter = ostream_offsets.begin(); - iter != ostream_offsets.end(); ++iter) + for (auto iter: ostream_offsets) { - (*iter) -= QIntC::to_offset(first); + iter -= QIntC::to_offset(first); ++onum; offsets += QUtil::int_to_string(onum) + " " + - QUtil::int_to_string(*iter) + "\n"; + QUtil::int_to_string(iter) + "\n"; } auto offset_adjust = QIntC::to_offset(offsets.size()); first += offset_adjust; |