Commit adf3a436 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh
Browse files

Utils: Avoid multiple calls to GetNativeSystemInfo on Windows



In fact, hostArchitecture is only called on MSVC auto-detection, which
is only done on startup.

On the other hand, all the other functions in HostOsInfo are independent
on external calls, so adapt this one in case it is used in the future.

Change-Id: I4646d87cb3b976e358276482cad1b14bfc430964
Reviewed-by: default avatarhjk <hjk@theqtcompany.com>
Reviewed-by: default avatarEike Ziller <eike.ziller@theqtcompany.com>
Reviewed-by: default avatarDavid Schulz <david.schulz@theqtcompany.com>
parent 9bcb9330
......@@ -38,12 +38,20 @@
using namespace Utils;
HostOsInfo::HostArchitecture HostOsInfo::hostArchitecture()
{
#ifdef Q_OS_WIN
static WORD hostProcessorArchitecture()
{
SYSTEM_INFO info;
GetNativeSystemInfo(&info);
switch (info.wProcessorArchitecture) {
return info.wProcessorArchitecture;
}
#endif
HostOsInfo::HostArchitecture HostOsInfo::hostArchitecture()
{
#ifdef Q_OS_WIN
static const WORD processorArchitecture = hostProcessorArchitecture();
switch (processorArchitecture) {
case PROCESSOR_ARCHITECTURE_AMD64:
return HostOsInfo::HostArchitectureAMD64;
case PROCESSOR_ARCHITECTURE_INTEL:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment