Skip to content

Commit

Permalink
AK: Simplify usage of windows.h and winsock2.h
Browse files Browse the repository at this point in the history
Use <AK/Windows.h> instead of windows.h/winsock2.h
to avoid timeval-related errors.

Note: winsock2.h includes windows.h
  • Loading branch information
stasoid committed Dec 9, 2024
1 parent ac590fe commit a36425f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
4 changes: 1 addition & 3 deletions AK/Time.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
#include <AK/Time.h>

#ifdef AK_OS_WINDOWS
# define timeval dummy_timeval
# include <windows.h>
# undef timeval
# include <AK/Windows.h>
#endif

namespace AK {
Expand Down
16 changes: 16 additions & 0 deletions AK/Windows.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright (c) 2024, stasoid <stasoid@yahoo.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/

#pragma once

#include <AK/Platform.h>

#ifdef AK_OS_WINDOWS // needed for Swift
# define timeval dummy_timeval
# include <winsock2.h>
# undef timeval
# include <io.h>
#endif

0 comments on commit a36425f

Please sign in to comment.