Commit 11606086 authored by Vicent Marti's avatar Vicent Marti

cc: Use `unique_ptr` instead of `shared_ptr`

parent 040df7d3
......@@ -229,10 +229,10 @@ std::string Context::resolve_bin_path(const std::string &bin_path) {
return result;
}
std::shared_ptr<Probe> Context::get(const std::string &probe_name) {
Probe *Context::get(const std::string &probe_name) {
for (auto &p : probes_) {
if (p->name_ == probe_name)
return p;
return p.get();
}
return nullptr;
}
......
......@@ -166,7 +166,7 @@ public:
};
class Context {
std::vector<std::shared_ptr<Probe>> probes_;
std::vector<std::unique_ptr<Probe>> probes_;
optional<int> pid_;
optional<ProcStat> pid_stat_;
......@@ -188,8 +188,8 @@ public:
bool loaded() const { return loaded_; }
size_t num_probes() const { return probes_.size(); }
std::shared_ptr<Probe> get(const std::string &probe_name);
std::shared_ptr<Probe> get(int pos) { return probes_[pos]; }
Probe *get(const std::string &probe_name);
Probe *get(int pos) { return probes_[pos].get(); }
bool enable_probe(const std::string &probe_name, const std::string &fn_name);
bool generate_usdt_args(std::ostream &stream);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment