From 6a6c5e3af9b231b2ff081af8bbe07e98fec4bbfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Sat, 10 Jun 2017 22:31:59 -0700 Subject: [PATCH] Cleanup. --- examples/common/debugdraw/debugdraw.cpp | 4 +--- examples/common/entry/entry.cpp | 2 +- examples/common/imgui/imgui.cpp | 4 +--- examples/common/nanovg/nanovg_bgfx.cpp | 7 +------ examples/common/ps/particle_system.cpp | 4 +--- src/bgfx.cpp | 6 +++--- tools/geometryc/geometryc.cpp | 2 +- tools/shaderc/shaderc_spirv.cpp | 2 +- 8 files changed, 10 insertions(+), 21 deletions(-) diff --git a/examples/common/debugdraw/debugdraw.cpp b/examples/common/debugdraw/debugdraw.cpp index 51df64f52..130a807e9 100644 --- a/examples/common/debugdraw/debugdraw.cpp +++ b/examples/common/debugdraw/debugdraw.cpp @@ -380,13 +380,11 @@ struct DebugDraw m_allocator = _allocator; m_depthTestLess = _depthTestLess; -#if BX_CONFIG_ALLOCATOR_CRT if (NULL == _allocator) { - static bx::CrtAllocator allocator; + static bx::DefaultAllocator allocator; m_allocator = &allocator; } -#endif // BX_CONFIG_ALLOCATOR_CRT DebugVertex::init(); DebugUvVertex::init(); diff --git a/examples/common/entry/entry.cpp b/examples/common/entry/entry.cpp index 728a418ce..e65a04f80 100644 --- a/examples/common/entry/entry.cpp +++ b/examples/common/entry/entry.cpp @@ -95,7 +95,7 @@ namespace entry BX_PRAGMA_DIAGNOSTIC_PUSH(); BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4459); // warning C4459: declaration of 's_allocator' hides global declaration BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC("-Wshadow"); - static bx::CrtAllocator s_allocator; + static bx::DefaultAllocator s_allocator; return &s_allocator; BX_PRAGMA_DIAGNOSTIC_POP(); } diff --git a/examples/common/imgui/imgui.cpp b/examples/common/imgui/imgui.cpp index 9a828daf8..fc106dcda 100644 --- a/examples/common/imgui/imgui.cpp +++ b/examples/common/imgui/imgui.cpp @@ -493,13 +493,11 @@ struct Imgui { m_allocator = _allocator; -#if BX_CONFIG_ALLOCATOR_CRT if (NULL == _allocator) { - static bx::CrtAllocator allocator; + static bx::DefaultAllocator allocator; m_allocator = &allocator; } -#endif // BX_CONFIG_ALLOCATOR_CRT IMGUI_create(_fontSize, m_allocator); diff --git a/examples/common/nanovg/nanovg_bgfx.cpp b/examples/common/nanovg/nanovg_bgfx.cpp index c6cb4bfd4..ce0a3e250 100644 --- a/examples/common/nanovg/nanovg_bgfx.cpp +++ b/examples/common/nanovg/nanovg_bgfx.cpp @@ -1093,13 +1093,8 @@ NVGcontext* nvgCreate(int edgeaa, unsigned char _viewId, bx::AllocatorI* _alloca { if (NULL == _allocator) { -#if BX_CONFIG_ALLOCATOR_CRT - static bx::CrtAllocator allocator; + static bx::DefaultAllocator allocator; _allocator = &allocator; -#else - BX_CHECK(false, "No allocator has been passed to nvgCreate(). Either specify a bx::AllocatorI instance or enable BX_CONFIG_ALLOCATOR_CRT directive."); - return NULL; -#endif // BX_CONFIG_ALLOCATOR_CRT } struct NVGparams params; diff --git a/examples/common/ps/particle_system.cpp b/examples/common/ps/particle_system.cpp index fdc945b61..26f48c7ee 100644 --- a/examples/common/ps/particle_system.cpp +++ b/examples/common/ps/particle_system.cpp @@ -494,13 +494,11 @@ namespace ps { m_allocator = _allocator; -#if BX_CONFIG_ALLOCATOR_CRT if (NULL == _allocator) { - static bx::CrtAllocator allocator; + static bx::DefaultAllocator allocator; m_allocator = &allocator; } -#endif // BX_CONFIG_ALLOCATOR_CRT m_emitterAlloc = bx::createHandleAlloc(m_allocator, _maxEmitters); m_emitter = (Emitter*)BX_ALLOC(m_allocator, sizeof(Emitter)*_maxEmitters); diff --git a/src/bgfx.cpp b/src/bgfx.cpp index 5ea76e51a..718251cdc 100644 --- a/src/bgfx.cpp +++ b/src/bgfx.cpp @@ -2596,7 +2596,7 @@ namespace bgfx } else { - bx::CrtAllocator allocator; + bx::DefaultAllocator allocator; g_allocator = s_allocatorStub = BX_NEW(&allocator, AllocatorStub); } @@ -2676,7 +2676,7 @@ error: if (NULL != s_allocatorStub) { - bx::CrtAllocator allocator; + bx::DefaultAllocator allocator; BX_DELETE(&allocator, s_allocatorStub); s_allocatorStub = NULL; } @@ -2716,7 +2716,7 @@ error: if (NULL != s_allocatorStub) { - bx::CrtAllocator allocator; + bx::DefaultAllocator allocator; BX_DELETE(&allocator, s_allocatorStub); s_allocatorStub = NULL; } diff --git a/tools/geometryc/geometryc.cpp b/tools/geometryc/geometryc.cpp index a3c4717d6..56408080c 100644 --- a/tools/geometryc/geometryc.cpp +++ b/tools/geometryc/geometryc.cpp @@ -865,7 +865,7 @@ int main(int _argc, const char* _argv[]) uint32_t positionOffset = decl.getOffset(bgfx::Attrib::Position); uint32_t color0Offset = decl.getOffset(bgfx::Attrib::Color0); - bx::CrtAllocator crtAllocator; + bx::DefaultAllocator crtAllocator; bx::MemoryBlock memBlock(&crtAllocator); uint32_t ii = 0; diff --git a/tools/shaderc/shaderc_spirv.cpp b/tools/shaderc/shaderc_spirv.cpp index 6848fa1d4..652cfeb73 100644 --- a/tools/shaderc/shaderc_spirv.cpp +++ b/tools/shaderc/shaderc_spirv.cpp @@ -17,7 +17,7 @@ BX_PRAGMA_DIAGNOSTIC_POP() namespace bgfx { - static bx::CrtAllocator s_allocator; + static bx::DefaultAllocator s_allocator; bx::AllocatorI* g_allocator = &s_allocator; struct TinyStlAllocator