Skip to content
Snippets Groups Projects
Commit 5e50a204 authored by Vladimir Davydov's avatar Vladimir Davydov Committed by Vladimir Davydov
Browse files

memtx: do not use MemtxAllocator name spec when not necessary

It isn't necessary to prefix all static class members with the class
name specifier in the class methods.

NO_DOC=refactoring
NO_TEST=refactoring
NO_CHANGELOG=refactoring
parent 5226027e
No related merge requests found
......@@ -64,7 +64,7 @@ class MemtxAllocator {
static void delayed_free(void *ptr)
{
lifo_push(&MemtxAllocator<Allocator>::lifo, ptr);
lifo_push(&lifo, ptr);
}
static void * alloc(size_t size)
......@@ -75,19 +75,19 @@ class MemtxAllocator {
static void create(enum memtx_engine_free_mode m)
{
MemtxAllocator<Allocator>::mode = m;
lifo_init(&MemtxAllocator<Allocator>::lifo);
mode = m;
lifo_init(&lifo);
}
static void set_mode(enum memtx_engine_free_mode m)
{
MemtxAllocator<Allocator>::mode = m;
mode = m;
}
static void destroy()
{
void *item;
while ((item = lifo_pop(&MemtxAllocator<Allocator>::lifo)))
while ((item = lifo_pop(&lifo)))
free(item);
}
private:
......@@ -95,18 +95,17 @@ class MemtxAllocator {
static void collect_garbage()
{
if (MemtxAllocator<Allocator>::mode !=
MEMTX_ENGINE_COLLECT_GARBAGE)
if (mode != MEMTX_ENGINE_COLLECT_GARBAGE)
return;
if (! lifo_is_empty(&MemtxAllocator<Allocator>::lifo)) {
if (!lifo_is_empty(&lifo)) {
for (int i = 0; i < GC_BATCH_SIZE; i++) {
void *item = lifo_pop(&MemtxAllocator<Allocator>::lifo);
void *item = lifo_pop(&lifo);
if (item == NULL)
break;
free(item);
}
} else {
MemtxAllocator<Allocator>::mode = MEMTX_ENGINE_FREE;
mode = MEMTX_ENGINE_FREE;
}
}
static struct lifo lifo;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment