lemoncake

rbtree based memory allocator
git clone git://git.2f30.org/lemoncake
Log | Files | Refs | README | LICENSE

commit c9ae01670f67170b07b823dcd1dc74ad78ef4600
parent 0501870b679aadbac95b98b38353a384bb113e84
Author: sin <sin@2f30.org>
Date:   Fri,  2 Aug 2013 15:06:18 +0100

Rename MINALIGNMENT to ALIGN

Diffstat:
Mlemoncake.c | 10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lemoncake.c b/lemoncake.c @@ -9,7 +9,7 @@ #include "tree.h" #include "spinlock.h" -enum { MINALIGNMENT = 4 * sizeof(size_t) }; +enum { ALIGN = 4 * sizeof(size_t) }; struct node { void *buf; @@ -76,11 +76,11 @@ alloc_object(size_t siz) { void *base, *p; - base = sbrk(siz + MINALIGNMENT); + base = sbrk(siz + ALIGN); if (base == (void *)-1) return NULL; p = base; - p = (void *)(((uintptr_t)p + MINALIGNMENT) & ~(MINALIGNMENT - 1)); + p = (void *)(((uintptr_t)p + ALIGN) & ~(ALIGN - 1)); return p; } @@ -121,7 +121,7 @@ malloc(size_t siz) unlock(&rblock); return NULL; } - p = mmap_aligned(MINALIGNMENT, siz); + p = mmap_aligned(ALIGN, siz); if (!p) { unlock(&rblock); return NULL; @@ -175,7 +175,7 @@ realloc(void *oldp, size_t siz) unlock(&rblock); return NULL; } - newan->buf = mmap_aligned(MINALIGNMENT, siz); + newan->buf = mmap_aligned(ALIGN, siz); if (!newan->buf) { unlock(&rblock); return NULL;