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