summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e4876ad)
raw | patch | inline | side by side (parent: e4876ad)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Fri, 1 Aug 2008 16:25:03 +0000 (16:25 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Fri, 1 Aug 2008 16:25:03 +0000 (16:25 +0000) |
buildtool.cpp | patch | blob | history |
diff --git a/buildtool.cpp b/buildtool.cpp
index 33dabce7013b4db6738c7a3ab9a79fd67e8e14a5..f6cc448f7340e935411f482af515897a492c9035 100644 (file)
--- a/buildtool.cpp
+++ b/buildtool.cpp
//########################################################################
//########################################################################
-//########################################################################
-//# Stat cache to speed up stat requests
-//########################################################################
-typedef std::map<String, std::pair<int,struct stat> > statCacheType;
-static statCacheType statCache;
-static int cachedStat(const String &f, struct stat *s) {
- std::pair<statCacheType::iterator, bool> result = statCache.insert(statCacheType::value_type(f, std::pair<int,struct stat>()));
- if (result.second) {
- result.first->second.first = stat(f.c_str(), &(result.first->second.second));
- }
- *s = result.first->second.second;
- return result.first->second.first;
-}
-
//########################################################################
//# F I L E S E T
//########################################################################
fullChildPath.append(childName);
struct stat finfo;
String childNative = getNativePath(fullChildPath);
- if (cachedStat(childNative, &finfo)<0)
+ if (stat(childNative.c_str(), &finfo)<0)
{
error("cannot stat file:%s", childNative.c_str());
}
if (strlen(cnative)==2 && cnative[1]==':')
return true;
#endif
- if (cachedStat(nativeDir, &finfo)==0)
+ if (stat(cnative, &finfo)==0)
{
if (!S_ISDIR(finfo.st_mode))
{
struct stat finfo;
String childNative = getNativePath(childName);
char *cnative = (char *)childNative.c_str();
- if (cachedStat(childNative, &finfo)<0)
+ if (stat(cnative, &finfo)<0)
{
error("cannot stat file:%s", cnative);
}
//# 1 Check up-to-date times
String srcNative = getNativePath(srcFile);
struct stat srcinfo;
- if (cachedStat(srcNative, &srcinfo)<0)
+ if (stat(srcNative.c_str(), &srcinfo)<0)
{
error("source file %s for copy does not exist",
srcNative.c_str());
String destNative = getNativePath(destFile);
struct stat destinfo;
- if (cachedStat(destNative, &destinfo)==0)
+ if (stat(destNative.c_str(), &destinfo)==0)
{
if (destinfo.st_mtime >= srcinfo.st_mtime)
return true;
struct stat finfo;
//Exists?
- if (cachedStat(native, &finfo)<0)
+ if (stat(native.c_str(), &finfo)<0)
return false;
struct stat finfo;
//Exists?
- if (cachedStat(native, &finfo)<0)
+ if (stat(native.c_str(), &finfo)<0)
return false;
String nativeA = getNativePath(fileA);
struct stat infoA;
//IF source does not exist, NOT newer
- if (cachedStat(nativeA, &infoA)<0)
+ if (stat(nativeA.c_str(), &infoA)<0)
{
return false;
}
String nativeB = getNativePath(fileB);
struct stat infoB;
//IF dest does not exist, YES, newer
- if (cachedStat(nativeB, &infoB)<0)
+ if (stat(nativeB.c_str(), &infoB)<0)
{
return true;
}
if (!quiet && verbose)
taskstatus("path: %s", fname);
//does not exist
- if (cachedStat(fullName, &finfo)<0)
+ if (stat(fname, &finfo)<0)
{
if (failOnError)
return false;