diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-11-19 19:15:40 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-11-20 09:41:30 -0500 |
commit | 1283dcb0e20a7f7d81c19818083d813c378c1b4a (patch) | |
tree | 7f9a98f0e102f956ca2cff30f4b5b2575c597e09 /sc | |
parent | a190ccb39ada9c639ae32529bb1b2ba4b9d8cf9d (diff) |
Use scoped_ptr here for exception safety.
Normally scoped_ptr is preferred for local heap objects, than direct
new and delete pair.
Change-Id: Ia8783bfe5f9b37a9bd58f08cce89bf85d88199d1
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/opencl/opencl_device.cxx | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sc/source/core/opencl/opencl_device.cxx b/sc/source/core/opencl/opencl_device.cxx index 45a28bf2b26f..ba0214de69a7 100644 --- a/sc/source/core/opencl/opencl_device.cxx +++ b/sc/source/core/opencl/opencl_device.cxx @@ -18,6 +18,8 @@ #include <iostream> #include <sstream> #include <vector> +#include <boost/scoped_ptr.hpp> + #include "opencl_device.hxx" @@ -446,7 +448,7 @@ ds_device getDeviceSelection(const char* sProfilePath, bool bForceSelection) if (!bForceSelection) LOG_PRINTF("[DS] Profile file not available (" << fileName << "); performing profiling."); /* Populate input data for micro-benchmark */ - LibreOfficeDeviceEvaluationIO* testData = new LibreOfficeDeviceEvaluationIO; + boost::scoped_ptr<LibreOfficeDeviceEvaluationIO> testData(new LibreOfficeDeviceEvaluationIO); testData->inputSize = INPUTSIZE; testData->outputSize = OUTPUTSIZE; testData->input0.resize(testData->inputSize); @@ -454,12 +456,12 @@ ds_device getDeviceSelection(const char* sProfilePath, bool bForceSelection) testData->input2.resize(testData->inputSize); testData->input3.resize(testData->inputSize); testData->output.resize(testData->outputSize); - populateInput(testData); + populateInput(testData.get()); /* Perform evaluations */ unsigned int numUpdates; - status = profileDevices(profile, DS_EVALUATE_ALL, evaluateScoreForDevice, (void*)testData, &numUpdates); - delete testData; + status = profileDevices(profile, DS_EVALUATE_ALL, evaluateScoreForDevice, (void*)testData.get(), &numUpdates); + if (DS_SUCCESS == status) { /* Write scores to file */ |