Daniele Bartolini 7 лет назад
Родитель
Сommit
11aa4ca306

+ 1 - 1
src/core/error/error.cpp

@@ -11,7 +11,7 @@
 #include <stdarg.h>
 #include <stdlib.h> // exit
 
-namespace { const crown::log_internal::System ERROR = { "error" }; }
+LOG_SYSTEM(ERROR, "error")
 
 namespace crown
 {

+ 3 - 6
src/core/memory/memory.cpp

@@ -305,12 +305,9 @@ namespace memory_globals
 {
 	using namespace memory;
 
-	static const u32 SIZE = sizeof(HeapAllocator)
-		+ sizeof(ScratchAllocator)
-		;
-	char _buffer[SIZE];
-	HeapAllocator* _default_allocator = NULL;
-	ScratchAllocator* _default_scratch_allocator = NULL;
+	static char _buffer[sizeof(HeapAllocator) + sizeof(ScratchAllocator)];
+	static HeapAllocator* _default_allocator;
+	static ScratchAllocator* _default_scratch_allocator;
 
 	void init()
 	{

+ 1 - 0
src/core/unit_tests.cpp

@@ -33,6 +33,7 @@
 #include "core/strings/string.h"
 #include "core/strings/string_id.h"
 #include "core/thread/thread.h"
+#include "core/time.h"
 #include <stdlib.h> // EXIT_SUCCESS, EXIT_FAILURE
 
 #define ENSURE(condition)                                \

+ 1 - 1
src/device/device.cpp

@@ -60,7 +60,7 @@
 
 #define MAX_SUBSYSTEMS_HEAP 8 * 1024 * 1024
 
-namespace { const crown::log_internal::System DEVICE = { "device" }; }
+LOG_SYSTEM(DEVICE, "device")
 
 namespace crown
 {

+ 2 - 0
src/device/log.h

@@ -44,3 +44,5 @@ namespace log_internal
 #define logi(system, msg, ...) crown::log_internal::logx(crown::LogSeverity::LOG_INFO, system, msg, ## __VA_ARGS__)
 #define loge(system, msg, ...) crown::log_internal::logx(crown::LogSeverity::LOG_ERROR, system, msg, ## __VA_ARGS__)
 #define logw(system, msg, ...) crown::log_internal::logx(crown::LogSeverity::LOG_WARN, system, msg, ## __VA_ARGS__)
+
+#define LOG_SYSTEM(ident, name) namespace { const crown::log_internal::System ident = { name }; }

+ 1 - 1
src/lua/lua_environment.cpp

@@ -15,7 +15,7 @@
 #include "resource/resource_manager.h"
 #include <stdarg.h>
 
-namespace { const crown::log_internal::System LUA = { "lua" }; }
+LOG_SYSTEM(LUA, "lua")
 
 namespace crown
 {

+ 1 - 1
src/resource/data_compiler.cpp

@@ -40,7 +40,7 @@
 #include "resource/unit_resource.h"
 #include <algorithm>
 
-namespace { const crown::log_internal::System DATA_COMPILER = { "data_compiler" }; }
+LOG_SYSTEM(DATA_COMPILER, "data_compiler")
 
 namespace crown
 {

+ 1 - 1
src/resource/resource_loader.cpp

@@ -16,7 +16,7 @@
 #include "device/log.h"
 #include "resource/resource_loader.h"
 
-namespace { const crown::log_internal::System RESOURCE_LOADER = { "resource_loader" }; }
+LOG_SYSTEM(RESOURCE_LOADER, "resource_loader")
 
 namespace crown
 {

+ 1 - 1
src/world/physics_world_bullet.cpp

@@ -46,7 +46,7 @@
 #include <LinearMath/btDefaultMotionState.h>
 #include <LinearMath/btIDebugDraw.h>
 
-namespace { const crown::log_internal::System PHYSICS = { "physics" }; }
+LOG_SYSTEM(PHYSICS, "physics")
 
 namespace crown
 {

+ 1 - 1
src/world/sound_world_al.cpp

@@ -18,7 +18,7 @@
 #include <AL/al.h>
 #include <AL/alc.h>
 
-namespace { const crown::log_internal::System SOUND = { "sound" }; }
+LOG_SYSTEM(SOUND, "sound")
 
 namespace crown
 {