Use make_unique to initialize unique_ptr
authorSangyoon Jang <jeremy.jang@samsung.com>
Wed, 20 May 2020 07:29:06 +0000 (16:29 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Mon, 25 May 2020 04:28:15 +0000 (13:28 +0900)
Change-Id: I78a398b30b4d683935c8701f70004f57a0907052
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
src/theme_provider/sqlite_connection.cc
src/theme_provider/theme_info_proxy.cc
src/unit_tests/test_theme_info_proxy.cc

index 62259c6..9ff3d90 100644 (file)
@@ -113,8 +113,7 @@ std::unique_ptr<SQLiteStatement> SQLiteConnection::PrepareStatement(
     LOG(ERROR) << "sqlite3_prepare_v2() failed: " << GetErrorMessage();
     return {};
   }
-  return std::unique_ptr<SQLiteStatement>(
-      new SQLiteStatement(shared_from_this(), stmt));
+  return std::make_unique<SQLiteStatement>(shared_from_this(), stmt);
 }
 
 bool SQLiteConnection::IsValid() {
index e3a60e7..201da06 100644 (file)
@@ -13,7 +13,7 @@ namespace ttm {
 namespace provider {
 
 ThemeInfoProxy::ThemeInfoProxy(const std::string& db_path) {
-  db_manager_.reset(new DbManager(db_path));
+  db_manager_ = std::make_unique<DbManager>(db_path);
   db_manager_->AddPackageEventListener(this);
 }
 
index c430b55..bb8569a 100644 (file)
@@ -28,7 +28,7 @@ class ThemeInfoProxyTest : public testing::Test {
   virtual ~ThemeInfoProxyTest() {}
 
   virtual void SetUp() {
-    proxy_.reset(new ThemeInfoProxy("test.db"));
+    proxy_ = std::make_unique<ThemeInfoProxy>("test.db");
   }
 
   virtual void TearDown() {