summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-09-26 12:49:48 (GMT)
committerKevin Smith <kevin.smith@isode.com>2016-09-26 22:04:37 (GMT)
commit65596031acaf7d4f277bd75758bb1c551501ce86 (patch)
treeaac3a8bf6dbdccc1d476225b50ba25decf1a46cc /SwifTools/AutoUpdater
parent05fbe78f5c3b30517f7152b37c157a99120682dc (diff)
downloadswift-65596031acaf7d4f277bd75758bb1c551501ce86.zip
swift-65596031acaf7d4f277bd75758bb1c551501ce86.tar.bz2
Use const std::unique_ptr for pimpl idiom usage
All our pimpl idiom usage used std::shared_ptr due to being written in C++03. Now we use C++11 and const std::unique_ptr is more sensible. Test-Information: Builds on macOS 10.12 and unit tests pass. Change-Id: I1b9b3fbb22e337d53ae71e5a5e03118998cc3376
Diffstat (limited to 'SwifTools/AutoUpdater')
-rw-r--r--SwifTools/AutoUpdater/SparkleAutoUpdater.h3
-rw-r--r--SwifTools/AutoUpdater/SparkleAutoUpdater.mm5
2 files changed, 3 insertions, 5 deletions
diff --git a/SwifTools/AutoUpdater/SparkleAutoUpdater.h b/SwifTools/AutoUpdater/SparkleAutoUpdater.h
index c3394f7..1242128 100644
--- a/SwifTools/AutoUpdater/SparkleAutoUpdater.h
+++ b/SwifTools/AutoUpdater/SparkleAutoUpdater.h
@@ -6,6 +6,7 @@
#pragma once
+#include <memory>
#include <string>
#include <SwifTools/AutoUpdater/AutoUpdater.h>
@@ -27,6 +28,6 @@ namespace Swift {
private:
class Private;
- Private* d;
+ const unique_ptr<Private> d;
};
}
diff --git a/SwifTools/AutoUpdater/SparkleAutoUpdater.mm b/SwifTools/AutoUpdater/SparkleAutoUpdater.mm
index 7e06b2f..76de34b 100644
--- a/SwifTools/AutoUpdater/SparkleAutoUpdater.mm
+++ b/SwifTools/AutoUpdater/SparkleAutoUpdater.mm
@@ -21,9 +21,7 @@ class SparkleAutoUpdater::Private {
bool restartToUpdate = false;
};
-SparkleAutoUpdater::SparkleAutoUpdater(const std::string& url) {
- d = new Private;
-
+SparkleAutoUpdater::SparkleAutoUpdater(const std::string& url) : d(new Private()) {
d->updater = [SUUpdater sharedUpdater];
[d->updater retain];
@@ -45,7 +43,6 @@ SparkleAutoUpdater::SparkleAutoUpdater(const std::string& url) {
SparkleAutoUpdater::~SparkleAutoUpdater() {
[d->updater release];
- delete d;
SWIFT_LOG(warning) << std::endl;
}