Skip to content

Commit

Permalink
cc: Use unique_ptr instead of shared_ptr
Browse files Browse the repository at this point in the history
  • Loading branch information
vmg committed May 6, 2016
1 parent 040df7d commit 1160608
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/cc/usdt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions src/cc/usdt.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class Probe {
};

class Context {
std::vector<std::shared_ptr<Probe>> probes_;
std::vector<std::unique_ptr<Probe>> probes_;

optional<int> pid_;
optional<ProcStat> pid_stat_;
Expand All @@ -188,8 +188,8 @@ class Context {
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);
Expand Down

0 comments on commit 1160608

Please sign in to comment.