aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/lib/stdlib/itoa.c
diff options
context:
space:
mode:
authorMarvin Borner2020-01-26 18:41:23 +0100
committerGitHub2020-01-26 18:41:23 +0100
commit43f501c74aa09f18c904ace902dc4cc5d241c218 (patch)
treeea30b53ac6043faddd1cdb2fdea17f37178b1cc7 /src/kernel/lib/stdlib/itoa.c
parentd5d1749257ff8b9aa6b5ace4b4720b484a2860f3 (diff)
parentbb2a6b4d93512e8afc1b1999eb58f1f506cc27ae (diff)
Merged task-based userspace switching and updated heap/paging code
Awesome!
Diffstat (limited to 'src/kernel/lib/stdlib/itoa.c')
-rw-r--r--src/kernel/lib/stdlib/itoa.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/kernel/lib/stdlib/itoa.c b/src/kernel/lib/stdlib/itoa.c
index 67273b3..ea03aa2 100644
--- a/src/kernel/lib/stdlib/itoa.c
+++ b/src/kernel/lib/stdlib/itoa.c
@@ -1,8 +1,8 @@
#include <kernel/lib/math.h>
#include <stdint.h>
#include <kernel/lib/string.h>
-#include <kernel/lib/stdlib.h>
-#include <kernel/paging/paging.h>
+#include <kernel/memory/kheap.h>
+#include <kernel/memory/paging.h>
static const char ITOA_TABLE[] = "0123456789";
@@ -12,7 +12,7 @@ char *itoa(int n)
return "0"; // kmalloc isn't available
if (!n) {
- char *ret = kmalloc(2);
+ char *ret = (char *) kmalloc(2);
ret[0] = '0';
ret[1] = 0;
return ret;
@@ -23,7 +23,7 @@ char *itoa(int n)
int sz;
for (sz = 0; n % pow(10, sz) != n; sz++) {}
- char *ret = kmalloc(sz + 1);
+ char *ret = (char *) kmalloc((uint32_t) (sz + 1));
for (int i = 0; i < sz; i++) {
int digit = (n % pow(10, i + 1)) / pow(10, i);
@@ -32,7 +32,7 @@ char *itoa(int n)
ret[sz] = 0;
if (negative) {
- char *aux = kmalloc(sz + 2);
+ char *aux = (char *) kmalloc((uint32_t) (sz + 2));
strcpy(aux, ret);
aux[sz] = '-';
aux[sz + 1] = 0;