From c7d380c4b0f63e5150530dfac0ef969713f1de8e Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Mon, 12 Sep 2022 21:12:32 +0200 Subject: [PATCH] source/Platform/PlatformApplication: rename create() to get() and just return a statically allocated implementation. As we just this throughout the whole program. and platform can be determined at compile time. we might as well allocate it statically. --- source/Platform/PlatformApplication.cpp | 5 +++-- source/Platform/PlatformApplication.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/source/Platform/PlatformApplication.cpp b/source/Platform/PlatformApplication.cpp index f50e54b..21148f5 100644 --- a/source/Platform/PlatformApplication.cpp +++ b/source/Platform/PlatformApplication.cpp @@ -13,9 +13,10 @@ typedef sp::UnixApplication ApplicationImpl; namespace sp { -PlatformApplication* PlatformApplication::create() +PlatformApplication* PlatformApplication::get() { - return new ApplicationImpl; + static ApplicationImpl inst; + return &inst; } } // namespace sp diff --git a/source/Platform/PlatformApplication.h b/source/Platform/PlatformApplication.h index d59046d..cfd3331 100644 --- a/source/Platform/PlatformApplication.h +++ b/source/Platform/PlatformApplication.h @@ -13,7 +13,7 @@ class MessageQueue; class PlatformApplication : NonCopyable { public : - static PlatformApplication* create(); + static PlatformApplication* get(); virtual void init() = 0;