avoid (even cheap) temporaries

This commit is contained in:
Aaron Seigo 2011-04-29 00:06:26 +02:00 committed by Marco Martin
parent 6d6826e603
commit a9814bd642

View File

@ -227,6 +227,7 @@ void DataContainerPrivate::retrieve()
if (de == NULL) { if (de == NULL) {
return; return;
} }
if (!storage) { if (!storage) {
storage = new Storage(q); storage = new Storage(q);
} }
@ -249,20 +250,18 @@ void DataContainerPrivate::populateFromStoredData(KJob *job)
return; return;
} }
DataEngine::Data dataToInsert = ret->data(); // Only fill the source with old stored
// data if it is not already populated with new data.
if (data.isEmpty()) {
data = ret->data();
dirty = true;
q->checkForUpdate();
}
KConfigGroup expireGroup = storage->operationDescription("expire"); KConfigGroup expireGroup = storage->operationDescription("expire");
//expire things older than 4 days //expire things older than 4 days
expireGroup.writeEntry("age", 345600); expireGroup.writeEntry("age", 345600);
storage->startOperationCall(expireGroup); storage->startOperationCall(expireGroup);
// Only fill the source with old stored
// data if it is already populated with new data.
if (data.isEmpty()) {
data = dataToInsert;
dirty = true;
q->checkForUpdate();
}
} }
void DataContainer::disconnectVisualization(QObject *visualization) void DataContainer::disconnectVisualization(QObject *visualization)