Remove some always-true conditions (versions not supported anymore)

This commit is contained in:
Geod24 2020-08-31 21:10:39 +09:00 committed by Mathias LANG
parent e564bba215
commit 26060a6e0b
4 changed files with 6 additions and 32 deletions

View file

@ -191,13 +191,7 @@ final class PosixEventDriverCore(Loop : PosixEventLoop, Timers : EventDriverTime
m_events = events;
m_processes = processes;
m_wakeupEvent = events.createInternal();
static if (__VERSION__ >= 2074)
m_threadCallbackMutex = mallocT!(shared(Mutex));
else {
() @trusted { m_threadCallbackMutex = cast(shared)mallocT!Mutex; } ();
}
m_threadCallbackMutex = mallocT!(shared(Mutex));
m_threadCallbacks = mallocT!(ConsumableQueue!ThreadCallbackEntry);
m_threadCallbacks.reserve(1000);
}

View file

@ -42,13 +42,7 @@ version (linux) {
static if (!is(typeof(SOCK_CLOEXEC)))
enum SOCK_CLOEXEC = 0x80000;
static if (__VERSION__ < 2077)
{
enum IP_ADD_MEMBERSHIP = 35;
enum IP_MULTICAST_LOOP = 34;
}
else
import core.sys.linux.netinet.in_ : IP_ADD_MEMBERSHIP, IP_MULTICAST_LOOP;
import core.sys.linux.netinet.in_ : IP_ADD_MEMBERSHIP, IP_MULTICAST_LOOP;
// Linux-specific TCP options
// https://github.com/torvalds/linux/blob/master/include/uapi/linux/tcp.h#L95
@ -65,18 +59,12 @@ version (linux) {
enum TCP_USER_TIMEOUT = 18;
}
version (OSX) {
static if (__VERSION__ < 2077) {
enum IP_ADD_MEMBERSHIP = 12;
enum IP_MULTICAST_LOOP = 11;
} else import core.sys.darwin.netinet.in_ : IP_ADD_MEMBERSHIP, IP_MULTICAST_LOOP;
import core.sys.darwin.netinet.in_ : IP_ADD_MEMBERSHIP, IP_MULTICAST_LOOP;
static if (!is(typeof(ESHUTDOWN))) enum ESHUTDOWN = 58;
}
version (FreeBSD) {
static if (__VERSION__ < 2077) {
enum IP_ADD_MEMBERSHIP = 12;
enum IP_MULTICAST_LOOP = 11;
} else import core.sys.freebsd.netinet.in_ : IP_ADD_MEMBERSHIP, IP_MULTICAST_LOOP;
import core.sys.freebsd.netinet.in_ : IP_ADD_MEMBERSHIP, IP_MULTICAST_LOOP;
}
version (DragonFlyBSD) {
import core.sys.dragonflybsd.netinet.in_ : IP_ADD_MEMBERSHIP, IP_MULTICAST_LOOP;

View file

@ -13,10 +13,7 @@ version (Posix) {
import core.sys.posix.unistd;
}
version (Windows) {
static if (__VERSION__ >= 2070)
import core.sys.windows.stat;
else
import std.c.windows.stat;
import core.sys.windows.stat;
private {
// TODO: use CreateFile/HANDLE instead of the Posix API on Windows

View file

@ -45,12 +45,7 @@ final class WinAPIEventDriverCore : EventDriverCore {
m_fileCompletionEvent = () @trusted { return CreateEventW(null, false, false, null); } ();
registerEvent(m_fileCompletionEvent);
m_ioEvents = mallocT!(ConsumableQueue!IOEvent);
static if (__VERSION__ >= 2074)
m_threadCallbackMutex = mallocT!(shared(Mutex));
else {
() @trusted { m_threadCallbackMutex = cast(shared)mallocT!Mutex; } ();
}
m_threadCallbackMutex = mallocT!(shared(Mutex));
m_threadCallbacks = mallocT!(ConsumableQueue!ThreadCallbackEntry);
m_threadCallbacks.reserve(1000);
}