From 194456efdcdeb67c34a9e255385c777ea411b308 Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Sun, 14 Nov 2021 15:48:27 -0700 Subject: [PATCH] Kernel: Remove unnecessary StringBuilder from sys$create_thread() A series of refactors changed Threads to always have a name, and to store their name as a KString. Before the refactors a StringBuilder was used to format the default thread name for a non-main thread, but it is since unused. Remove it and the AK/String related header includes from the thread syscall implementation file. --- Kernel/Syscalls/thread.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Kernel/Syscalls/thread.cpp b/Kernel/Syscalls/thread.cpp index 9c0f5715ae..f32fe56e8c 100644 --- a/Kernel/Syscalls/thread.cpp +++ b/Kernel/Syscalls/thread.cpp @@ -5,8 +5,6 @@ */ #include -#include -#include #include #include #include @@ -43,13 +41,10 @@ ErrorOr Process::sys$create_thread(void* (*entry)(void*), Userspacetid().value()))); - // We know this thread is not the main_thread, // So give it a unique name until the user calls $set_thread_name on it - // length + 4 to give space for our extra junk at the end - StringBuilder builder(m_name->length() + 4); + // FIXME: Don't make a temporary String here + auto new_thread_name = TRY(KString::try_create(String::formatted("{} [{}]", m_name, thread->tid().value()))); thread->set_name(move(new_thread_name)); if (!is_thread_joinable)