Simplify some statements
This commit is contained in:
parent
3cd2f2d092
commit
132c0af22a
|
@ -231,19 +231,13 @@ void FileLister::addFiles(std::map<std::string, std::size_t> &files, const std::
|
||||||
bool FileLister::isDirectory(const std::string &path)
|
bool FileLister::isDirectory(const std::string &path)
|
||||||
{
|
{
|
||||||
struct stat file_stat;
|
struct stat file_stat;
|
||||||
if (stat(path.c_str(), &file_stat) != -1)
|
return (stat(path.c_str(), &file_stat) != -1 && (file_stat.st_mode & S_IFMT) == S_IFDIR);
|
||||||
return ((file_stat.st_mode & S_IFMT) == S_IFDIR);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileLister::fileExists(const std::string &path)
|
bool FileLister::fileExists(const std::string &path)
|
||||||
{
|
{
|
||||||
struct stat file_stat;
|
struct stat file_stat;
|
||||||
if (stat(path.c_str(), &file_stat) != -1)
|
return (stat(path.c_str(), &file_stat) != -1 && (file_stat.st_mode & S_IFMT) == S_IFREG);
|
||||||
return ((file_stat.st_mode & S_IFMT) == S_IFREG);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1064,7 +1064,7 @@ public:
|
||||||
|
|
||||||
/** is variable unused? */
|
/** is variable unused? */
|
||||||
bool unused() const {
|
bool unused() const {
|
||||||
return (_read == false && _write == false);
|
return (!_read && !_write);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Token *_name;
|
const Token *_name;
|
||||||
|
|
|
@ -251,7 +251,7 @@ bool Path::isC(const std::string &path)
|
||||||
bool Path::isCPP(const std::string &path)
|
bool Path::isCPP(const std::string &path)
|
||||||
{
|
{
|
||||||
const std::string extension = getFilenameExtensionInLowerCase(path);
|
const std::string extension = getFilenameExtensionInLowerCase(path);
|
||||||
if (extension == ".cpp" ||
|
return extension == ".cpp" ||
|
||||||
extension == ".cxx" ||
|
extension == ".cxx" ||
|
||||||
extension == ".cc" ||
|
extension == ".cc" ||
|
||||||
extension == ".c++" ||
|
extension == ".c++" ||
|
||||||
|
@ -259,12 +259,9 @@ bool Path::isCPP(const std::string &path)
|
||||||
extension == ".hxx" ||
|
extension == ".hxx" ||
|
||||||
extension == ".hh" ||
|
extension == ".hh" ||
|
||||||
extension == ".tpp" ||
|
extension == ".tpp" ||
|
||||||
extension == ".txx") {
|
extension == ".txx" ||
|
||||||
return true;
|
getFilenameExtension(path) == ".C";
|
||||||
}
|
|
||||||
|
|
||||||
// In unix, ".C" is considered C++ file
|
// In unix, ".C" is considered C++ file
|
||||||
return (getFilenameExtension(path) == ".C");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Path::acceptFile(const std::string &path, const std::set<std::string> &extra)
|
bool Path::acceptFile(const std::string &path, const std::set<std::string> &extra)
|
||||||
|
|
Loading…
Reference in New Issue