瀏覽代碼

Kernel: Remove unnecessary String allocation in SystemExposedFolder

Andreas Kling 4 年之前
父節點
當前提交
55c6e08c9e
共有 2 個文件被更改,包括 5 次插入5 次删除
  1. 2 2
      Kernel/SystemExposed.cpp
  2. 3 3
      Kernel/SystemExposed.h

+ 2 - 2
Kernel/SystemExposed.cpp

@@ -50,12 +50,12 @@ RefPtr<SystemExposedComponent> SystemExposedFolder::lookup(StringView name)
     return {};
 }
 
-SystemExposedFolder::SystemExposedFolder(String name)
+SystemExposedFolder::SystemExposedFolder(StringView name)
     : SystemExposedComponent(name)
 {
 }
 
-SystemExposedFolder::SystemExposedFolder(String name, SystemExposedFolder const& parent_folder)
+SystemExposedFolder::SystemExposedFolder(StringView name, SystemExposedFolder const& parent_folder)
     : SystemExposedComponent(name)
     , m_parent_folder(parent_folder)
 {

+ 3 - 3
Kernel/SystemExposed.h

@@ -9,7 +9,7 @@
 #include <AK/Function.h>
 #include <AK/RefCounted.h>
 #include <AK/RefPtr.h>
-#include <AK/String.h>
+#include <AK/StringView.h>
 #include <AK/Types.h>
 #include <Kernel/FileSystem/File.h>
 #include <Kernel/FileSystem/FileSystem.h>
@@ -53,8 +53,8 @@ public:
     virtual NonnullRefPtr<Inode> to_inode(SysFS const& sysfs_instance) const override final;
 
 protected:
-    explicit SystemExposedFolder(String name);
-    SystemExposedFolder(String name, SystemExposedFolder const& parent_folder);
+    explicit SystemExposedFolder(StringView name);
+    SystemExposedFolder(StringView name, SystemExposedFolder const& parent_folder);
     NonnullRefPtrVector<SystemExposedComponent> m_components;
     RefPtr<SystemExposedFolder> m_parent_folder;
 };