replace char*/string with stringview
This commit is contained in:
@ -40,14 +40,8 @@ void SerialOut::write(const char a) {
|
|||||||
com1.outb(a);
|
com1.outb(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SerialOut::write(const char* a) {
|
void SerialOut::write(const bse::string_view a) {
|
||||||
const char* current = a;
|
for (char current : a) {
|
||||||
do {
|
write(current);
|
||||||
write(*current);
|
}
|
||||||
current = current + 1;
|
|
||||||
} while (*current != '\0');
|
|
||||||
}
|
|
||||||
|
|
||||||
void SerialOut::write(const bse::string& a) {
|
|
||||||
write(static_cast<const char*>(a));
|
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "kernel/IOport.h"
|
#include "kernel/IOport.h"
|
||||||
#include "user/lib/String.h"
|
#include "user/lib/String.h"
|
||||||
|
#include "user/lib/StringView.h"
|
||||||
|
|
||||||
// NOTE: I took this code from https://wiki.osdev.org/Serial_Ports
|
// NOTE: I took this code from https://wiki.osdev.org/Serial_Ports
|
||||||
|
|
||||||
@ -21,8 +22,7 @@ public:
|
|||||||
|
|
||||||
static char read();
|
static char read();
|
||||||
static void write(char a);
|
static void write(char a);
|
||||||
static void write(const char* a);
|
static void write(const bse::string_view a);
|
||||||
static void write(const bse::string& a);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user