Modernize codebase by replacing NULL with nullptr Fixes -Wzero-as-null-pointer-constant warning for binder. Test: m Bug: 68236239 Change-Id: I8184bd6aa4ebff1bd8c88dad16886e98df853b03
diff --git a/libutils/include/utils/Singleton.h b/libutils/include/utils/Singleton.h index 2dd5a47..44d8ad7 100644 --- a/libutils/include/utils/Singleton.h +++ b/libutils/include/utils/Singleton.h
@@ -51,7 +51,7 @@ 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 @@ static bool hasInstance() { Mutex::Autolock _l(sLock); - return sInstance != 0; + return sInstance != nullptr; } protected: @@ -90,7 +90,7 @@ #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 >;