diff --git a/Fault.cpp b/Fault.c similarity index 83% rename from Fault.cpp rename to Fault.c index 2b8175a..9b63696 100644 --- a/Fault.cpp +++ b/Fault.c @@ -1,6 +1,6 @@ #include "Fault.h" #include -#if WIN32 +#if defined(_WIN32) || defined(_WIN64) #include "windows.h" #endif @@ -9,10 +9,9 @@ //---------------------------------------------------------------------------- void FaultHandler(const char* file, unsigned short line) { -#if WIN32 +#if defined(_WIN32) || defined(_WIN64) // If you hit this line, it means one of the ASSERT macros failed. DebugBreak(); #endif - assert(0); -} \ No newline at end of file +} diff --git a/LockGuard.cpp b/LockGuard.cpp deleted file mode 100644 index 3322cef..0000000 --- a/LockGuard.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include "LockGuard.h" -#include "Fault.h" -#include - -// A lock is a mutex -#define LOCK std::mutex - -//------------------------------------------------------------------------------ -// LK_Create -//------------------------------------------------------------------------------ -LOCK_HANDLE LK_Create(void) -{ - LOCK* lock = new LOCK; - return lock; -} - -//------------------------------------------------------------------------------ -// LK_Destroy -//------------------------------------------------------------------------------ -void LK_Destroy(LOCK_HANDLE hLock) -{ - ASSERT_TRUE(hLock); - LOCK* lock = (LOCK*)(hLock); - delete lock; -} - -//------------------------------------------------------------------------------ -// LK_Lock -//------------------------------------------------------------------------------ -void LK_Lock(LOCK_HANDLE hLock) -{ - ASSERT_TRUE(hLock); - LOCK* lock = (LOCK*)(hLock); - lock->lock(); -} - -//------------------------------------------------------------------------------ -// LK_Unlock -//------------------------------------------------------------------------------ -void LK_Unlock(LOCK_HANDLE hLock) -{ - ASSERT_TRUE(hLock); - LOCK* lock = (LOCK*)(hLock); - lock->unlock(); -} - diff --git a/LockGuard.h b/LockGuard.h deleted file mode 100644 index a823842..0000000 --- a/LockGuard.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef _LOCK_GUARD_H -#define _LOCK_GUARD_H - -#include "DataTypes.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef void* LOCK_HANDLE; - -#define LK_CREATE() LK_Create() -#define LK_DESTROY(h) LK_Destroy(h) -#define LK_LOCK(h) LK_Lock(h) -#define LK_UNLOCK(h) LK_Unlock(h) - -LOCK_HANDLE LK_Create(void); -void LK_Destroy(LOCK_HANDLE hLock); -void LK_Lock(LOCK_HANDLE hLock); -void LK_Unlock(LOCK_HANDLE hLock); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/VS2017/VS2017.sln b/VS2017/VS2017.sln deleted file mode 100644 index c24b66a..0000000 --- a/VS2017/VS2017.sln +++ /dev/null @@ -1,31 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27428.2015 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VS2017", "VS2017\VS2017.vcxproj", "{FC0C81FB-FB80-4AB2-8D05-F281706DBCBD}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {FC0C81FB-FB80-4AB2-8D05-F281706DBCBD}.Debug|x64.ActiveCfg = Debug|x64 - {FC0C81FB-FB80-4AB2-8D05-F281706DBCBD}.Debug|x64.Build.0 = Debug|x64 - {FC0C81FB-FB80-4AB2-8D05-F281706DBCBD}.Debug|x86.ActiveCfg = Debug|Win32 - {FC0C81FB-FB80-4AB2-8D05-F281706DBCBD}.Debug|x86.Build.0 = Debug|Win32 - {FC0C81FB-FB80-4AB2-8D05-F281706DBCBD}.Release|x64.ActiveCfg = Release|x64 - {FC0C81FB-FB80-4AB2-8D05-F281706DBCBD}.Release|x64.Build.0 = Release|x64 - {FC0C81FB-FB80-4AB2-8D05-F281706DBCBD}.Release|x86.ActiveCfg = Release|Win32 - {FC0C81FB-FB80-4AB2-8D05-F281706DBCBD}.Release|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {2CEEB38F-D866-4555-B24B-766DE3B07B79} - EndGlobalSection -EndGlobal diff --git a/VS2017/VS2017/VS2017.vcxproj b/VS2017/VS2017/VS2017.vcxproj deleted file mode 100644 index c504d94..0000000 --- a/VS2017/VS2017/VS2017.vcxproj +++ /dev/null @@ -1,142 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 15.0 - {FC0C81FB-FB80-4AB2-8D05-F281706DBCBD} - VS2017 - 10.0.16299.0 - - - - Application - true - v141 - MultiByte - - - Application - false - v141 - true - MultiByte - - - Application - true - v141 - MultiByte - - - Application - false - v141 - true - MultiByte - - - - - - - - - - - - - - - - - - - - - - - Level3 - Disabled - true - true - - - - - Level3 - Disabled - true - true - - - - - Level3 - MaxSpeed - true - true - true - true - - - true - true - - - - - Level3 - MaxSpeed - true - true - true - true - - - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/VS2017/VS2017/VS2017.vcxproj.filters b/VS2017/VS2017/VS2017.vcxproj.filters deleted file mode 100644 index 3eb19e3..0000000 --- a/VS2017/VS2017/VS2017.vcxproj.filters +++ /dev/null @@ -1,75 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/fb_allocator.c b/fb_allocator.c index 67e1e8f..78a8779 100644 --- a/fb_allocator.c +++ b/fb_allocator.c @@ -3,21 +3,14 @@ #include "Fault.h" #include -// Define USE_LOCK to use the default lock implementation -#define USE_LOCKS -#ifdef USE_LOCKS - #include "LockGuard.h" - static LOCK_HANDLE _hLock; -#else - #pragma message("WARNING: Define software lock.") - typedef int LOCK_HANDLE; - static LOCK_HANDLE _hLock; - - #define LK_CREATE() (1) - #define LK_DESTROY(h) - #define LK_LOCK(h) - #define LK_UNLOCK(h) -#endif +#pragma message("WARNING: Define software lock.") +typedef int LOCK_HANDLE; +static LOCK_HANDLE _hLock; + +#define LK_CREATE() (1) +#define LK_DESTROY(h) +#define LK_LOCK(h) +#define LK_UNLOCK(h) // Get a pointer to the client's area within a memory block #define GET_CLIENT_PTR(_block_ptr_) \