From a9814bd642945e699485adb5eed64ab7adf1a3b1 Mon Sep 17 00:00:00 2001 From: Aaron Seigo Date: Fri, 29 Apr 2011 00:06:26 +0200 Subject: [PATCH] avoid (even cheap) temporaries --- datacontainer.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/datacontainer.cpp b/datacontainer.cpp index 236dfb7db..de4228cec 100644 --- a/datacontainer.cpp +++ b/datacontainer.cpp @@ -227,6 +227,7 @@ void DataContainerPrivate::retrieve() if (de == NULL) { return; } + if (!storage) { storage = new Storage(q); } @@ -249,20 +250,18 @@ void DataContainerPrivate::populateFromStoredData(KJob *job) 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"); //expire things older than 4 days expireGroup.writeEntry("age", 345600); 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)