From b1e826ae216eb473469ba7e4f43b0e4a7f7d6388 Mon Sep 17 00:00:00 2001 From: наб Date: Thu, 23 Jan 2025 20:52:23 +0100 Subject: Take const& in {,Real}FileExists() --- apt-pkg/contrib/fileutl.cc | 4 ++-- apt-pkg/contrib/fileutl.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index ee0b7a04a..31f351b08 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -330,7 +330,7 @@ int GetLock(string File,bool Errors) // FileExists - Check if a file exists /*{{{*/ // --------------------------------------------------------------------- /* Beware: Directories are also files! */ -bool FileExists(string File) +bool FileExists(string const &File) { struct stat Buf; if (stat(File.c_str(),&Buf) != 0) @@ -341,7 +341,7 @@ bool FileExists(string File) // RealFileExists - Check if a file exists and if it is really a file /*{{{*/ // --------------------------------------------------------------------- /* */ -bool RealFileExists(string File) +bool RealFileExists(string const &File) { struct stat Buf; if (stat(File.c_str(),&Buf) != 0) diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h index 5d1e4ab69..503135731 100644 --- a/apt-pkg/contrib/fileutl.h +++ b/apt-pkg/contrib/fileutl.h @@ -182,8 +182,8 @@ APT_PUBLIC bool CopyFile(FileFd &From,FileFd &To); APT_PUBLIC bool RemoveFile(char const * const Function, std::string const &FileName); APT_PUBLIC bool RemoveFileAt(char const * const Function, int const dirfd, std::string const &FileName); APT_PUBLIC int GetLock(std::string File,bool Errors = true); -APT_PUBLIC bool FileExists(std::string File); -APT_PUBLIC bool RealFileExists(std::string File); +APT_PUBLIC bool FileExists(std::string const &File); +APT_PUBLIC bool RealFileExists(std::string const &File); APT_PUBLIC bool DirectoryExists(std::string const &Path); APT_PUBLIC bool CreateDirectory(std::string const &Parent, std::string const &Path); APT_PUBLIC time_t GetModificationTime(std::string const &Path); -- cgit v1.2.3-70-g09d2