From 08d1f09e4cc3e5e8c4d19098dca36fd2414b8102 Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Fri, 24 Dec 2021 01:07:06 +0100 Subject: [PATCH] Refactor --- lib/conv.c | 2 ++ lib/conv.h | 1 + lib/strf.c | 15 --------------- lib/strf.h | 1 - 4 files changed, 3 insertions(+), 16 deletions(-) create mode 100644 lib/conv.c create mode 100644 lib/conv.h delete mode 100644 lib/strf.c delete mode 100644 lib/strf.h diff --git a/lib/conv.c b/lib/conv.c new file mode 100644 index 0000000..5ed3295 --- /dev/null +++ b/lib/conv.c @@ -0,0 +1,2 @@ +#include "conv.h" + diff --git a/lib/conv.h b/lib/conv.h new file mode 100644 index 0000000..0c037b9 --- /dev/null +++ b/lib/conv.h @@ -0,0 +1 @@ +void int_to_str(int i, char* buf); diff --git a/lib/strf.c b/lib/strf.c deleted file mode 100644 index 65dddc7..0000000 --- a/lib/strf.c +++ /dev/null @@ -1,15 +0,0 @@ -#include "strf.h" - -#define int_offset 48 -// 0:48 - 9:57 - -char* int_to_str(int i, char* strbuf) { - if( i == 0 ) { - return (char*)(int_offset); - } else { - char cbuf; - cbuf = (char)((i % 10) + int_offset); - - return int_to_str(i / 10, strbuf + cbuf); - } -} diff --git a/lib/strf.h b/lib/strf.h deleted file mode 100644 index 29649bc..0000000 --- a/lib/strf.h +++ /dev/null @@ -1 +0,0 @@ -char* int_to_str(int i, char* strbuf);