From a96e66a86ea2b09eacde8d59b52943d35eaf88bb Mon Sep 17 00:00:00 2001 From: LibretroAdmin Date: Thu, 14 May 2026 13:27:05 +0000 Subject: [PATCH] common/file_system: make GetFileNameFromPath file-local GetFileNameFromPath has only two callers and both are inside file_system.cpp itself (GetDisplayNameFromPath at line 218 and GetFileTitleFromPath at line 232). No code outside the TU references it. Mark it static and drop the header declaration - the rest of the tree never needed to see this symbol. GetLastSeperatorPosition next to it (line 196) is already a file-local static for exactly the same reason, so this matches the surrounding style. Build: Makefile.libretro platform=unix - clean. swanstation_libretro.so size: 8020440 -> 8020336 bytes (-104, one fewer entry in dynsym). retro_* exports: 25 (unchanged). --- src/common/file_system.cpp | 12 ++++++------ src/common/file_system.h | 3 --- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/common/file_system.cpp b/src/common/file_system.cpp index c00c586c..48e6be42 100644 --- a/src/common/file_system.cpp +++ b/src/common/file_system.cpp @@ -213,12 +213,7 @@ static std::string_view::size_type GetLastSeperatorPosition(const std::string_vi return last_separator; } -std::string GetDisplayNameFromPath(const std::string_view& path) -{ - return std::string(GetFileNameFromPath(path)); -} - -std::string_view GetFileNameFromPath(const std::string_view& path) +static std::string_view GetFileNameFromPath(const std::string_view& path) { std::string_view::size_type pos = GetLastSeperatorPosition(path, true); if (pos == std::string_view::npos) @@ -227,6 +222,11 @@ std::string_view GetFileNameFromPath(const std::string_view& path) return path.substr(pos); } +std::string GetDisplayNameFromPath(const std::string_view& path) +{ + return std::string(GetFileNameFromPath(path)); +} + std::string_view GetFileTitleFromPath(const std::string_view& path) { std::string_view filename(GetFileNameFromPath(path)); diff --git a/src/common/file_system.h b/src/common/file_system.h index 4fde7430..f496c3a0 100644 --- a/src/common/file_system.h +++ b/src/common/file_system.h @@ -54,9 +54,6 @@ std::string ReplaceExtension(const std::string_view& path, const std::string_vie /// where it resolves a content URI to its name. std::string GetDisplayNameFromPath(const std::string_view& path); -/// Returns the filename component of a filename. -std::string_view GetFileNameFromPath(const std::string_view& path); - /// Returns the file title (less the extension and path) from a filename. std::string_view GetFileTitleFromPath(const std::string_view& path);