summaryrefslogtreecommitdiff
path: root/src/os
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2019-03-17 15:14:17 +0100
committerMichael Lutz <michi@icosahedron.de>2019-04-06 11:27:39 +0200
commit967b27a2c12953da3584f4eaade37f94effc007a (patch)
treeea2daf0e2abb3a861a467575636353f3d183a75e /src/os
parentae748166d06e756a0a6abab582dc341494a9b2da (diff)
downloadopenttd-967b27a2c12953da3584f4eaade37f94effc007a.tar.xz
Codechange: C++11 STL has a function for getting the number of CPU cores.
Diffstat (limited to 'src/os')
-rw-r--r--src/os/macosx/macos.mm17
-rw-r--r--src/os/os2/os2.cpp5
-rw-r--r--src/os/unix/unix.cpp29
-rw-r--r--src/os/windows/win32.cpp8
4 files changed, 0 insertions, 59 deletions
diff --git a/src/os/macosx/macos.mm b/src/os/macosx/macos.mm
index 7fb71fe9e..ae9d86ee8 100644
--- a/src/os/macosx/macos.mm
+++ b/src/os/macosx/macos.mm
@@ -206,23 +206,6 @@ bool GetClipboardContents(char *buffer, const char *last)
}
#endif
-uint GetCPUCoreCount()
-{
- uint count = 1;
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
- if (MacOSVersionIsAtLeast(10, 5, 0)) {
- count = (uint)[ [ NSProcessInfo processInfo ] activeProcessorCount ];
- } else
-#endif
- {
-#if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
- count = MPProcessorsScheduled();
-#endif
- }
-
- return count;
-}
-
/**
* Check if a font is a monospace font.
* @param name Name of the font.
diff --git a/src/os/os2/os2.cpp b/src/os/os2/os2.cpp
index b62e83e5e..70c75a410 100644
--- a/src/os/os2/os2.cpp
+++ b/src/os/os2/os2.cpp
@@ -208,11 +208,6 @@ bool GetClipboardContents(char *buffer, const char *last)
const char *FS2OTTD(const char *name) {return name;}
const char *OTTD2FS(const char *name) {return name;}
-uint GetCPUCoreCount()
-{
- return 1;
-}
-
void OSOpenBrowser(const char *url)
{
// stub only
diff --git a/src/os/unix/unix.cpp b/src/os/unix/unix.cpp
index e20a6c1b5..aa63019f6 100644
--- a/src/os/unix/unix.cpp
+++ b/src/os/unix/unix.cpp
@@ -274,35 +274,6 @@ bool GetClipboardContents(char *buffer, const char *last)
#ifndef __APPLE__
-uint GetCPUCoreCount()
-{
- uint count = 1;
-#ifdef HAS_SYSCTL
- int ncpu = 0;
- size_t len = sizeof(ncpu);
-
-#ifdef OPENBSD
- int name[2];
- name[0] = CTL_HW;
- name[1] = HW_NCPU;
- if (sysctl(name, 2, &ncpu, &len, NULL, 0) < 0) {
- ncpu = 0;
- }
-#else
- if (sysctlbyname("hw.availcpu", &ncpu, &len, NULL, 0) < 0) {
- sysctlbyname("hw.ncpu", &ncpu, &len, NULL, 0);
- }
-#endif /* #ifdef OPENBSD */
-
- if (ncpu > 0) count = ncpu;
-#elif defined(_SC_NPROCESSORS_ONLN)
- long res = sysconf(_SC_NPROCESSORS_ONLN);
- if (res > 0) count = res;
-#endif
-
- return count;
-}
-
void OSOpenBrowser(const char *url)
{
pid_t child_pid = fork();
diff --git a/src/os/windows/win32.cpp b/src/os/windows/win32.cpp
index 9847de567..d2cc434a2 100644
--- a/src/os/windows/win32.cpp
+++ b/src/os/windows/win32.cpp
@@ -725,14 +725,6 @@ const char *GetCurrentLocale(const char *)
return retbuf;
}
-uint GetCPUCoreCount()
-{
- SYSTEM_INFO info;
-
- GetSystemInfo(&info);
- return info.dwNumberOfProcessors;
-}
-
static WCHAR _cur_iso_locale[16] = L"";