aboutsummaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorMarvin Borner2021-05-19 00:43:40 +0200
committerMarvin Borner2021-05-19 00:43:40 +0200
commit98df498e8e8a07e33cc77a059876b940cb9b3c6a (patch)
tree57a2ff0fab411c91fba5512827c18124b092aa5d /libs
parent45bfdffcb2e00fda595b3f9318469f6b0d29cbe4 (diff)
Smashed some bugs
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]();