diff options
author | Lioncash <mathew1800@gmail.com> | 2014-08-17 20:08:39 +0200 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2014-08-17 20:08:43 +0200 |
commit | cc9f352b669e7d8ef136b286b9ab5b5c93324111 (patch) | |
tree | 55e8dd7b61f344f6a89250714b47e7e2e3e9474f | |
parent | Merge pull request #47 from archshift/stdstring (diff) | |
download | yuzu-cc9f352b669e7d8ef136b286b9ab5b5c93324111.tar yuzu-cc9f352b669e7d8ef136b286b9ab5b5c93324111.tar.gz yuzu-cc9f352b669e7d8ef136b286b9ab5b5c93324111.tar.bz2 yuzu-cc9f352b669e7d8ef136b286b9ab5b5c93324111.tar.lz yuzu-cc9f352b669e7d8ef136b286b9ab5b5c93324111.tar.xz yuzu-cc9f352b669e7d8ef136b286b9ab5b5c93324111.tar.zst yuzu-cc9f352b669e7d8ef136b286b9ab5b5c93324111.zip |
-rw-r--r-- | src/common/memory_util.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/common/memory_util.cpp b/src/common/memory_util.cpp index 71ef159c3..5cc869aea 100644 --- a/src/common/memory_util.cpp +++ b/src/common/memory_util.cpp @@ -51,14 +51,14 @@ void* AllocateExecutableMemory(size_t size, bool low) // printf("Mapped executable memory at %p (size %ld)\n", ptr, // (unsigned long)size); -#if defined(__FreeBSD__) - if (ptr == MAP_FAILED) +#ifdef _WIN32 + if (ptr == nullptr) { - ptr = NULL; #else - if (ptr == NULL) + if (ptr == MAP_FAILED) { -#endif + ptr = nullptr; +#endif PanicAlert("Failed to allocate executable memory"); } #if !defined(_WIN32) && defined(__x86_64__) && !defined(MAP_32BIT) @@ -88,6 +88,9 @@ void* AllocateMemoryPages(size_t size) #else void* ptr = mmap(0, size, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0); + + if (ptr == MAP_FAILED) + ptr = nullptr; #endif // printf("Mapped memory at %p (size %ld)\n", ptr, |