/*
- * Copyright 2016 Facebook, Inc.
+ * Copyright 2014-present Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
extern struct r_debug _r_debug;
-namespace folly { namespace symbolizer {
+namespace folly {
+namespace symbolizer {
size_t countLoadedElfFiles() {
// _r_debug synchronization is... lacking to say the least. It's
return nullptr;
}
- Path path(p);
- auto pos = map_.find(path);
+ scratchpad_.assign(p);
+ auto pos = map_.find(scratchpad_);
if (pos != map_.end()) {
return slots_[pos->second];
}
auto& f = slots_[n];
const char* msg = "";
- int r = f->openAndFollow(path.data(), true, &msg);
+ int r = f->openAndFollow(scratchpad_.data(), true, &msg);
if (r != ElfFile::kSuccess) {
return nullptr;
}
- map_[path] = n;
+ map_[scratchpad_] = n;
return f;
}
-ElfCache::ElfCache(size_t capacity) : capacity_(capacity) { }
+ElfCache::ElfCache(size_t capacity) : capacity_(capacity) {}
std::shared_ptr<ElfFile> ElfCache::getFile(StringPiece p) {
std::lock_guard<std::mutex> lock(mutex_);
// share ownership
return std::shared_ptr<ElfFile>(e, &e->file);
}
-
-}} // namespaces
+} // namespace symbolizer
+} // namespace folly