From 71a2d0971f6c7637583432b9aced5a1f89c956d7 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Sat, 7 Dec 2024 01:41:23 +0200 Subject: [PATCH] Kernel: Remove unnecessary reverse from VFS file search --- kernel/kernel/FS/VirtualFileSystem.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/kernel/FS/VirtualFileSystem.cpp b/kernel/kernel/FS/VirtualFileSystem.cpp index 04231dba..60139480 100644 --- a/kernel/kernel/FS/VirtualFileSystem.cpp +++ b/kernel/kernel/FS/VirtualFileSystem.cpp @@ -200,11 +200,11 @@ namespace Kernel [&path_parts](BAN::StringView path) -> BAN::ErrorOr { auto split_path = TRY(path.split('/')); - split_path.reverse(); - for (auto part : split_path) + TRY(path_parts.reserve(path_parts.size() + split_path.size())); + for (size_t i = split_path.size(); i > 0; i--) { TRY(path_parts.emplace_back()); - TRY(path_parts.back().append(part)); + TRY(path_parts.back().append(split_path[i - 1])); } return {}; };