From 345f80249ddef46a0a90d763e1b5651bbf967078 Mon Sep 17 00:00:00 2001
From: Christian Cunningham <cc@localhost>
Date: Sat, 5 Feb 2022 02:35:20 -0700
Subject: Use new string formatting

---
 src/drivers/uart.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

(limited to 'src/drivers')

diff --git a/src/drivers/uart.c b/src/drivers/uart.c
index cc9c357..86fd4b0 100644
--- a/src/drivers/uart.c
+++ b/src/drivers/uart.c
@@ -1,4 +1,6 @@
 #include <drivers/uart.h>
+#include <lib/kmem.h>
+#include <lib/strings.h>
 #include <sys/schedule.h>
 
 #define UART_BUFFER_SIZE 0x100
@@ -42,19 +44,9 @@ void uart_flush(void)
 
 void uart_10(unsigned long val)
 {
-	unsigned long t = val;
-	unsigned long c;
-	static char buffer[11] = "0000000000\0";
-	char* dptr = buffer + 9;
-	for(int i = 0; i <= 10; i++) {
-		c = t%10;
-		*dptr = 0x30 + (c&0xF);
-		t /= 10;
-		if (t==0)
-			break;
-		dptr -= 1;
-	}
+	char* dptr = u32_to_str(val);
 	uart_string(dptr);
+	kfree(dptr);
 }
 
 void uart_hexn(unsigned long c_val)
-- 
cgit v1.2.1