From c7b66dbcb4f46cea1ad2500af1e99f5d09a6de7f Mon Sep 17 00:00:00 2001 From: Thomas1664 <46387399+Thomas1664@users.noreply.github.com> Date: Sun, 8 Dec 2024 10:59:23 +0000 Subject: [PATCH 1/2] inline FileType functions --- include/vcpkg/base/files.h | 8 ++++---- src/vcpkg/base/files.cpp | 5 ----- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/include/vcpkg/base/files.h b/include/vcpkg/base/files.h index 7b43319223..57694986a1 100644 --- a/include/vcpkg/base/files.h +++ b/include/vcpkg/base/files.h @@ -52,10 +52,10 @@ namespace vcpkg } }; - bool is_symlink(FileType s); - bool is_regular_file(FileType s); - bool is_directory(FileType s); - bool exists(FileType s); + constexpr bool is_symlink(FileType s) noexcept { return s == FileType::symlink || s == FileType::junction; } + constexpr bool is_regular_file(FileType s) noexcept { return s == FileType::regular; } + constexpr bool is_directory(FileType s) noexcept { return s == FileType::directory; } + constexpr bool exists(FileType s) noexcept { return s != FileType::not_found && s != FileType::none; } struct FilePointer { diff --git a/src/vcpkg/base/files.cpp b/src/vcpkg/base/files.cpp index e466e97163..dec715d4f2 100644 --- a/src/vcpkg/base/files.cpp +++ b/src/vcpkg/base/files.cpp @@ -1366,11 +1366,6 @@ namespace vcpkg const char* to_printf_arg(const Path& p) noexcept { return p.m_str.c_str(); } - bool is_symlink(FileType s) { return s == FileType::symlink || s == FileType::junction; } - bool is_regular_file(FileType s) { return s == FileType::regular; } - bool is_directory(FileType s) { return s == FileType::directory; } - bool exists(FileType s) { return s != FileType::not_found && s != FileType::none; } - FilePointer::FilePointer(const Path& path) : m_fs(nullptr), m_path(path) { } FilePointer::FilePointer() noexcept : m_fs(nullptr), m_path{} { } From 3503cb1f148a1ff3d31d238cc8226817d94b20b1 Mon Sep 17 00:00:00 2001 From: Thomas1664 <46387399+Thomas1664@users.noreply.github.com> Date: Sun, 8 Dec 2024 11:02:04 +0000 Subject: [PATCH 2/2] inline InstallDir --- include/vcpkg/commands.install.h | 4 ++-- src/vcpkg/commands.install.cpp | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/include/vcpkg/commands.install.h b/include/vcpkg/commands.install.h index 22d7f8f394..eb34c0f6fc 100644 --- a/include/vcpkg/commands.install.h +++ b/include/vcpkg/commands.install.h @@ -56,8 +56,8 @@ namespace vcpkg Path m_listfile; public: - const Path& destination() const; - const Path& listfile() const; + const Path& destination() const noexcept { return this->m_destination; } + const Path& listfile() const noexcept { return this->m_listfile; } }; void install_package_and_write_listfile(const Filesystem& fs, diff --git a/src/vcpkg/commands.install.cpp b/src/vcpkg/commands.install.cpp index 5f750f3658..c2ef6ced1b 100644 --- a/src/vcpkg/commands.install.cpp +++ b/src/vcpkg/commands.install.cpp @@ -42,10 +42,6 @@ namespace vcpkg return dirs; } - const Path& InstallDir::destination() const { return this->m_destination; } - - const Path& InstallDir::listfile() const { return this->m_listfile; } - void install_package_and_write_listfile(const Filesystem& fs, const Path& source_dir, const InstallDir& destination_dir)