Commit 0a609930 authored by Christopher Dykes's avatar Christopher Dykes Committed by Facebook Github Bot

Use nullptr rather than 0 for a null pointer

Summary: This time aided by clang-tidy's modernize-use-nullptr check.

Reviewed By: yfeldblum

Differential Revision: D6102739

fbshipit-source-id: aeb4bd0a8078d81cc88b766e0a034a37dd25fd1f
parent 18172db6
......@@ -414,18 +414,17 @@ struct AtomicHashArray<KeyT, ValueT, HashFcn, EqualFcn,
IterVal,
boost::forward_traversal_tag>
{
explicit aha_iterator() : aha_(0) {}
explicit aha_iterator() : aha_(nullptr) {}
// Conversion ctor for interoperability between const_iterator and
// iterator. The enable_if<> magic keeps us well-behaved for
// is_convertible<> (v. the iterator_facade documentation).
template <class OtherContT, class OtherVal>
aha_iterator(const aha_iterator<OtherContT,OtherVal>& o,
typename std::enable_if<
std::is_convertible<OtherVal*,IterVal*>::value >::type* = 0)
: aha_(o.aha_)
, offset_(o.offset_)
{}
aha_iterator(
const aha_iterator<OtherContT, OtherVal>& o,
typename std::enable_if<
std::is_convertible<OtherVal*, IterVal*>::value>::type* = nullptr)
: aha_(o.aha_), offset_(o.offset_) {}
explicit aha_iterator(ContT* array, size_t offset)
: aha_(array)
......
......@@ -468,19 +468,17 @@ struct AtomicHashMap<KeyT, ValueT, HashFcn, EqualFcn,
ahm_iterator : boost::iterator_facade<ahm_iterator<ContT, IterVal, SubIt>,
IterVal,
boost::forward_traversal_tag> {
explicit ahm_iterator() : ahm_(0) {}
explicit ahm_iterator() : ahm_(nullptr) {}
// Conversion ctor for interoperability between const_iterator and
// iterator. The enable_if<> magic keeps us well-behaved for
// is_convertible<> (v. the iterator_facade documentation).
template <class OtherContT, class OtherVal, class OtherSubIt>
ahm_iterator(const ahm_iterator<OtherContT,OtherVal,OtherSubIt>& o,
typename std::enable_if<
std::is_convertible<OtherSubIt,SubIt>::value >::type* = 0)
: ahm_(o.ahm_)
, subMap_(o.subMap_)
, subIt_(o.subIt_)
{}
ahm_iterator(
const ahm_iterator<OtherContT, OtherVal, OtherSubIt>& o,
typename std::enable_if<
std::is_convertible<OtherSubIt, SubIt>::value>::type* = nullptr)
: ahm_(o.ahm_), subMap_(o.subMap_), subIt_(o.subIt_) {}
/*
* Returns the unique index that can be used for access directly
......
......@@ -676,9 +676,11 @@ class detail::csl_iterator :
explicit csl_iterator(NodeT* node = nullptr) : node_(node) {}
template <typename OtherVal, typename OtherNode>
csl_iterator(const csl_iterator<OtherVal, OtherNode> &other,
typename std::enable_if<std::is_convertible<OtherVal, ValT>::value>::type*
= 0) : node_(other.node_) {}
csl_iterator(
const csl_iterator<OtherVal, OtherNode>& other,
typename std::enable_if<
std::is_convertible<OtherVal, ValT>::value>::type* = nullptr)
: node_(other.node_) {}
size_t nodeSize() const {
return node_ == nullptr ? 0 :
......
......@@ -2333,7 +2333,7 @@ basic_fbstring<E, T, A, S>::find_first_of(
}
const_iterator i(begin() + pos), finish(end());
for (; i != finish; ++i) {
if (traits_type::find(s, n, *i) != 0) {
if (traits_type::find(s, n, *i) != nullptr) {
return i - begin();
}
}
......@@ -2348,7 +2348,7 @@ basic_fbstring<E, T, A, S>::find_last_of(
pos = std::min(pos, length() - 1);
const_iterator i(begin() + pos);
for (;; --i) {
if (traits_type::find(s, n, *i) != 0) {
if (traits_type::find(s, n, *i) != nullptr) {
return i - begin();
}
if (i == begin()) {
......@@ -2366,7 +2366,7 @@ basic_fbstring<E, T, A, S>::find_first_not_of(
if (pos < length()) {
const_iterator i(begin() + pos), finish(end());
for (; i != finish; ++i) {
if (traits_type::find(s, n, *i) == 0) {
if (traits_type::find(s, n, *i) == nullptr) {
return i - begin();
}
}
......@@ -2382,7 +2382,7 @@ basic_fbstring<E, T, A, S>::find_last_not_of(
pos = std::min(pos, size() - 1);
const_iterator i(begin() + pos);
for (;; --i) {
if (traits_type::find(s, n, *i) == 0) {
if (traits_type::find(s, n, *i) == nullptr) {
return i - begin();
}
if (i == begin()) {
......
......@@ -216,7 +216,7 @@ class HasLess {
template <typename, typename> static BiggerThanChar test(...);
public:
enum { value = sizeof(test<T, U>(0)) == 1 };
enum { value = sizeof(test<T, U>(nullptr)) == 1 };
};
/**
......
......@@ -106,11 +106,11 @@ class LockInterfaceDispatcher {
public:
static constexpr bool has_lock_unique = true;
static constexpr bool has_lock_timed =
decltype(timed_lock_test<Mutex>(0))::value;
decltype(timed_lock_test<Mutex>(nullptr))::value;
static constexpr bool has_lock_shared =
decltype(lock_shared_test<Mutex>(0))::value;
decltype(lock_shared_test<Mutex>(nullptr))::value;
static constexpr bool has_lock_upgrade =
decltype(lock_upgrade_test<Mutex>(0))::value;
decltype(lock_upgrade_test<Mutex>(nullptr))::value;
};
/**
......
......@@ -1137,7 +1137,7 @@ class small_vector : public detail::small_vector_base<
union Data {
explicit Data() {
pdata_.heap_ = 0;
pdata_.heap_ = nullptr;
}
PointerType pdata_;
......
......@@ -1236,7 +1236,7 @@ TEST(FBString, testMoveOperatorPlusRhs) {
// other than libstdc++. Someday if we deem it important to present
// identical undefined behavior for other platforms, we can re-visit this.
TEST(FBString, testConstructionFromLiteralZero) {
EXPECT_THROW(fbstring s(0), std::logic_error);
EXPECT_THROW(fbstring s(nullptr), std::logic_error);
}
TEST(FBString, testFixedBugs) {
......
......@@ -348,7 +348,7 @@ TEST(MPMCQueue, mt_try_enq_deq_deterministic) {
uint64_t nowMicro() {
timeval tv;
gettimeofday(&tv, 0);
gettimeofday(&tv, nullptr);
return static_cast<uint64_t>(tv.tv_sec) * 1000000 + tv.tv_usec;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment