diff options
author | Andreas Kling <kling@serenityos.org> | 2021-08-05 20:41:44 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-06 00:37:47 +0200 |
commit | af46f2214c5a15435371380aec0e6e015912a56d (patch) | |
tree | 2beaff81327858bc4665af6f10ed24200e9107eb /Kernel/Net/TCPSocket.h | |
parent | f35108fc315ebd14acc4a8ce628568fced137e8a (diff) | |
download | serenity-af46f2214c5a15435371380aec0e6e015912a56d.zip |
Kernel: Make a bunch of "char const* to_string()" return StringView
Diffstat (limited to 'Kernel/Net/TCPSocket.h')
-rw-r--r-- | Kernel/Net/TCPSocket.h | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/Kernel/Net/TCPSocket.h b/Kernel/Net/TCPSocket.h index b00c230518..9cd0a791a9 100644 --- a/Kernel/Net/TCPSocket.h +++ b/Kernel/Net/TCPSocket.h @@ -28,19 +28,19 @@ public: Passive, }; - static const char* to_string(Direction direction) + static StringView to_string(Direction direction) { switch (direction) { case Direction::Unspecified: - return "Unspecified"; + return "Unspecified"sv; case Direction::Outgoing: - return "Outgoing"; + return "Outgoing"sv; case Direction::Incoming: - return "Incoming"; + return "Incoming"sv; case Direction::Passive: - return "Passive"; + return "Passive"sv; default: - return "None"; + return "None"sv; } } @@ -58,31 +58,31 @@ public: TimeWait, }; - static const char* to_string(State state) + static StringView to_string(State state) { switch (state) { case State::Closed: - return "Closed"; + return "Closed"sv; case State::Listen: - return "Listen"; + return "Listen"sv; case State::SynSent: - return "SynSent"; + return "SynSent"sv; case State::SynReceived: - return "SynReceived"; + return "SynReceived"sv; case State::Established: - return "Established"; + return "Established"sv; case State::CloseWait: - return "CloseWait"; + return "CloseWait"sv; case State::LastAck: - return "LastAck"; + return "LastAck"sv; case State::FinWait1: - return "FinWait1"; + return "FinWait1"sv; case State::FinWait2: - return "FinWait2"; + return "FinWait2"sv; case State::Closing: - return "Closing"; + return "Closing"sv; case State::TimeWait: - return "TimeWait"; + return "TimeWait"sv; default: return "None"; } @@ -96,19 +96,19 @@ public: RetransmitTimeout, }; - static const char* to_string(Error error) + static StringView to_string(Error error) { switch (error) { case Error::None: - return "None"; + return "None"sv; case Error::FINDuringConnect: - return "FINDuringConnect"; + return "FINDuringConnect"sv; case Error::RSTDuringConnect: - return "RSTDuringConnect"; + return "RSTDuringConnect"sv; case Error::UnexpectedFlagsDuringConnect: - return "UnexpectedFlagsDuringConnect"; + return "UnexpectedFlagsDuringConnect"sv; default: - return "Invalid"; + return "Invalid"sv; } } |