taisei/src/objectpool_fake.c
Andrei Alexeyev 513d613387
Consistent indentation: indent with tabs, align with spaces (#104)
I would've preferred to just go with 4-spaces for indent and no tabs,
but lao is a bit conservative about it. :^)

Still, this is a ton better than mixing different styles all over the
place, especially within the same file.
2018-01-12 20:26:07 +02:00

48 lines
1.1 KiB
C

/*
* This software is licensed under the terms of the MIT-License
* See COPYING for further information.
* ---
* Copyright (c) 2011-2018, Lukas Weber <laochailan@web.de>.
* Copyright (c) 2012-2018, Andrei Alexeyev <akari@alienslab.net>.
*/
#include "taisei.h"
#include "objectpool.h"
#include "util.h"
struct ObjectPool {
size_t size_of_object;
};
ObjectPool *objpool_alloc(size_t obj_size, size_t max_objects, const char *tag) {
ObjectPool *pool = malloc(sizeof(ObjectPool));
pool->size_of_object = obj_size;
return pool;
}
ObjectInterface *objpool_acquire(ObjectPool *pool) {
return calloc(1, pool->size_of_object);
}
void objpool_release(ObjectPool *pool, ObjectInterface *object) {
free(object);
}
void objpool_free(ObjectPool *pool) {
free(pool);
}
void objpool_get_stats(ObjectPool *pool, ObjectPoolStats *stats) {
memset(&stats, 0, sizeof(ObjectPoolStats));
stats->tag = "<N/A>";
}
void objpool_memtest(ObjectPool *pool, ObjectInterface *object) {
assert(pool != NULL);
assert(object != NULL);
}
size_t objpool_object_size(ObjectPool *pool) {
return pool->size_of_object;
}