diff options
author | Pavel Janík <Pavel@Janik.cz> | 2016-11-02 14:18:19 +0100 |
---|---|---|
committer | Pavel Janík <Pavel@Janik.cz> | 2016-11-02 14:18:19 +0100 |
commit | 4a9f3c50ccc8a467fda84bfd8ff7cfd831edb7c3 (patch) | |
tree | 44de72f207d11a75311a147a25d7b4e514d30534 /src/support/lockedpool.cpp | |
parent | f8723d231812045b8ccd205eac71deeab43a168b (diff) |
Do not shadow variable, use deprecated MAP_ANON if MAP_ANONYMOUS is not defined.
Diffstat (limited to 'src/support/lockedpool.cpp')
-rw-r--r-- | src/support/lockedpool.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/support/lockedpool.cpp b/src/support/lockedpool.cpp index 63050f006b..813869a131 100644 --- a/src/support/lockedpool.cpp +++ b/src/support/lockedpool.cpp @@ -64,14 +64,14 @@ void* Arena::alloc(size_t size) for (auto& chunk: chunks) { if (!chunk.second.isInUse() && size <= chunk.second.getSize()) { - char* base = chunk.first; + char* _base = chunk.first; size_t leftover = chunk.second.getSize() - size; if (leftover > 0) { // Split chunk - chunks.emplace(base + size, Chunk(leftover, false)); + chunks.emplace(_base + size, Chunk(leftover, false)); chunk.second.setSize(size); } chunk.second.setInUse(true); - return reinterpret_cast<void*>(base); + return reinterpret_cast<void*>(_base); } } return nullptr; @@ -224,6 +224,13 @@ PosixLockedPageAllocator::PosixLockedPageAllocator() page_size = sysconf(_SC_PAGESIZE); #endif } + +// Some systems (at least OS X) do not define MAP_ANONYMOUS yet and define +// MAP_ANON which is deprecated +#ifndef MAP_ANONYMOUS +#define MAP_ANONYMOUS MAP_ANON +#endif + void *PosixLockedPageAllocator::AllocateLocked(size_t len, bool *lockingSuccess) { void *addr; |