Skip to content

Commit

Permalink
Guarantee strict weak order in Probe::finalize_locations
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardo-elizondo authored and yonghong-song committed Nov 15, 2021
1 parent 039cef6 commit 8fc16e2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cc/usdt/usdt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ void Probe::add_location(uint64_t addr, const std::string &bin_path, const char
void Probe::finalize_locations() {
std::sort(locations_.begin(), locations_.end(),
[](const Location &a, const Location &b) {
return a.bin_path_ < b.bin_path_ || a.address_ < b.address_;
return std::tie(a.bin_path_, a.address_) < std::tie(b.bin_path_, b.address_);
});
auto last = std::unique(locations_.begin(), locations_.end(),
[](const Location &a, const Location &b) {
Expand Down

0 comments on commit 8fc16e2

Please sign in to comment.