diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-07-08 15:38:44 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-07-08 15:38:44 +0200 |
commit | 0e75aba7c39c7a2d3b0becc2416aa0e251d62070 (patch) | |
tree | 19bc08a69423db6ab1c6669c06eaab81f494a564 /Kernel/Net | |
parent | 567551bc12945c25b49c65579ceb545668dbb7eb (diff) | |
download | serenity-0e75aba7c39c7a2d3b0becc2416aa0e251d62070.zip |
StringView: Rename characters() to characters_without_null_termination().
This should make you think twice before trying to use the const char* from
a StringView as if it's a null-terminated string.
Diffstat (limited to 'Kernel/Net')
-rw-r--r-- | Kernel/Net/NetworkAdapter.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Kernel/Net/NetworkAdapter.cpp b/Kernel/Net/NetworkAdapter.cpp index bb39a869ea..f1eaffc245 100644 --- a/Kernel/Net/NetworkAdapter.cpp +++ b/Kernel/Net/NetworkAdapter.cpp @@ -1,4 +1,5 @@ #include <AK/HashTable.h> +#include <AK/StringBuilder.h> #include <Kernel/Lock.h> #include <Kernel/Net/EtherType.h> #include <Kernel/Net/EthernetFrameHeader.h> @@ -100,7 +101,10 @@ void NetworkAdapter::set_ipv4_address(const IPv4Address& address) void NetworkAdapter::set_interface_name(const StringView& basename) { // FIXME: Find a unique name for this interface, starting with $basename. - m_name = String::format("%s0", basename.characters()); + StringBuilder builder; + builder.append(basename); + builder.append('0'); + m_name = builder.to_string(); } bool PacketQueueAlarm::is_ringing() const |