}
bool
-InodeCache::hash_inode(const char* path, ContentType type, Digest& digest)
+InodeCache::hash_inode(const std::string& path,
+ ContentType type,
+ Digest& digest)
{
Stat stat = Stat::stat(path);
if (!stat) {
- cc_log("Could not stat %s: %s", path, strerror(stat.error_number()));
+ cc_log(
+ "Could not stat %s: %s", path.c_str(), strerror(stat.error_number()));
return false;
}
}
bool
-InodeCache::get(const char* path,
+InodeCache::get(const std::string& path,
ContentType type,
Digest& file_digest,
int* return_value)
}
release_bucket(bucket);
- cc_log("inode cache %s: %s", found ? "hit" : "miss", path);
+ cc_log("inode cache %s: %s", found ? "hit" : "miss", path.c_str());
if (m_config.debug()) {
if (found) {
}
bool
-InodeCache::put(const char* path,
+InodeCache::put(const std::string& path,
ContentType type,
const Digest& file_digest,
int return_value)
release_bucket(bucket);
- cc_log("inode cache insert: %s", path);
+ cc_log("inode cache insert: %s", path.c_str());
return true;
}
//
// Returns true if saved values could be retrieved from the cache, false
// otherwise.
- bool get(const char* path,
+ bool get(const std::string& path,
ContentType type,
Digest& file_digest,
int* return_value = nullptr);
// hash_source_code_file().
//
// Returns true if values could be stored in the cache, false otherwise.
- bool put(const char* path,
+ bool put(const std::string& path,
ContentType type,
const Digest& file_digest,
int return_value = 0);
struct SharedRegion;
bool mmap_file(const std::string& inode_cache_file);
- static bool hash_inode(const char* path, ContentType type, Digest& digest);
+ static bool
+ hash_inode(const std::string& path, ContentType type, Digest& digest);
Bucket* acquire_bucket(uint32_t index);
Bucket* acquire_bucket(const Digest& key_digest);
static void release_bucket(Bucket* bucket);
namespace {
bool
-put(const Context& ctx, const char* filename, const char* s, int return_value)
+put(const Context& ctx,
+ const std::string& filename,
+ const std::string& str,
+ int return_value)
{
return ctx.inode_cache.put(filename,
InodeCache::ContentType::code,
- Hash().hash(s).digest(),
+ Hash().hash(str).digest(),
return_value);
}