Skip to content

Commit 626b865

Browse files
paveljanikfurszy
authored andcommitted
Do not shadow variable, use deprecated MAP_ANON if MAP_ANONYMOUS is not defined.
1 parent 807b044 commit 626b865

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/support/lockedpool.cpp

+10-3
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ void* Arena::alloc(size_t size)
6464

6565
for (auto& chunk: chunks) {
6666
if (!chunk.second.isInUse() && size <= chunk.second.getSize()) {
67-
char* base = chunk.first;
67+
char* _base = chunk.first;
6868
size_t leftover = chunk.second.getSize() - size;
6969
if (leftover > 0) { // Split chunk
70-
chunks.emplace(base + size, Chunk(leftover, false));
70+
chunks.emplace(_base + size, Chunk(leftover, false));
7171
chunk.second.setSize(size);
7272
}
7373
chunk.second.setInUse(true);
74-
return reinterpret_cast<void*>(base);
74+
return reinterpret_cast<void*>(_base);
7575
}
7676
}
7777
return nullptr;
@@ -224,6 +224,13 @@ PosixLockedPageAllocator::PosixLockedPageAllocator()
224224
page_size = sysconf(_SC_PAGESIZE);
225225
#endif
226226
}
227+
228+
// Some systems (at least OS X) do not define MAP_ANONYMOUS yet and define
229+
// MAP_ANON which is deprecated
230+
#ifndef MAP_ANONYMOUS
231+
#define MAP_ANONYMOUS MAP_ANON
232+
#endif
233+
227234
void *PosixLockedPageAllocator::AllocateLocked(size_t len, bool *lockingSuccess)
228235
{
229236
void *addr;

0 commit comments

Comments
 (0)