2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-05-29 00:10:54 +00:00

eliminate extraneous allocations by not calling makeDirect when we

know an object is already direct


git-svn-id: svn+q:///qpdf/trunk@972 71b93d88-0707-0410-a8cf-f5a4172ac649
This commit is contained in:
Jay Berkenbilt 2010-06-05 21:00:05 +00:00
parent eef7154412
commit bf75e208e9

View File

@ -104,9 +104,12 @@ QPDF::flattenScalarReferences()
QPDFObjectHandle oh = node.getArrayItem(i);
if (oh.isScalar())
{
QTC::TC("qpdf", "QPDF opt flatten array scalar");
oh.makeDirect();
node.setArrayItem(i, oh);
if (oh.isIndirect())
{
QTC::TC("qpdf", "QPDF opt flatten array scalar");
oh.makeDirect();
node.setArrayItem(i, oh);
}
}
else
{
@ -136,9 +139,12 @@ QPDF::flattenScalarReferences()
}
else if (oh.isScalar())
{
QTC::TC("qpdf", "QPDF opt flatten dict scalar");
oh.makeDirect();
dict.replaceKey(key, oh);
if (oh.isIndirect())
{
QTC::TC("qpdf", "QPDF opt flatten dict scalar");
oh.makeDirect();
dict.replaceKey(key, oh);
}
}
else
{