macOS support

This commit is contained in:
Mārtiņš Možeiko
2021-11-14 17:24:46 -08:00
parent b07e706dfb
commit 08bfd28169
3 changed files with 12 additions and 5 deletions
+8 -4
View File
@@ -276,7 +276,7 @@ MD_WIN32_Release(void *ptr, MD_u64 size)
////////////////////////////////////////////////////////////////////////////////
//- linux headers
#if (MD_DEFAULT_FILE_ITER || MD_DEFAULT_MEMORY) && MD_OS_LINUX
#if (MD_DEFAULT_FILE_ITER || MD_DEFAULT_MEMORY) && (MD_OS_LINUX || MD_OS_MAC)
# include <dirent.h>
# include <sys/stat.h>
# include <fcntl.h>
@@ -288,8 +288,12 @@ MD_WIN32_Release(void *ptr, MD_u64 size)
# ifndef O_PATH
# define O_PATH 010000000
# endif
# define AT_NO_AUTOMOUNT 0x800
# define AT_SYMLINK_NOFOLLOW 0x100
# ifndef AT_NO_AUTOMOUNT
# define AT_NO_AUTOMOUNT 0x800
# endif
# ifndef AT_SYMLINK_NOFOLLOW
# define AT_SYMLINK_NOFOLLOW 0x100
# endif
#endif
//- linux "file iteration"
@@ -361,7 +365,7 @@ MD_LINUX_FileIterIncrement(MD_Arena *arena, MD_FileIter *opaque_it, MD_String8 p
#endif
//- linux "low level memory"
#if MD_DEFAULT_MEMORY && MD_OS_LINUX
#if MD_DEFAULT_MEMORY && (MD_OS_LINUX || MD_OS_MAC)
#if !defined(MD_IMPL_Reserve)
# define MD_IMPL_Reserve MD_LINUX_Reserve
+1 -1
View File
@@ -975,7 +975,7 @@ MD_FUNCTION MD_String8 MD_S8(MD_u8 *str, MD_u64 size);
#endif
#define MD_S8LitComp(s) {(MD_u8 *)(s), sizeof(s)-1}
#if MD_CPP_VERSION >= 11
#if MD_CPP_VERSION != 0 && MD_CPP_VERSION != 98 // anything C++11 and up
static inline MD_String8
operator "" _md(const char *s, size_t size)
{
+3
View File
@@ -11,9 +11,12 @@ int main(void)
printf("%d\n", MD_CPP_VERSION);
#if MD_CPP_VERSION != 0 && MD_CPP_VERSION != 98 // anything C++11 and up
MD_String8 foo = "foo"_md;
MD_String8 bar = "bar"_md;
MD_String8 str = MD_S8Fmt(arena, "%S%S", foo, bar);
printf("%.*s", MD_S8VArg(str));
#endif
return 0;
}