Fix copyright lines
[folly.git] / folly / experimental / symbolizer / ElfCache.cpp
index 8e70301648baa25412d749630cc8c0705184742d..9f95ebd926609c6dd3437755b781c8c418240815 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 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.
@@ -26,7 +26,8 @@
  */
 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
@@ -64,8 +65,8 @@ std::shared_ptr<ElfFile> SignalSafeElfCache::getFile(StringPiece p) {
     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];
   }
@@ -79,16 +80,16 @@ std::shared_ptr<ElfFile> SignalSafeElfCache::getFile(StringPiece p) {
   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_);
@@ -129,5 +130,5 @@ std::shared_ptr<ElfFile> ElfCache::filePtr(const std::shared_ptr<Entry>& e) {
   // share ownership
   return std::shared_ptr<ElfFile>(e, &e->file);
 }
-
-}}  // namespaces
+} // namespace symbolizer
+} // namespace folly