1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 21:08:12 +00:00

Kernel: Make a bunch of "char const* to_string()" return StringView

This commit is contained in:
Andreas Kling 2021-08-05 20:41:44 +02:00
parent f35108fc31
commit af46f2214c
4 changed files with 34 additions and 33 deletions

View file

@ -6,6 +6,7 @@
#pragma once
#include <AK/StringView.h>
#include <AK/Types.h>
#include <AK/Userspace.h>
@ -206,19 +207,19 @@ enum Function {
__Count
};
constexpr const char* to_string(Function function)
constexpr StringView to_string(Function function)
{
switch (function) {
#undef __ENUMERATE_SYSCALL
#define __ENUMERATE_SYSCALL(sys_call, needs_lock) \
case SC_##sys_call: \
return #sys_call;
return #sys_call##sv;
ENUMERATE_SYSCALLS(__ENUMERATE_SYSCALL)
#undef __ENUMERATE_SYSCALL
default:
break;
}
return "Unknown";
return "Unknown"sv;
}
#ifdef __serenity__