Revert "Fixes #12187 (#12321)" (#12447)

This reverts commit 00c31e8766.
This commit is contained in:
Andreas Rumpf 2019-10-18 15:59:22 +02:00 • committed by GitHub
commit 889b745b2b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 21 additions and 44 deletions

View file

@ -153,7 +153,7 @@ elif defined(nintendoswitch):
# size, as well as space to store our structure
let realSize = alignSize(size + sizeof(NSwitchBlock))
let heap = memalign(PageSize, realSize.csize)
let heap = memalign(PageSize, realSize)
if heap.isNil:
outOfMemoryStmt
@ -221,18 +221,18 @@ elif defined(posix):
proc munmap(adr: pointer, len: csize): cint {.header: "<sys/mman.h>".}
proc osAllocPages(size: int): pointer {.inline.} =
result = mmap(nil, csize size, PROT_READ or PROT_WRITE,
result = mmap(nil, size, PROT_READ or PROT_WRITE,
MAP_PRIVATE or MAP_ANONYMOUS, -1, 0)
if result == nil or result == cast[pointer](-1):
raiseOutOfMem()
proc osTryAllocPages(size: int): pointer {.inline.} =
result = mmap(nil, csize size, PROT_READ or PROT_WRITE,
result = mmap(nil, size, PROT_READ or PROT_WRITE,
MAP_PRIVATE or MAP_ANONYMOUS, -1, 0)
if result == cast[pointer](-1): result = nil
proc osDeallocPages(p: pointer, size: int) {.inline.} =
when reallyOsDealloc: discard munmap(p, csize size)
when reallyOsDealloc: discard munmap(p, size)
elif defined(windows):
const