Skip to content

Commit 3d65fb3

Browse files
committed
stb_decompress: avoid "malloc.h not found" on macOS
malloc.h is a Glibc-specified header, which is not available on macOS. For malloc(), use stdlib.h instead, on macOS.
1 parent b0e6057 commit 3d65fb3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/stb_decompress.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
//-----------------------------------------------------------------------------
1616

1717
#include <assert.h>
18-
#include <malloc.h>
18+
#if defined(__linux__) || defined(__GLIBC__)
19+
# include <malloc.h> // Linux
20+
#else
21+
# include <stdlib.h> // macOS / *BSD
22+
#endif
1923
#include <memory.h>
2024

2125
//=========================================================

0 commit comments

Comments
 (0)