From b37b8dc6397cac92d870c8ae10669cf29b57f795 Mon Sep 17 00:00:00 2001 From: Vladyslav Baranovskyi Date: Fri, 20 Dec 2024 17:02:32 +0200 Subject: [PATCH] Introduced static variables in places where the return value is a plain string --- openVulkanoCpp/Host/MacOS/SystemInfo.mm | 9 ++++++--- openVulkanoCpp/Host/Windows/SystemInfo.cpp | 3 ++- openVulkanoCpp/Host/iOS/SystemInfo.mm | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/openVulkanoCpp/Host/MacOS/SystemInfo.mm b/openVulkanoCpp/Host/MacOS/SystemInfo.mm index a5bf82f..ca295f6 100644 --- a/openVulkanoCpp/Host/MacOS/SystemInfo.mm +++ b/openVulkanoCpp/Host/MacOS/SystemInfo.mm @@ -64,7 +64,8 @@ namespace OpenVulkano const std::string& SystemInfo::GetUserName() { - return ""; + static const std::string userName = ""; + return userName; } const std::string& SystemInfo::GetHostName() @@ -81,7 +82,8 @@ namespace OpenVulkano const std::string& SystemInfo::GetDeviceVendorName() { - return "Apple"; + static const std::string vendorName = "Apple"; + return vendorName; } const std::string& SystemInfo::GetDeviceModelName() @@ -98,7 +100,8 @@ namespace OpenVulkano const std::string& SystemInfo::GetOsName() { - return "MacOS"; + static const std::string osName = "MacOS"; + return osName; } OsVersion SystemInfo::GetOsVersion() diff --git a/openVulkanoCpp/Host/Windows/SystemInfo.cpp b/openVulkanoCpp/Host/Windows/SystemInfo.cpp index 72e17ee..a7a9270 100644 --- a/openVulkanoCpp/Host/Windows/SystemInfo.cpp +++ b/openVulkanoCpp/Host/Windows/SystemInfo.cpp @@ -421,7 +421,8 @@ namespace OpenVulkano const std::string& SystemInfo::GetOsName() { - return "Windows"; + static const std::string osName = "Windows"; + return osName; } OsVersion SystemInfo::GetOsVersion() diff --git a/openVulkanoCpp/Host/iOS/SystemInfo.mm b/openVulkanoCpp/Host/iOS/SystemInfo.mm index 54efb7e..3182ba2 100644 --- a/openVulkanoCpp/Host/iOS/SystemInfo.mm +++ b/openVulkanoCpp/Host/iOS/SystemInfo.mm @@ -66,7 +66,8 @@ namespace OpenVulkano const std::string& SystemInfo::GetUserName() { - return ""; + static const std::string userName = ""; + return userName; } const std::string& SystemInfo::GetHostName() @@ -83,7 +84,8 @@ namespace OpenVulkano const std::string& SystemInfo::GetDeviceVendorName() { - return "Apple"; + static const std::string vendorName = "Apple"; + return vendorName; } const std::string& SystemInfo::GetDeviceModelName()