diff --git a/pcsx2/SafeArray.h b/pcsx2/SafeArray.h index 664db6fd01..e115364d09 100644 --- a/pcsx2/SafeArray.h +++ b/pcsx2/SafeArray.h @@ -29,40 +29,31 @@ extern void pcsx2_aligned_free(void* pmem); # define _aligned_realloc pcsx2_aligned_realloc #endif -////////////////////////////////////////////////////////////// -// Safe deallocation macros -- always check pointer validity (non-null) -// and set pointer to null on deallocation. +////////////////////////////////////////////////////////////////////////////////////////// +// Safe deallocation macros -- always check pointer validity (non-null) when needed, +// and set pointer to null after deallocation. #define safe_delete( ptr ) \ - if( ptr != NULL ) { \ - delete ptr; \ - ptr = NULL; \ - } + ((void) (( ( ptr != NULL ) && (delete ptr, !!0) ), ptr = NULL)) #define safe_delete_array( ptr ) \ - if( ptr != NULL ) { \ - delete[] ptr; \ - ptr = NULL; \ - } + ((void) (( ( ptr != NULL ) && (delete[] ptr, !!0) ), ptr = NULL)) +// fixme: I'm pretty sure modern libc implementations inder gcc and msvc check null status +// 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 +// all ported platforms. #define safe_free( ptr ) \ - if( ptr != NULL ) { \ - free( ptr ); \ - ptr = NULL; \ - } + ((void) (( ( ptr != NULL ) && (free( ptr ), !!0) ), ptr = NULL)) +// Implementation note: all known implementations of _aligned_free check the pointer for +// NULL status (our implementation under GCC, and microsoft's under MSVC), so no need to +// do it here. #define safe_aligned_free( ptr ) \ - if( ptr != NULL ) { \ - _aligned_free( ptr ); \ - ptr = NULL; \ - } + ( (void) ( _aligned_free( ptr ), ptr = NULL ) ) #define SafeSysMunmap( ptr, size ) \ - if( ptr != NULL ) { \ - 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 diff --git a/pcsx2/Tags.h b/pcsx2/Tags.h index 9c96fba97b..74a8f8d3f4 100644 --- a/pcsx2/Tags.h +++ b/pcsx2/Tags.h @@ -247,6 +247,6 @@ namespace QWC static __forceinline void Clear(DMACh *tag) { - tag->qwc == 0; + tag->qwc = 0; } } diff --git a/pcsx2_suite_2010.sln b/pcsx2_suite_2010.sln index c03a172e1c..cf0aab5eac 100644 --- a/pcsx2_suite_2010.sln +++ b/pcsx2_suite_2010.sln @@ -21,6 +21,15 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GSdx", "plugins\GSdx\GSdx.v EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xpad", "plugins\xpad\xpad.vcxproj", "{6F3C4136-5801-4EBC-AC6E-37DF6FAB150A}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Common", "Common", "{06C9589C-DFD3-4CE8-B69A-32208C2767B2}" + ProjectSection(SolutionItems) = preProject + common\include\afxresmw.h = common\include\afxresmw.h + common\include\Pcsx2Api.h = common\include\Pcsx2Api.h + common\include\Pcsx2Config.h = common\include\Pcsx2Config.h + common\include\Pcsx2Defs.h = common\include\Pcsx2Defs.h + common\include\Pcsx2Types.h = common\include\Pcsx2Types.h + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32