Merge "Modernize codebase by replacing NULL with nullptr"
This commit is contained in:
commit
9154fbc8df
11 changed files with 25 additions and 25 deletions
|
@ -184,7 +184,7 @@ struct log_msg {
|
|||
hdr_size = sizeof(entry_v1);
|
||||
}
|
||||
if ((hdr_size < sizeof(entry_v1)) || (hdr_size > sizeof(entry))) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
return reinterpret_cast<char*>(buf) + hdr_size;
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ inline bool createThreadEtc(thread_func_t entryFunction,
|
|||
const char* threadName = "android:unnamed_thread",
|
||||
int32_t threadPriority = PRIORITY_DEFAULT,
|
||||
size_t threadStackSize = 0,
|
||||
thread_id_t *threadId = 0)
|
||||
thread_id_t *threadId = nullptr)
|
||||
{
|
||||
return androidCreateThreadEtc(entryFunction, userData, threadName,
|
||||
threadPriority, threadStackSize, threadId) ? true : false;
|
||||
|
|
|
@ -49,13 +49,13 @@ public:
|
|||
// Dump a stack trace to the log using the supplied logtag.
|
||||
void log(const char* logtag,
|
||||
android_LogPriority priority = ANDROID_LOG_DEBUG,
|
||||
const char* prefix = 0) const;
|
||||
const char* prefix = nullptr) const;
|
||||
|
||||
// Dump a stack trace to the specified file descriptor.
|
||||
void dump(int fd, int indent = 0, const char* prefix = 0) const;
|
||||
void dump(int fd, int indent = 0, const char* prefix = nullptr) const;
|
||||
|
||||
// Return a string (possibly very long) containing the complete stack trace.
|
||||
String8 toString(const char* prefix = 0) const;
|
||||
String8 toString(const char* prefix = nullptr) const;
|
||||
|
||||
// Dump a serialized representation of the stack trace to the specified printer.
|
||||
void print(Printer& printer) const;
|
||||
|
|
|
@ -262,7 +262,7 @@ public:
|
|||
*/
|
||||
int pollOnce(int timeoutMillis, int* outFd, int* outEvents, void** outData);
|
||||
inline int pollOnce(int timeoutMillis) {
|
||||
return pollOnce(timeoutMillis, NULL, NULL, NULL);
|
||||
return pollOnce(timeoutMillis, nullptr, nullptr, nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -272,7 +272,7 @@ public:
|
|||
*/
|
||||
int pollAll(int timeoutMillis, int* outFd, int* outEvents, void** outData);
|
||||
inline int pollAll(int timeoutMillis) {
|
||||
return pollAll(timeoutMillis, NULL, NULL, NULL);
|
||||
return pollAll(timeoutMillis, nullptr, nullptr, nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -100,7 +100,7 @@ class CAPABILITY("mutex") Mutex {
|
|||
|
||||
Mutex();
|
||||
explicit Mutex(const char* name);
|
||||
explicit Mutex(int type, const char* name = NULL);
|
||||
explicit Mutex(int type, const char* name = nullptr);
|
||||
~Mutex();
|
||||
|
||||
// lock or unlock the mutex
|
||||
|
@ -160,10 +160,10 @@ class CAPABILITY("mutex") Mutex {
|
|||
#if !defined(_WIN32)
|
||||
|
||||
inline Mutex::Mutex() {
|
||||
pthread_mutex_init(&mMutex, NULL);
|
||||
pthread_mutex_init(&mMutex, nullptr);
|
||||
}
|
||||
inline Mutex::Mutex(__attribute__((unused)) const char* name) {
|
||||
pthread_mutex_init(&mMutex, NULL);
|
||||
pthread_mutex_init(&mMutex, nullptr);
|
||||
}
|
||||
inline Mutex::Mutex(int type, __attribute__((unused)) const char* name) {
|
||||
if (type == SHARED) {
|
||||
|
@ -173,7 +173,7 @@ inline Mutex::Mutex(int type, __attribute__((unused)) const char* name) {
|
|||
pthread_mutex_init(&mMutex, &attr);
|
||||
pthread_mutexattr_destroy(&attr);
|
||||
} else {
|
||||
pthread_mutex_init(&mMutex, NULL);
|
||||
pthread_mutex_init(&mMutex, nullptr);
|
||||
}
|
||||
}
|
||||
inline Mutex::~Mutex() {
|
||||
|
|
|
@ -48,7 +48,7 @@ public:
|
|||
|
||||
RWLock();
|
||||
explicit RWLock(const char* name);
|
||||
explicit RWLock(int type, const char* name = NULL);
|
||||
explicit RWLock(int type, const char* name = nullptr);
|
||||
~RWLock();
|
||||
|
||||
status_t readLock();
|
||||
|
@ -82,10 +82,10 @@ private:
|
|||
};
|
||||
|
||||
inline RWLock::RWLock() {
|
||||
pthread_rwlock_init(&mRWLock, NULL);
|
||||
pthread_rwlock_init(&mRWLock, nullptr);
|
||||
}
|
||||
inline RWLock::RWLock(__attribute__((unused)) const char* name) {
|
||||
pthread_rwlock_init(&mRWLock, NULL);
|
||||
pthread_rwlock_init(&mRWLock, nullptr);
|
||||
}
|
||||
inline RWLock::RWLock(int type, __attribute__((unused)) const char* name) {
|
||||
if (type == SHARED) {
|
||||
|
@ -95,7 +95,7 @@ inline RWLock::RWLock(int type, __attribute__((unused)) const char* name) {
|
|||
pthread_rwlock_init(&mRWLock, &attr);
|
||||
pthread_rwlockattr_destroy(&attr);
|
||||
} else {
|
||||
pthread_rwlock_init(&mRWLock, NULL);
|
||||
pthread_rwlock_init(&mRWLock, nullptr);
|
||||
}
|
||||
}
|
||||
inline RWLock::~RWLock() {
|
||||
|
|
|
@ -354,7 +354,7 @@ class wp
|
|||
public:
|
||||
typedef typename RefBase::weakref_type weakref_type;
|
||||
|
||||
inline wp() : m_ptr(0) { }
|
||||
inline wp() : m_ptr(nullptr) { }
|
||||
|
||||
wp(T* other); // NOLINT(implicit)
|
||||
wp(const wp<T>& other);
|
||||
|
@ -505,7 +505,7 @@ template<typename T>
|
|||
wp<T>& wp<T>::operator = (T* other)
|
||||
{
|
||||
weakref_type* newRefs =
|
||||
other ? other->createWeak(this) : 0;
|
||||
other ? other->createWeak(this) : nullptr;
|
||||
if (m_ptr) m_refs->decWeak(this);
|
||||
m_ptr = other;
|
||||
m_refs = newRefs;
|
||||
|
@ -528,7 +528,7 @@ template<typename T>
|
|||
wp<T>& wp<T>::operator = (const sp<T>& other)
|
||||
{
|
||||
weakref_type* newRefs =
|
||||
other != NULL ? other->createWeak(this) : 0;
|
||||
other != nullptr ? other->createWeak(this) : nullptr;
|
||||
T* otherPtr(other.m_ptr);
|
||||
if (m_ptr) m_refs->decWeak(this);
|
||||
m_ptr = otherPtr;
|
||||
|
|
|
@ -51,7 +51,7 @@ public:
|
|||
static TYPE& getInstance() {
|
||||
Mutex::Autolock _l(sLock);
|
||||
TYPE* instance = sInstance;
|
||||
if (instance == 0) {
|
||||
if (instance == nullptr) {
|
||||
instance = new TYPE();
|
||||
sInstance = instance;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public:
|
|||
|
||||
static bool hasInstance() {
|
||||
Mutex::Autolock _l(sLock);
|
||||
return sInstance != 0;
|
||||
return sInstance != nullptr;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -90,7 +90,7 @@ private:
|
|||
#define ANDROID_SINGLETON_STATIC_INSTANCE(TYPE) \
|
||||
template<> ::android::Mutex \
|
||||
(::android::Singleton< TYPE >::sLock)(::android::Mutex::PRIVATE); \
|
||||
template<> TYPE* ::android::Singleton< TYPE >::sInstance(0); /* NOLINT */ \
|
||||
template<> TYPE* ::android::Singleton< TYPE >::sInstance(nullptr); /* NOLINT */ \
|
||||
template class ::android::Singleton< TYPE >;
|
||||
|
||||
|
||||
|
|
|
@ -187,7 +187,7 @@ public:
|
|||
* "/tmp" --> "tmp" (remain = "")
|
||||
* "bar.c" --> "bar.c" (remain = "")
|
||||
*/
|
||||
String8 walkPath(String8* outRemains = NULL) const;
|
||||
String8 walkPath(String8* outRemains = nullptr) const;
|
||||
|
||||
/*
|
||||
* Return the filename extension. This is the last '.' and any number
|
||||
|
|
|
@ -52,7 +52,7 @@ inline bool operator _op_ (const wp<U>& o) const { \
|
|||
template<typename T>
|
||||
class sp {
|
||||
public:
|
||||
inline sp() : m_ptr(0) { }
|
||||
inline sp() : m_ptr(nullptr) { }
|
||||
|
||||
sp(T* other); // NOLINT(implicit)
|
||||
sp(const sp<T>& other);
|
||||
|
@ -230,7 +230,7 @@ template<typename T>
|
|||
void sp<T>::clear() {
|
||||
if (m_ptr) {
|
||||
m_ptr->decStrong(this);
|
||||
m_ptr = 0;
|
||||
m_ptr = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -157,7 +157,7 @@ protected:
|
|||
virtual int do_compare(const void* lhs, const void* rhs) const = 0;
|
||||
|
||||
private:
|
||||
ssize_t _indexOrderOf(const void* item, size_t* order = 0) const;
|
||||
ssize_t _indexOrderOf(const void* item, size_t* order = nullptr) const;
|
||||
|
||||
// these are made private, because they can't be used on a SortedVector
|
||||
// (they don't have an implementation either)
|
||||
|
|
Loading…
Reference in a new issue