Commit 97de12343b908d937f4bb0562cd739896ce66d34
1 parent
cc755e37
Performance: remove Members indirection for Pipeline
Showing
2 changed files
with
6 additions
and
31 deletions
include/qpdf/Pipeline.hh
| @@ -78,26 +78,10 @@ class QPDF_DLL_CLASS Pipeline | @@ -78,26 +78,10 @@ class QPDF_DLL_CLASS Pipeline | ||
| 78 | std::string identifier; | 78 | std::string identifier; |
| 79 | 79 | ||
| 80 | private: | 80 | private: |
| 81 | - // Do not implement copy or assign | ||
| 82 | - Pipeline(Pipeline const&); | ||
| 83 | - Pipeline& operator=(Pipeline const&); | 81 | + Pipeline(Pipeline const&) = delete; |
| 82 | + Pipeline& operator=(Pipeline const&) = delete; | ||
| 84 | 83 | ||
| 85 | - class Members | ||
| 86 | - { | ||
| 87 | - friend class Pipeline; | ||
| 88 | - | ||
| 89 | - public: | ||
| 90 | - QPDF_DLL | ||
| 91 | - ~Members(); | ||
| 92 | - | ||
| 93 | - private: | ||
| 94 | - Members(Pipeline* next); | ||
| 95 | - Members(Members const&); | ||
| 96 | - | ||
| 97 | - Pipeline* next; | ||
| 98 | - }; | ||
| 99 | - | ||
| 100 | - PointerHolder<Members> m; | 84 | + Pipeline* next; |
| 101 | }; | 85 | }; |
| 102 | 86 | ||
| 103 | #endif // PIPELINE_HH | 87 | #endif // PIPELINE_HH |
libqpdf/Pipeline.cc
| 1 | #include <qpdf/Pipeline.hh> | 1 | #include <qpdf/Pipeline.hh> |
| 2 | #include <stdexcept> | 2 | #include <stdexcept> |
| 3 | 3 | ||
| 4 | -Pipeline::Members::Members(Pipeline* next) : | ||
| 5 | - next(next) | ||
| 6 | -{ | ||
| 7 | -} | ||
| 8 | - | ||
| 9 | -Pipeline::Members::~Members() | ||
| 10 | -{ | ||
| 11 | -} | ||
| 12 | - | ||
| 13 | Pipeline::Pipeline(char const* identifier, Pipeline* next) : | 4 | Pipeline::Pipeline(char const* identifier, Pipeline* next) : |
| 14 | identifier(identifier), | 5 | identifier(identifier), |
| 15 | - m(new Members(next)) | 6 | + next(next) |
| 16 | { | 7 | { |
| 17 | } | 8 | } |
| 18 | 9 | ||
| @@ -23,13 +14,13 @@ Pipeline::~Pipeline() | @@ -23,13 +14,13 @@ Pipeline::~Pipeline() | ||
| 23 | Pipeline* | 14 | Pipeline* |
| 24 | Pipeline::getNext(bool allow_null) | 15 | Pipeline::getNext(bool allow_null) |
| 25 | { | 16 | { |
| 26 | - if ((this->m->next == 0) && (! allow_null)) | 17 | + if ((this->next == 0) && (! allow_null)) |
| 27 | { | 18 | { |
| 28 | throw std::logic_error( | 19 | throw std::logic_error( |
| 29 | this->identifier + | 20 | this->identifier + |
| 30 | ": Pipeline::getNext() called on pipeline with no next"); | 21 | ": Pipeline::getNext() called on pipeline with no next"); |
| 31 | } | 22 | } |
| 32 | - return this->m->next; | 23 | + return this->next; |
| 33 | } | 24 | } |
| 34 | 25 | ||
| 35 | std::string | 26 | std::string |