mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-25 14:46:24 +00:00
refactor(Core): apply clang-tidy modernize-use-nullptr (#3819)
This commit is contained in:
@@ -21,17 +21,17 @@ private:
|
||||
LinkedListElement* iNext;
|
||||
LinkedListElement* iPrev;
|
||||
public:
|
||||
LinkedListElement(): iNext(NULL), iPrev(NULL) { }
|
||||
LinkedListElement(): iNext(nullptr), iPrev(nullptr) { }
|
||||
~LinkedListElement() { delink(); }
|
||||
|
||||
[[nodiscard]] bool hasNext() const { return (iNext && iNext->iNext != NULL); }
|
||||
[[nodiscard]] bool hasPrev() const { return (iPrev && iPrev->iPrev != NULL); }
|
||||
[[nodiscard]] bool isInList() const { return (iNext != NULL && iPrev != NULL); }
|
||||
[[nodiscard]] bool hasNext() const { return (iNext && iNext->iNext != nullptr); }
|
||||
[[nodiscard]] bool hasPrev() const { return (iPrev && iPrev->iPrev != nullptr); }
|
||||
[[nodiscard]] bool isInList() const { return (iNext != nullptr && iPrev != nullptr); }
|
||||
|
||||
LinkedListElement* next() { return hasNext() ? iNext : NULL; }
|
||||
[[nodiscard]] LinkedListElement const* next() const { return hasNext() ? iNext : NULL; }
|
||||
LinkedListElement* prev() { return hasPrev() ? iPrev : NULL; }
|
||||
[[nodiscard]] LinkedListElement const* prev() const { return hasPrev() ? iPrev : NULL; }
|
||||
LinkedListElement* next() { return hasNext() ? iNext : nullptr; }
|
||||
[[nodiscard]] LinkedListElement const* next() const { return hasNext() ? iNext : nullptr; }
|
||||
LinkedListElement* prev() { return hasPrev() ? iPrev : nullptr; }
|
||||
[[nodiscard]] LinkedListElement const* prev() const { return hasPrev() ? iPrev : nullptr; }
|
||||
|
||||
LinkedListElement* nocheck_next() { return iNext; }
|
||||
[[nodiscard]] LinkedListElement const* nocheck_next() const { return iNext; }
|
||||
@@ -44,8 +44,8 @@ public:
|
||||
{
|
||||
iNext->iPrev = iPrev;
|
||||
iPrev->iNext = iNext;
|
||||
iNext = NULL;
|
||||
iPrev = NULL;
|
||||
iNext = nullptr;
|
||||
iPrev = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,11 +85,11 @@ public:
|
||||
|
||||
[[nodiscard]] bool isEmpty() const { return (!iFirst.iNext->isInList()); }
|
||||
|
||||
LinkedListElement* getFirst() { return (isEmpty() ? NULL : iFirst.iNext); }
|
||||
[[nodiscard]] LinkedListElement const* getFirst() const { return (isEmpty() ? NULL : iFirst.iNext); }
|
||||
LinkedListElement* getFirst() { return (isEmpty() ? nullptr : iFirst.iNext); }
|
||||
[[nodiscard]] LinkedListElement const* getFirst() const { return (isEmpty() ? nullptr : iFirst.iNext); }
|
||||
|
||||
LinkedListElement* getLast() { return (isEmpty() ? NULL : iLast.iPrev); }
|
||||
[[nodiscard]] LinkedListElement const* getLast() const { return (isEmpty() ? NULL : iLast.iPrev); }
|
||||
LinkedListElement* getLast() { return (isEmpty() ? nullptr : iLast.iPrev); }
|
||||
[[nodiscard]] LinkedListElement const* getLast() const { return (isEmpty() ? nullptr : iLast.iPrev); }
|
||||
|
||||
void insertFirst(LinkedListElement* pElem)
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
void clearReferences()
|
||||
{
|
||||
LinkedListElement* ref;
|
||||
while ((ref = getFirst()) != NULL)
|
||||
while ((ref = getFirst()) != nullptr)
|
||||
{
|
||||
((Reference<TO, FROM>*) ref)->invalidate();
|
||||
ref->delink(); // the delink might be already done by invalidate(), but doing it here again does not hurt and insures an empty list
|
||||
|
||||
@@ -27,7 +27,7 @@ protected:
|
||||
// Tell our refFrom (source) object, that the link is cut (Target destroyed)
|
||||
virtual void sourceObjectDestroyLink() = 0;
|
||||
public:
|
||||
Reference() { iRefTo = NULL; iRefFrom = NULL; }
|
||||
Reference() { iRefTo = nullptr; iRefFrom = nullptr; }
|
||||
virtual ~Reference() { }
|
||||
|
||||
// Create new link
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
ASSERT(fromObj); // fromObj MUST not be NULL
|
||||
if (isValid())
|
||||
unlink();
|
||||
if (toObj != NULL)
|
||||
if (toObj != nullptr)
|
||||
{
|
||||
iRefTo = toObj;
|
||||
iRefFrom = fromObj;
|
||||
@@ -50,8 +50,8 @@ public:
|
||||
{
|
||||
targetObjectDestroyLink();
|
||||
delink();
|
||||
iRefTo = NULL;
|
||||
iRefFrom = NULL;
|
||||
iRefTo = nullptr;
|
||||
iRefFrom = nullptr;
|
||||
}
|
||||
|
||||
// Link is invalid due to destruction of referenced target object. Call comes from the refTo object
|
||||
@@ -60,12 +60,12 @@ public:
|
||||
{
|
||||
sourceObjectDestroyLink();
|
||||
delink();
|
||||
iRefTo = NULL;
|
||||
iRefTo = nullptr;
|
||||
}
|
||||
|
||||
[[nodiscard]] bool isValid() const // Only check the iRefTo
|
||||
{
|
||||
return iRefTo != NULL;
|
||||
return iRefTo != nullptr;
|
||||
}
|
||||
|
||||
Reference<TO, FROM>* next() { return ((Reference<TO, FROM>*) LinkedListElement::next()); }
|
||||
|
||||
Reference in New Issue
Block a user