Browse Source

Kernel: Introduce a StringView overload of dbgputstr(..)

Brian Gianforcaro 4 years ago
parent
commit
1ee1ef5103
2 changed files with 9 additions and 0 deletions
  1. 6 0
      Kernel/kprintf.cpp
  2. 3 0
      Kernel/kstdio.h

+ 6 - 0
Kernel/kprintf.cpp

@@ -5,6 +5,7 @@
  */
 
 #include <AK/PrintfImplementation.h>
+#include <AK/StringView.h>
 #include <AK/Types.h>
 #include <Kernel/ConsoleDevice.h>
 #include <Kernel/Devices/PCISerialDevice.h>
@@ -165,6 +166,11 @@ extern "C" void dbgputstr(const char* characters, size_t length)
         internal_dbgputch(characters[i]);
 }
 
+void dbgputstr(StringView view)
+{
+    ::dbgputstr(view.characters_without_null_termination(), view.length());
+}
+
 extern "C" void kernelputstr(const char* characters, size_t length)
 {
     if (!characters)

+ 3 - 0
Kernel/kstdio.h

@@ -6,6 +6,7 @@
 
 #pragma once
 
+#include <AK/StringView.h>
 #include <AK/Types.h>
 
 extern "C" {
@@ -17,3 +18,5 @@ int snprintf(char* buf, size_t, const char* fmt, ...) __attribute__((format(prin
 void set_serial_debug(bool on_or_off);
 int get_serial_debug();
 }
+
+void dbgputstr(StringView view);