Skip to content

Commit

Permalink
clang-tidy modernize-use-nullptr (envoyproxy#7791)
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Argueta <dereka@pinterest.com>
  • Loading branch information
derekargueta authored and mattklein123 committed Aug 2, 2019
1 parent fc8d6f5 commit 06119fa
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ WarningsAsErrors: 'abseil-duration-*,
modernize-return-braced-init-list,
modernize-use-default-member-init,
modernize-use-equals-default,
modernize-use-nullptr,
modernize-use-override,
modernize-use-using,
performance-faster-string-find,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ constexpr uint32_t PROXY_PROTO_V2_AF_UNIX = 0x3;
struct WireHeader {
WireHeader(size_t extensions_length)
: extensions_length_(extensions_length), protocol_version_(Network::Address::IpVersion::v4),
remote_address_(0), local_address_(0), local_command_(true) {}
remote_address_(nullptr), local_address_(nullptr), local_command_(true) {}
WireHeader(size_t extensions_length, Network::Address::IpVersion protocol_version,
Network::Address::InstanceConstSharedPtr remote_address,
Network::Address::InstanceConstSharedPtr local_address)
Expand Down
2 changes: 1 addition & 1 deletion test/common/buffer/buffer_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class OwnedSliceTest : public testing::Test {
static void expectReservationFailure(const Slice::Reservation& reservation, const Slice& slice,
uint64_t reservable_size) {
EXPECT_EQ(nullptr, reservation.mem_);
EXPECT_EQ(0, reservation.mem_);
EXPECT_EQ(nullptr, reservation.mem_);
EXPECT_EQ(reservable_size, slice.reservableSize());
}

Expand Down
16 changes: 8 additions & 8 deletions test/extensions/common/tap/tap_config_base_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,23 +96,23 @@ TEST(TrimSlice, All) {
}

{
std::vector<Buffer::RawSlice> slices = {{0x0, 5}};
std::vector<Buffer::RawSlice> slices = {{nullptr, 5}};
Utility::trimSlices(slices, 0, 100);

const std::vector<Buffer::RawSlice> expected{{0x0, 5}};
const std::vector<Buffer::RawSlice> expected{{nullptr, 5}};
EXPECT_EQ(expected, slices);
}

{
std::vector<Buffer::RawSlice> slices = {{0x0, 5}};
std::vector<Buffer::RawSlice> slices = {{nullptr, 5}};
Utility::trimSlices(slices, 3, 3);

const std::vector<Buffer::RawSlice> expected{{reinterpret_cast<void*>(0x3), 2}};
EXPECT_EQ(expected, slices);
}

{
std::vector<Buffer::RawSlice> slices = {{0x0, 5}, {0x0, 4}};
std::vector<Buffer::RawSlice> slices = {{nullptr, 5}, {nullptr, 4}};
Utility::trimSlices(slices, 3, 3);

const std::vector<Buffer::RawSlice> expected{{reinterpret_cast<void*>(0x3), 2},
Expand All @@ -121,7 +121,7 @@ TEST(TrimSlice, All) {
}

{
std::vector<Buffer::RawSlice> slices = {{0x0, 5}, {0x0, 4}};
std::vector<Buffer::RawSlice> slices = {{nullptr, 5}, {nullptr, 4}};
Utility::trimSlices(slices, 6, 3);

const std::vector<Buffer::RawSlice> expected{{reinterpret_cast<void*>(0x5), 0},
Expand All @@ -130,7 +130,7 @@ TEST(TrimSlice, All) {
}

{
std::vector<Buffer::RawSlice> slices = {{0x0, 5}, {0x0, 4}};
std::vector<Buffer::RawSlice> slices = {{nullptr, 5}, {nullptr, 4}};
Utility::trimSlices(slices, 0, 0);

const std::vector<Buffer::RawSlice> expected{{reinterpret_cast<void*>(0x0), 0},
Expand All @@ -139,7 +139,7 @@ TEST(TrimSlice, All) {
}

{
std::vector<Buffer::RawSlice> slices = {{0x0, 5}, {0x0, 4}};
std::vector<Buffer::RawSlice> slices = {{nullptr, 5}, {nullptr, 4}};
Utility::trimSlices(slices, 0, 3);

const std::vector<Buffer::RawSlice> expected{{reinterpret_cast<void*>(0x0), 3},
Expand All @@ -148,7 +148,7 @@ TEST(TrimSlice, All) {
}

{
std::vector<Buffer::RawSlice> slices = {{0x0, 5}, {0x0, 4}};
std::vector<Buffer::RawSlice> slices = {{nullptr, 5}, {nullptr, 4}};
Utility::trimSlices(slices, 1, 3);

const std::vector<Buffer::RawSlice> expected{{reinterpret_cast<void*>(0x1), 3},
Expand Down

0 comments on commit 06119fa

Please sign in to comment.