From 82a0ba98fc8a2f53c334f77cc6504fc8d34fd83f 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 | 14 ++++++++++++++ 2 files changed, 15 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..052bda0c33396 --- /dev/null +++ b/AK/windows.h @@ -0,0 +1,14 @@ +/* + * 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 +# include +#endif