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 1, 2024
1 parent ac590fe commit cc61467
Show file tree
Hide file tree
Showing 2 changed files with 14 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
13 changes: 13 additions & 0 deletions AK/windows.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright (c) 2024, stasoid <stasoid@yahoo.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/

#pragma once

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

0 comments on commit cc61467

Please sign in to comment.