mesos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mp...@apache.org
Subject [4/7] mesos git commit: MesosTidy: Removed redundant `get()` on smart pointers in libprocess.
Date Mon, 06 Nov 2017 22:09:59 GMT
MesosTidy: Removed redundant `get()` on smart pointers in libprocess.

```
3rdparty/libprocess/src/../include/process/owned.hpp:117:7:
warning: redundant get() call on smart pointer
[google-readability-redundant-smartptr-get]
```

Review: https://reviews.apache.org/r/63567


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/f964e909
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/f964e909
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/f964e909

Branch: refs/heads/master
Commit: f964e909ecd9e9c2c1b38129028b05a8f29470fe
Parents: f9776cc
Author: Michael Park <mpark@apache.org>
Authored: Sun Nov 5 00:42:25 2017 -0700
Committer: Michael Park <mpark@apache.org>
Committed: Mon Nov 6 13:57:05 2017 -0800

----------------------------------------------------------------------
 3rdparty/libprocess/include/process/owned.hpp  | 6 +++---
 3rdparty/libprocess/include/process/shared.hpp | 4 ++--
 3rdparty/libprocess/src/tests/owned_tests.cpp  | 6 ------
 3rdparty/libprocess/src/tests/shared_tests.cpp | 3 ---
 4 files changed, 5 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/f964e909/3rdparty/libprocess/include/process/owned.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/owned.hpp b/3rdparty/libprocess/include/process/owned.hpp
index e1ae6dc..cc149e7 100644
--- a/3rdparty/libprocess/include/process/owned.hpp
+++ b/3rdparty/libprocess/include/process/owned.hpp
@@ -114,7 +114,7 @@ T* Owned<T>::operator->() const
 template <typename T>
 T* Owned<T>::get() const
 {
-  if (data.get() == nullptr) {
+  if (data == nullptr) {
     return nullptr;
   } else {
     // Static cast to avoid ambiguity in Visual Studio compiler.
@@ -154,7 +154,7 @@ void Owned<T>::swap(Owned<T>& that)
 template <typename T>
 Shared<T> Owned<T>::share()
 {
-  if (data.get() == nullptr) {
+  if (data == nullptr) {
     // The ownership of this pointer has already been lost.
     return Shared<T>(nullptr);
   }
@@ -174,7 +174,7 @@ Shared<T> Owned<T>::share()
 template <typename T>
 T* Owned<T>::release()
 {
-  if (data.get() == nullptr) {
+  if (data == nullptr) {
     // The ownership of this pointer has already been lost.
     return nullptr;
   }

http://git-wip-us.apache.org/repos/asf/mesos/blob/f964e909/3rdparty/libprocess/include/process/shared.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/shared.hpp b/3rdparty/libprocess/include/process/shared.hpp
index d58c885..6eb6943 100644
--- a/3rdparty/libprocess/include/process/shared.hpp
+++ b/3rdparty/libprocess/include/process/shared.hpp
@@ -115,7 +115,7 @@ const T* Shared<T>::operator->() const
 template <typename T>
 const T* Shared<T>::get() const
 {
-  if (data.get() == nullptr) {
+  if (data == nullptr) {
     return nullptr;
   } else {
     return data->t;
@@ -162,7 +162,7 @@ Future<Owned<T>> Shared<T>::own()
   // of them is a write, the behavior is undefined. This is similar to
   // boost::shared_ptr. For more details, please refer to the boost
   // shared_ptr document (section "Thread Safety").
-  if (data.get() == nullptr) {
+  if (data == nullptr) {
     return Owned<T>(nullptr);
   }
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/f964e909/3rdparty/libprocess/src/tests/owned_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/owned_tests.cpp b/3rdparty/libprocess/src/tests/owned_tests.cpp
index f9f4cce..f829693 100644
--- a/3rdparty/libprocess/src/tests/owned_tests.cpp
+++ b/3rdparty/libprocess/src/tests/owned_tests.cpp
@@ -39,13 +39,11 @@ TEST(OwnedTest, Access)
 
   EXPECT_EQ(42, owned->get());
   EXPECT_EQ(42, (*owned).get());
-  EXPECT_EQ(42, owned.get()->get());
 
   owned->set(10);
 
   EXPECT_EQ(10, owned->get());
   EXPECT_EQ(10, (*owned).get());
-  EXPECT_EQ(10, owned.get()->get());
 }
 
 
@@ -68,7 +66,6 @@ TEST(OwnedTest, Share)
 
   EXPECT_EQ(42, owned->get());
   EXPECT_EQ(42, (*owned).get());
-  EXPECT_EQ(42, owned.get()->get());
 
   Shared<Foo> shared = owned.share();
 
@@ -77,14 +74,12 @@ TEST(OwnedTest, Share)
 
   EXPECT_EQ(42, shared->get());
   EXPECT_EQ(42, (*shared).get());
-  EXPECT_EQ(42, shared.get()->get());
 
   {
     Shared<Foo> shared2(shared);
 
     EXPECT_EQ(42, shared2->get());
     EXPECT_EQ(42, (*shared2).get());
-    EXPECT_EQ(42, shared2.get()->get());
     EXPECT_FALSE(shared.unique());
     EXPECT_FALSE(shared2.unique());
   }
@@ -102,7 +97,6 @@ TEST(OwnedTest, Release)
 
   EXPECT_EQ(42, owned->get());
   EXPECT_EQ(42, (*owned).get());
-  EXPECT_EQ(42, owned.get()->get());
 
   Foo* raw = owned.release();
   EXPECT_EQ(nullptr, owned.get());

http://git-wip-us.apache.org/repos/asf/mesos/blob/f964e909/3rdparty/libprocess/src/tests/shared_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/shared_tests.cpp b/3rdparty/libprocess/src/tests/shared_tests.cpp
index 2a2ffe7..9bb291e 100644
--- a/3rdparty/libprocess/src/tests/shared_tests.cpp
+++ b/3rdparty/libprocess/src/tests/shared_tests.cpp
@@ -87,7 +87,6 @@ TEST(SharedTest, Own)
 
   EXPECT_EQ(42, shared->get());
   EXPECT_EQ(42, (*shared).get());
-  EXPECT_EQ(42, shared.get()->get());
   EXPECT_TRUE(shared.unique());
 
   Future<Owned<Foo>> future;
@@ -97,7 +96,6 @@ TEST(SharedTest, Own)
 
     EXPECT_EQ(42, shared2->get());
     EXPECT_EQ(42, (*shared2).get());
-    EXPECT_EQ(42, shared2.get()->get());
     EXPECT_FALSE(shared2.unique());
     EXPECT_FALSE(shared.unique());
 
@@ -119,5 +117,4 @@ TEST(SharedTest, Own)
   Owned<Foo> owned = future.get();
   EXPECT_EQ(42, owned->get());
   EXPECT_EQ(42, (*owned).get());
-  EXPECT_EQ(42, owned.get()->get());
 }


Mime
View raw message