From cc6146756dcf50b28526aac7cba3c7f5a89b3f53 Mon Sep 17 00:00:00 2001 From: stasoid Date: Sun, 1 Dec 2024 14:43:10 +0500 Subject: [PATCH] AK: Simplify usage of windows.h and winsock2.h Use instead of windows.h/winsock2.h to avoid timeval-related errors. Note: winsock2.h includes windows.h --- AK/Time.cpp | 4 +--- AK/windows.h | 13 +++++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 AK/windows.h diff --git a/AK/Time.cpp b/AK/Time.cpp index 923f6404da6a2..093fd5e10373f 100644 --- a/AK/Time.cpp +++ b/AK/Time.cpp @@ -8,9 +8,7 @@ #include #ifdef AK_OS_WINDOWS -# define timeval dummy_timeval -# include -# undef timeval +# include #endif namespace AK { diff --git a/AK/windows.h b/AK/windows.h new file mode 100644 index 0000000000000..0b44e6df3bee7 --- /dev/null +++ b/AK/windows.h @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2024, stasoid + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#ifdef AK_OS_WINDOWS // needed for Swift +# define timeval dummy_timeval +# include +# undef timeval +#endif