Performance: remove Members indirection for Pipeline

This commit is contained in:
Jay Berkenbilt 2020-04-03 11:59:29 -04:00
parent cc755e37f7
commit 97de12343b
2 changed files with 6 additions and 31 deletions

View File

@ -78,26 +78,10 @@ class QPDF_DLL_CLASS Pipeline
std::string identifier;
private:
// Do not implement copy or assign
Pipeline(Pipeline const&);
Pipeline& operator=(Pipeline const&);
Pipeline(Pipeline const&) = delete;
Pipeline& operator=(Pipeline const&) = delete;
class Members
{
friend class Pipeline;
public:
QPDF_DLL
~Members();
private:
Members(Pipeline* next);
Members(Members const&);
Pipeline* next;
};
PointerHolder<Members> m;
Pipeline* next;
};
#endif // PIPELINE_HH

View File

@ -1,18 +1,9 @@
#include <qpdf/Pipeline.hh>
#include <stdexcept>
Pipeline::Members::Members(Pipeline* next) :
next(next)
{
}
Pipeline::Members::~Members()
{
}
Pipeline::Pipeline(char const* identifier, Pipeline* next) :
identifier(identifier),
m(new Members(next))
next(next)
{
}
@ -23,13 +14,13 @@ Pipeline::~Pipeline()
Pipeline*
Pipeline::getNext(bool allow_null)
{
if ((this->m->next == 0) && (! allow_null))
if ((this->next == 0) && (! allow_null))
{
throw std::logic_error(
this->identifier +
": Pipeline::getNext() called on pipeline with no next");
}
return this->m->next;
return this->next;
}
std::string