From 9a898f5d493e8de7ca928d78410685c642cbe804 Mon Sep 17 00:00:00 2001 From: LoRd_MuldeR Date: Sat, 11 May 2019 21:04:53 +0200 Subject: [PATCH] Yet another small improvements to library initialization code. --- include/MUtils/Global.h | 8 ++------ src/Global.cpp | 8 +++----- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/include/MUtils/Global.h b/include/MUtils/Global.h index f01f86b..41e1180 100644 --- a/include/MUtils/Global.h +++ b/include/MUtils/Global.h @@ -41,10 +41,6 @@ template class QHash; //Interface version #define MUTILS_INTERFACE 2 -//Build key -#define MUTILS_BUILD_KEY_HELPER(X,Y) X##" "##Y -#define MUTILS_BUILD_KEY MUTILS_BUILD_KEY_HELPER(__DATE__, __TIME__) - //MUtils API #ifdef _MSC_VER # ifdef MUTILS_DLL_EXPORT @@ -370,8 +366,8 @@ namespace MUtils //Internal (do *not* call directly!) namespace Internal { - MUTILS_API int MUTILS_INITIALIZER(const unsigned int interfaceId, const bool debugFlag, const char *const buildKey); - static const int s_initializedFlag = MUTILS_INITIALIZER(MUTILS_INTERFACE, MUTILS_DEBUG, MUTILS_BUILD_KEY); + MUTILS_API unsigned int MUTILS_INITIALIZER(const unsigned int interfaceId); + static const unsigned int init_flag = MUTILS_INITIALIZER(MUTILS_INTERFACE); } } diff --git a/src/Global.cpp b/src/Global.cpp index bf45e59..92d8a3f 100644 --- a/src/Global.cpp +++ b/src/Global.cpp @@ -905,16 +905,14 @@ MUtils::fp_parts_t MUtils::break_fp(const double value) // INITIALIZER /////////////////////////////////////////////////////////////////////////////// -int MUtils::Internal::MUTILS_INITIALIZER(const unsigned int interfaceId, const bool debugFlag, const char *const buildKey) +unsigned int MUtils::Internal::MUTILS_INITIALIZER(const unsigned int interfaceId) { -#if (!MUTILS_DEBUG) - if((interfaceId != static_cast(MUTILS_INTERFACE)) || (debugFlag != static_cast(MUTILS_DEBUG)) || strncmp(buildKey, MUTILS_BUILD_KEY, 14)) + if(interfaceId != ((unsigned int)MUTILS_INTERFACE)) { OS::system_message_err(L"MUtils", L"ERROR: MUtils library initialization has failed!"); for(;;) _exit((int)0xC0000142); } -#endif //MUTILS_DEBUG - volatile int _result = MUTILS_INTERFACE; + volatile unsigned int _result = MUTILS_INTERFACE; return _result; } -- 2.11.0