diff options
author | Oliver Sander <oliver.sander@tu-dresden.de> | 2019-10-14 20:08:33 +0200 |
---|---|---|
committer | Oliver Sander <oliver.sander@tu-dresden.de> | 2019-10-23 08:51:46 +0000 |
commit | e076a478e4d2f7d6445215814c86e6ac4654f575 (patch) | |
tree | ea6c1545e0c8366877ef0f6bd7a924056e629c99 /qt5 | |
parent | 8911527dc38908ee56626fc55d09041475cc5145 (diff) |
Make FontInfo::scan return a std::vector object
... rather than a pointer to a std::vector. Given that a
std::vector is little more than a pointer and some size
information, there is no need to create std::vector objects
on the heap. Returning them by value is just as fast
(the vector content is not copied), and makes the code
more readable, too.
Diffstat (limited to 'qt5')
-rw-r--r-- | qt5/src/poppler-fontinfo.cc | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/qt5/src/poppler-fontinfo.cc b/qt5/src/poppler-fontinfo.cc index 3948a298..6b3ae7cb 100644 --- a/qt5/src/poppler-fontinfo.cc +++ b/qt5/src/poppler-fontinfo.cc @@ -134,17 +134,12 @@ QList<FontInfo> FontIterator::next() ++d->currentPage; QList<FontInfo> fonts; - std::vector<::FontInfo*> *items = d->fontInfoScanner.scan( 1 ); - if ( !items ) - return fonts; - fonts.reserve( items->size() ); - for ( std::size_t i = 0; i < items->size(); ++i ) { - fonts.append( FontInfo( FontInfoData( (*items)[ i ] ) ) ); - } - for ( auto entry : *items ) { + const std::vector<::FontInfo*> items = d->fontInfoScanner.scan( 1 ); + fonts.reserve( items.size() ); + for ( ::FontInfo* entry : items ) { + fonts.append( FontInfo( FontInfoData( entry ) ) ); delete entry; } - delete items; return fonts; } |