mirror of https://github.com/zeldaret/botw.git
ksys: Remove unnecessary null checks in SafeDelete
Deleting a null pointer has no effect -- the compiler automatically inserts a null pointer check.
This commit is contained in:
parent
808b21530a
commit
5f92a7b959
|
|
@ -9,8 +9,7 @@ namespace ksys::util {
|
|||
/// It is safe for the pointer to be already nullptr.
|
||||
template <typename T>
|
||||
inline void safeDelete(T*& pointer) {
|
||||
if (pointer)
|
||||
delete pointer;
|
||||
delete pointer;
|
||||
pointer = nullptr;
|
||||
}
|
||||
|
||||
|
|
@ -19,8 +18,7 @@ inline void safeDelete(T*& pointer) {
|
|||
/// It is safe for the pointer to be already nullptr.
|
||||
template <typename T>
|
||||
inline void safeDeleteArray(T*& pointer) {
|
||||
if (pointer)
|
||||
delete[] pointer;
|
||||
delete[] pointer;
|
||||
pointer = nullptr;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue