summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Weiner <hannes@cmpxchg.org>2010-03-17 00:41:13 +0100
committerJohannes Weiner <hannes@cmpxchg.org>2010-03-17 00:41:13 +0100
commit92e1e3f9e42c9ae4a4232e39fdf2c255f529f7a0 (patch)
treec34d172adb9e78cb0aec05a6abeeb917b0dff9be
parentcad0e55d8f86132e954700be7f0fd4656f2e8fa1 (diff)
gc: clarify code in alloc()
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
-rw-r--r--sheep/gc.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sheep/gc.c b/sheep/gc.c
index 54a0884..b0765e5 100644
--- a/sheep/gc.c
+++ b/sheep/gc.c
@@ -140,15 +140,19 @@ alloc:
static sheep_t alloc(struct sheep_vm *vm)
{
- struct sheep_object *sheep = vm->parts->free;
+ struct sheep_object *sheep;
- if (++vm->parts->nr_used < POOL_SIZE)
+ sheep = vm->parts->free;
+ vm->parts->nr_used++;
+
+ if (vm->parts->nr_used < POOL_SIZE)
vm->parts->free = (struct sheep_object *)sheep->data;
else {
struct sheep_objects *pool;
pool = vm->parts;
vm->parts = vm->parts->next;
+
pool->next = vm->fulls;
vm->fulls = pool;
}