From e72e879ea0cc2cc3019a1b698287509f03e49819 Mon Sep 17 00:00:00 2001 From: Florian Franzmann Date: Sun, 1 Dec 2019 17:43:40 +0100 Subject: [PATCH 04/35] Cleanup: use nullptr instead of NULL --- include/Registry_impl.hpp | 4 ++-- include/bean_ptr_impl.hpp | 4 ++-- include/shared_res.h | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/Registry_impl.hpp b/include/Registry_impl.hpp index d84234f..7fcc8fa 100644 --- a/include/Registry_impl.hpp +++ b/include/Registry_impl.hpp @@ -21,7 +21,7 @@ template bean_ptr Registry::createBeanPtr(bean_key key, C* obj) { if(key.id==Database::NULL_ID) - return bean_ptr(key,NULL); + return bean_ptr(key,nullptr); real_bean* rb=new real_bean(key,obj); rb_pair* para=new rb_pair(rb); @@ -41,7 +41,7 @@ bean_ptr Registry::get(const bean_key key) typename std::map* >::iterator it; it=rbpairs.find(key); if(it==rbpairs.end()) - return createBeanPtr(key,NULL); + return createBeanPtr(key,nullptr); else return bean_ptr(key, it->second); } diff --git a/include/bean_ptr_impl.hpp b/include/bean_ptr_impl.hpp index 1bd55aa..02bd438 100644 --- a/include/bean_ptr_impl.hpp +++ b/include/bean_ptr_impl.hpp @@ -18,7 +18,7 @@ void real_bean::destroy() { Database::dbDelete(key, *obj); delete obj; forgotten=true; - obj=NULL; + obj=nullptr; key.id=Database::NULL_ID; } @@ -46,7 +46,7 @@ template C* real_bean::get() { if(forgotten) - return NULL; + return nullptr; loadLazy(); if(!obj) throw std::runtime_error("NULL pointer exception!"); diff --git a/include/shared_res.h b/include/shared_res.h index 2f6bc0b..b5d2b83 100644 --- a/include/shared_res.h +++ b/include/shared_res.h @@ -55,16 +55,16 @@ protected: } public: - inline explicit shared_res(C* tg) : res(NULL) { + inline explicit shared_res(C* tg) : res(nullptr) { if(!tg) throw std::logic_error("no reason to manage NULL object"); shared_cnt_obj_pair* share=new shared_cnt_obj_pair(tg); takeRes(share); } - inline shared_res() : res(NULL) {} + inline shared_res() : res(nullptr) {} - inline shared_res(const shared_res& x) : res(NULL) { + inline shared_res(const shared_res& x) : res(nullptr) { takeRes(x.res); } @@ -82,7 +82,7 @@ public: inline C* get_object(){ if(!res) - return NULL; + return nullptr; return res->getRes(); } @@ -103,7 +103,7 @@ public: return res