summaryrefslogtreecommitdiffstats
path: root/common/dummy_malloc.c
diff options
context:
space:
mode:
authorAndrey Smirnov <andrew.smirnov@gmail.com>2018-10-15 10:00:18 -0700
committerSascha Hauer <s.hauer@pengutronix.de>2018-10-16 09:04:08 +0200
commit5daab6ebb368eb4b113da858b9d9e12b8d670c52 (patch)
treeca4984b870a3602a91bd17af46b86590a94ed3a4 /common/dummy_malloc.c
parentd83ae9c923b2b271ffd2a86279dad91c7713146d (diff)
downloadbarebox-5daab6ebb368eb4b113da858b9d9e12b8d670c52.tar.gz
dummy_malloc: Make use of PTR_ALIGN
Drop explicit type cast and alignement code in favor of PTR_ALIGN Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/dummy_malloc.c')
-rw-r--r--common/dummy_malloc.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/common/dummy_malloc.c b/common/dummy_malloc.c
index fa4f5d1..ab67120 100644
--- a/common/dummy_malloc.c
+++ b/common/dummy_malloc.c
@@ -30,11 +30,9 @@ void malloc_stats(void)
void *memalign(size_t alignment, size_t bytes)
{
- unsigned long mem = (unsigned long)sbrk(bytes + alignment);
+ void *mem = sbrk(bytes + alignment);
- mem = (mem + alignment) & ~(alignment - 1);
-
- return (void *)mem;
+ return PTR_ALIGN(mem, alignment);
}
void *malloc(size_t size)