Remove usage of CHECK_NOTNULL
We want to switch to absl logging instead of glog. gtest and ceres are
going there, and we already have absl as a dependency. ABSL doesn't
have CHECK_NOTNULL, and we can move things over in an easier to review
fashion.
Change-Id: Ifd9a11ec34a2357cec43f88dba015db9c28ed2cf
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/aos/util/config_validator_lib.cc b/aos/util/config_validator_lib.cc
index eb5205a..4347017 100644
--- a/aos/util/config_validator_lib.cc
+++ b/aos/util/config_validator_lib.cc
@@ -177,8 +177,10 @@
}
// TODO(james): This will be overly noisy, as it ends up
// CHECK-failing.
- required_timestamp_channels.insert(CHECK_NOTNULL(
- timestamp_finder.ForChannel(channel, connection)));
+ const Channel *found_channel =
+ timestamp_finder.ForChannel(channel, connection);
+ CHECK(found_channel != nullptr);
+ required_timestamp_channels.insert(found_channel);
break;
}
}
diff --git a/aos/util/error_counter.h b/aos/util/error_counter.h
index e08c67e..7837f9e 100644
--- a/aos/util/error_counter.h
+++ b/aos/util/error_counter.h
@@ -51,7 +51,8 @@
static void InitializeStaticFbs(Static *builder) {
CHECK(builder->reserve(kNumErrors));
for (size_t ii = 0; ii < kNumErrors; ++ii) {
- auto element = CHECK_NOTNULL(builder->emplace_back());
+ auto element = builder->emplace_back();
+ CHECK(element != nullptr);
element->set_error(static_cast<Error>(ii));
element->set_count(0);
}
@@ -65,7 +66,7 @@
void InvalidateBuffer() { vector_ = nullptr; }
void IncrementError(Error error) {
- CHECK_NOTNULL(vector_);
+ CHECK(vector_ != nullptr);
DCHECK_LT(static_cast<size_t>(error), vector_->size());
Count *counter = vector_->GetMutableObject(static_cast<size_t>(error));
counter->mutate_count(counter->count() + 1);
@@ -73,7 +74,7 @@
// Sets all the error counts to zero.
void ResetCounts() {
- CHECK_NOTNULL(vector_);
+ CHECK(vector_ != nullptr);
DCHECK_EQ(vector_->size(), kNumErrors) << this << " vector " << vector_;
for (size_t ii = 0; ii < kNumErrors; ++ii) {
vector_->GetMutableObject(ii)->mutate_count(0);
diff --git a/aos/util/mcap_logger.cc b/aos/util/mcap_logger.cc
index 0dbb88e..a70da62 100644
--- a/aos/util/mcap_logger.cc
+++ b/aos/util/mcap_logger.cc
@@ -422,7 +422,7 @@
if (!wrote_configuration_) {
WriteConfigurationMessage();
}
- CHECK_NOTNULL(context.data);
+ CHECK(context.data != nullptr);
message_counts_[channel_id]++;
diff --git a/aos/util/scoped_pipe.cc b/aos/util/scoped_pipe.cc
index a4e5b46..d178c0d 100644
--- a/aos/util/scoped_pipe.cc
+++ b/aos/util/scoped_pipe.cc
@@ -49,7 +49,7 @@
}
size_t ScopedPipe::ScopedReadPipe::Read(std::string *buffer) {
- CHECK_NOTNULL(buffer);
+ CHECK(buffer != nullptr);
constexpr ssize_t kBufferSize = 1024;
const size_t original_size = buffer->size();
size_t read_bytes = 0;