From: Vicent Marti Date: Fri, 6 May 2016 08:51:54 +0000 (+0200) Subject: cc: Use `unique_ptr` instead of `shared_ptr` X-Git-Tag: v0.2.0~92^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=116060867f1ddba95943946d212356694d046e7e;p=platform%2Fupstream%2Fbcc.git cc: Use `unique_ptr` instead of `shared_ptr` --- diff --git a/src/cc/usdt.cc b/src/cc/usdt.cc index 2d7d8f6..c2b9459 100644 --- a/src/cc/usdt.cc +++ b/src/cc/usdt.cc @@ -229,10 +229,10 @@ std::string Context::resolve_bin_path(const std::string &bin_path) { return result; } -std::shared_ptr 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; } diff --git a/src/cc/usdt.h b/src/cc/usdt.h index 412bb84..e67d89c 100644 --- a/src/cc/usdt.h +++ b/src/cc/usdt.h @@ -166,7 +166,7 @@ public: }; class Context { - std::vector> probes_; + std::vector> probes_; optional pid_; optional pid_stat_; @@ -188,8 +188,8 @@ public: bool loaded() const { return loaded_; } size_t num_probes() const { return probes_.size(); } - std::shared_ptr get(const std::string &probe_name); - std::shared_ptr 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);