Skip to content

Commit 66c5528

Browse files
committed
lib: cmetrics: reduced windows.h include to avoid conflicts
Signed-off-by: Marat Abrarov <abrarov@gmail.com>
1 parent d24d46b commit 66c5528

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

lib/cmetrics/include/cmetrics/cmt_compat.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@
2222

2323
#include <time.h>
2424
#ifdef _WIN32
25+
#ifndef WIN32_LEAN_AND_MEAN
26+
#define WIN32_LEAN_AND_MEAN
2527
#include <windows.h>
28+
#undef WIN32_LEAN_AND_MEAN
29+
#else
30+
#include <windows.h>
31+
#endif
2632
#endif
2733

2834
static inline struct tm *cmt_platform_gmtime_r(const time_t *timep, struct tm *result)

lib/cmetrics/src/cmt_atomic_msvc.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@
1818
*/
1919

2020
#include <cmetrics/cmt_atomic.h>
21+
#ifndef WIN32_LEAN_AND_MEAN
22+
#define WIN32_LEAN_AND_MEAN
2123
#include <windows.h>
24+
#undef WIN32_LEAN_AND_MEAN
25+
#else
26+
#include <windows.h>
27+
#endif
2228

2329
/* This allows cmt_atomic_initialize to be automatically called
2430
* as soon as the program starts if enabled.

0 commit comments

Comments
 (0)