Removed duplicate null checks on safe_delete.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1643 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2009-08-17 09:52:50 +00:00
parent e08c2cc57d
commit fc35912a52
1 changed files with 7 additions and 7 deletions

View File

@ -30,16 +30,16 @@ extern void pcsx2_aligned_free(void* pmem);
#endif #endif
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// Safe deallocation macros -- always check pointer validity (non-null) when needed, // Safe deallocation macros -- checks pointer validity (non-null) when needed, and sets
// and set pointer to null after deallocation. // pointer to null after deallocation.
#define safe_delete( ptr ) \ #define safe_delete( ptr ) \
((void) (( ( ptr != NULL ) && (delete ptr, !!0) ), ptr = NULL)) ((void) (delete ptr), ptr = NULL)
#define safe_delete_array( ptr ) \ #define safe_delete_array( ptr ) \
((void) (( ( ptr != NULL ) && (delete[] ptr, !!0) ), ptr = NULL)) ((void) (delete[] ptr), ptr = NULL)
// fixme: I'm pretty sure modern libc implementations inder gcc and msvc check null status // fixme: I'm pretty sure modern libc implementations under gcc and msvc check null status
// inside free(), meaning we shouldn't have to do it ourselves. But legacy implementations // inside free(), meaning we shouldn't have to do it ourselves. But legacy implementations
// didn't always check, so best to be cautious unless absolutely certain it's being covered on // didn't always check, so best to be cautious unless absolutely certain it's being covered on
// all ported platforms. // all ported platforms.
@ -50,10 +50,10 @@ extern void pcsx2_aligned_free(void* pmem);
// NULL status (our implementation under GCC, and microsoft's under MSVC), so no need to // NULL status (our implementation under GCC, and microsoft's under MSVC), so no need to
// do it here. // do it here.
#define safe_aligned_free( ptr ) \ #define safe_aligned_free( ptr ) \
( (void) ( _aligned_free( ptr ), ptr = NULL ) ) ((void) ( _aligned_free( ptr ), ptr = NULL ))
#define SafeSysMunmap( ptr, size ) \ #define SafeSysMunmap( ptr, size ) \
( (void) ( HostSys::Munmap( (uptr)ptr, size ), ptr = NULL ) ) ((void) ( HostSys::Munmap( (uptr)ptr, size ), ptr = NULL ))
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// Handy little class for allocating a resizable memory block, complete with // Handy little class for allocating a resizable memory block, complete with