Skip to content

Commit

Permalink
Merge pull request iovisor#1637 from palmtenor/table_move
Browse files Browse the repository at this point in the history
Add move constructor for BPFStackTable
  • Loading branch information
yonghong-song committed Mar 20, 2018
2 parents a4110b4 + 991a1df commit 130b594
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/cc/api/BPFTable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,13 @@ BPFStackTable::BPFStackTable(const TableDesc& desc,
};
}

BPFStackTable::BPFStackTable(BPFStackTable&& that) :
BPFTableBase<int, stacktrace_t>(that.desc),
symbol_option_(std::move(that.symbol_option_)),
pid_sym_(std::move(that.pid_sym_)) {
that.pid_sym_.clear();
}

BPFStackTable::~BPFStackTable() {
for (auto it : pid_sym_)
bcc_free_symcache(it.second, it.first);
Expand Down
1 change: 1 addition & 0 deletions src/cc/api/BPFTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ class BPFStackTable : public BPFTableBase<int, stacktrace_t> {
BPFStackTable(const TableDesc& desc,
bool use_debug_file,
bool check_debug_file_crc);
BPFStackTable(BPFStackTable&& that);
~BPFStackTable();

void clear_table_non_atomic();
Expand Down

0 comments on commit 130b594

Please sign in to comment.