update_engine: Replace NULL with nullptr
Replaced the usage of NULL with nullptr. This also makes it possible to
use standard gtest macros to compare pointers in Update Manager's unit tests.
So, there is no need in custom UMTEST_... macros which are replaced with the
gtest macros (see change in update_engine/update_manager/umtest_utils.h):
UMTEST_ASSERT_NULL(p) => ASSERT_EQ(nullptr, p)
UMTEST_ASSERT_NOT_NULL(p) => ASSERT_NE(nullptr, p)
UMTEST_EXPECT_NULL(p) => EXPECT_EQ(nullptr, p)
UMTEST_EXPECT_NOT_NULL(p) => EXPECT_NE(nullptr, p)
BUG=None
TEST=FEATURES=test emerge-link update_engine
USE="clang asan" FEATURES=test emerge-link update_engine
Change-Id: I77a42a1e9ce992bb2f9f263db5cf75fe6110a4ec
Reviewed-on: https://chromium-review.googlesource.com/215136
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/mock_http_fetcher.cc b/mock_http_fetcher.cc
index 9b3ae86..e178a50 100644
--- a/mock_http_fetcher.cc
+++ b/mock_http_fetcher.cc
@@ -31,7 +31,7 @@
}
// Returns false on one condition: If timeout_source_ was already set
-// and it needs to be deleted by the caller. If timeout_source_ is NULL
+// and it needs to be deleted by the caller. If timeout_source_ is null
// when this function is called, this function will always return true.
bool MockHttpFetcher::SendData(bool skip_delivery) {
if (fail_transfer_) {
@@ -72,8 +72,8 @@
timeout_source_ = g_timeout_source_new(10);
CHECK(timeout_source_);
g_source_set_callback(timeout_source_, StaticTimeoutCallback, this,
- NULL);
- timout_tag_ = g_source_attach(timeout_source_, NULL);
+ nullptr);
+ timout_tag_ = g_source_attach(timeout_source_, nullptr);
}
return true;
}
@@ -82,7 +82,7 @@
CHECK(!paused_);
bool ret = SendData(false);
if (false == ret) {
- timeout_source_ = NULL;
+ timeout_source_ = nullptr;
}
return ret;
}
@@ -96,7 +96,7 @@
if (timeout_source_) {
g_source_remove(timout_tag_);
g_source_destroy(timeout_source_);
- timeout_source_ = NULL;
+ timeout_source_ = nullptr;
}
delegate_->TransferTerminated(this);
}
@@ -107,7 +107,7 @@
if (timeout_source_) {
g_source_remove(timout_tag_);
g_source_destroy(timeout_source_);
- timeout_source_ = NULL;
+ timeout_source_ = nullptr;
}
}