mirror of
https://bitbucket.org/theswgsource/src-1.2.git
synced 2026-08-01 02:15:54 -04:00
newer standards prefer nullptr over NULL - this is most of them but there are others too
This commit is contained in:
+4
-4
@@ -12,7 +12,7 @@ namespace Base
|
||||
{
|
||||
for(unsigned i = 0; i < 31; i++)
|
||||
{
|
||||
m_blocks[i] = NULL;
|
||||
m_blocks[i] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Base
|
||||
// free all allocated memory blocks
|
||||
for(unsigned i = 0; i < 31; i++)
|
||||
{
|
||||
while(m_blocks[i] != NULL)
|
||||
while(m_blocks[i] != nullptr)
|
||||
{
|
||||
unsigned *tmp = m_blocks[i];
|
||||
m_blocks[i] = (unsigned *)*m_blocks[i];
|
||||
@@ -36,7 +36,7 @@ namespace Base
|
||||
void *BlockAllocator::getBlock(unsigned bytes)
|
||||
{
|
||||
unsigned accum = 16, bits = 16;
|
||||
unsigned *handle = NULL;
|
||||
unsigned *handle = nullptr;
|
||||
|
||||
// Perform a binary search looking for the highest bit.
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace Base
|
||||
|
||||
void BlockAllocator::returnBlock(unsigned *handle)
|
||||
{
|
||||
// C++ allows for safe deletion of a NULL pointer
|
||||
// C++ allows for safe deletion of a nullptr pointer
|
||||
if(handle)
|
||||
{
|
||||
// Update the allocator linked list, insert this entry at the head
|
||||
|
||||
@@ -26,8 +26,8 @@ namespace Base
|
||||
mCond(),
|
||||
mThreadCount(0)
|
||||
{
|
||||
pthread_mutex_init(&mMutex, NULL);
|
||||
pthread_cond_init(&mCond, NULL);
|
||||
pthread_mutex_init(&mMutex, nullptr);
|
||||
pthread_cond_init(&mCond, nullptr);
|
||||
}
|
||||
|
||||
CEvent::~CEvent()
|
||||
@@ -74,7 +74,7 @@ namespace Base
|
||||
struct timeval now;
|
||||
struct timespec abs_timeout;
|
||||
|
||||
gettimeofday(&now, NULL);
|
||||
gettimeofday(&now, nullptr);
|
||||
abs_timeout.tv_sec = now.tv_sec + timeout/1000;
|
||||
abs_timeout.tv_nsec = now.tv_usec * 1000 + (timeout%1000)*1000000;
|
||||
abs_timeout.tv_sec += abs_timeout.tv_nsec / 1000000000;
|
||||
|
||||
@@ -77,8 +77,8 @@ namespace Base
|
||||
|
||||
CThreadPool::CMember::CMember(CThreadPool * parent) :
|
||||
mParent(parent),
|
||||
mFunction(NULL),
|
||||
mArgument(NULL),
|
||||
mFunction(nullptr),
|
||||
mArgument(nullptr),
|
||||
mSemaphore()
|
||||
{
|
||||
StartThread();
|
||||
@@ -117,8 +117,8 @@ namespace Base
|
||||
if (mFunction)
|
||||
{
|
||||
mFunction(mArgument);
|
||||
mArgument = NULL;
|
||||
mFunction = NULL;
|
||||
mArgument = nullptr;
|
||||
mFunction = nullptr;
|
||||
}
|
||||
else if (mParent->OnDestory(this))
|
||||
mThreadContinue = false;
|
||||
@@ -173,7 +173,7 @@ namespace Base
|
||||
}
|
||||
|
||||
////////////////////////////////////////
|
||||
// (3) Delete the null member threads
|
||||
// (3) Delete the nullptr member threads
|
||||
mMutex.Lock();
|
||||
while (!mNullMember.empty())
|
||||
{
|
||||
@@ -224,7 +224,7 @@ namespace Base
|
||||
}
|
||||
|
||||
////////////////////////////////////////
|
||||
// (2) Delete any null member threads.
|
||||
// (2) Delete any nullptr member threads.
|
||||
while (!mNullMember.empty())
|
||||
{
|
||||
delete mNullMember.front();
|
||||
|
||||
Reference in New Issue
Block a user