use make_shared where appropriate

This commit is contained in:
Martin Michelsen
2023-11-30 10:24:27 -08:00
parent c833b575e4
commit 956e890ad6
33 changed files with 279 additions and 305 deletions
+2 -2
View File
@@ -14,7 +14,7 @@ FileContentsCache::File::File(
string&& data,
uint64_t load_time)
: name(name),
data(new string(std::move(data))),
data(make_shared<string>(std::move(data))),
load_time(load_time) {}
shared_ptr<const FileContentsCache::File> FileContentsCache::replace(
@@ -22,7 +22,7 @@ shared_ptr<const FileContentsCache::File> FileContentsCache::replace(
if (t == 0) {
t = now();
}
shared_ptr<File> new_file(new File(name, std::move(data), t));
auto new_file = make_shared<File>(name, std::move(data), t);
auto emplace_ret = this->name_to_file.emplace(name, new_file);
if (!emplace_ret.second) {
emplace_ret.first->second = new_file;