From 4d874a3e814df964d4362d1f6fd7136287126c30 Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 16 Nov 2022 16:03:09 +0200 Subject: [PATCH] Moved backspace() & append() --- Core/Crash/KBDrv.cpp | 14 +------------- Library/Convert.c | 13 +++++++++++++ include/convert.h | 3 +++ 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/Core/Crash/KBDrv.cpp b/Core/Crash/KBDrv.cpp index ba2ce6a..54b1eee 100644 --- a/Core/Crash/KBDrv.cpp +++ b/Core/Crash/KBDrv.cpp @@ -2,6 +2,7 @@ #include "chfcts.hpp" #include +#include #include #include #include @@ -74,19 +75,6 @@ static inline int GetLetterFromScanCode(uint8_t ScanCode) return KEY_INVALID; } -static inline void backspace(char s[]) -{ - int len = strlen(s); - s[len - 1] = '\0'; -} - -static inline void append(char s[], char n) -{ - int len = strlen(s); - s[len] = n; - s[len + 1] = '\0'; -} - namespace CrashHandler { CrashKeyboardDriver::CrashKeyboardDriver() : Interrupts::Handler(CPU::x64::IRQ1) diff --git a/Library/Convert.c b/Library/Convert.c index f563839..ae0f11c 100644 --- a/Library/Convert.c +++ b/Library/Convert.c @@ -327,6 +327,19 @@ int memcmp(const void *vl, const void *vr, size_t n) return n ? *l - *r : 0; } +void backspace(char s[]) +{ + int len = strlen(s); + s[len - 1] = '\0'; +} + +void append(char s[], char n) +{ + int len = strlen(s); + s[len] = n; + s[len + 1] = '\0'; +} + int strncmp(const char *s1, const char *s2, size_t n) { for (size_t i = 0; i < n; i++) diff --git a/include/convert.h b/include/convert.h index b37d96e..7b4770b 100644 --- a/include/convert.h +++ b/include/convert.h @@ -13,6 +13,9 @@ extern "C" void swap(char *x, char *y); char *reverse(char *Buffer, int i, int j); + void backspace(char s[]); + void append(char s[], char n); + int atoi(const char *String); double atof(const char *String); char *itoa(int Value, char *Buffer, int Base);