aboutsummaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
Diffstat (limited to 'libs')
-rw-r--r--libs/libc/alloc.c2
-rw-r--r--libs/libc/inc/def.h3
-rw-r--r--libs/libc/sys.c3
3 files changed, 6 insertions, 2 deletions
diff --git a/libs/libc/alloc.c b/libs/libc/alloc.c
index ea01a38..6663a0e 100644
--- a/libs/libc/alloc.c
+++ b/libs/libc/alloc.c
@@ -50,8 +50,6 @@ static int liballoc_unlock(void)
}
#define ALIGNMENT 16
-#define ALIGN_UP(__addr, __align) (((__addr) + (__align)-1) & ~((__align)-1))
-#define ALIGN_DOWN(__addr, __align) ((__addr) & ~((__align)-1))
#define USE_CASE1
#define USE_CASE2
diff --git a/libs/libc/inc/def.h b/libs/libc/inc/def.h
index 7338242..c9c89fd 100644
--- a/libs/libc/inc/def.h
+++ b/libs/libc/inc/def.h
@@ -41,6 +41,9 @@ typedef unsigned long long u64;
#define __STRINGIFY(a) #a
#define STRINGIFY(a) __STRINGIFY(a)
+#define ALIGN_UP(addr, align) (((addr) + (align)-1) & ~((align)-1))
+#define ALIGN_DOWN(addr, align) ((addr) & ~((align)-1))
+
/**
* Compiler attribute wrappers
*/
diff --git a/libs/libc/sys.c b/libs/libc/sys.c
index cf2165a..8d0a9b8 100644
--- a/libs/libc/sys.c
+++ b/libs/libc/sys.c
@@ -186,6 +186,9 @@ static void (*funcs[ATEXIT_MAX])(void) = { 0 };
static void atexit_trigger(void)
{
+ if (!slot)
+ return;
+
while (slot-- > 0) {
if (funcs[slot]) {
funcs[slot]();