Make outstanding_allocation_indices return a vector, not a set
This commit is contained in:
parent
4c9c05806a
commit
8b3941764f
2 changed files with 8 additions and 10 deletions
|
|
@ -1,9 +1,9 @@
|
|||
#include <stdlib.h>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
using std::map;
|
||||
using std::set;
|
||||
using std::vector;
|
||||
|
||||
static bool _enabled = false;
|
||||
static size_t _allocation_count = 0;
|
||||
|
|
@ -21,10 +21,10 @@ void stop() {
|
|||
_enabled = false;
|
||||
}
|
||||
|
||||
set<size_t> outstanding_allocation_indices() {
|
||||
set<size_t> result;
|
||||
vector<size_t> outstanding_allocation_indices() {
|
||||
vector<size_t> result;
|
||||
for (const auto &entry : _outstanding_allocations) {
|
||||
result.insert(entry.second);
|
||||
result.push_back(entry.second);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
@ -38,9 +38,7 @@ size_t allocation_count() {
|
|||
extern "C" {
|
||||
|
||||
static void *record_allocation(void *result) {
|
||||
if (!_enabled)
|
||||
return result;
|
||||
|
||||
if (!_enabled) return result;
|
||||
_outstanding_allocations[result] = _allocation_count;
|
||||
_allocation_count++;
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
#ifndef HELPERS_RECORD_ALLOC_H_
|
||||
#define HELPERS_RECORD_ALLOC_H_
|
||||
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
namespace record_alloc {
|
||||
|
||||
void start();
|
||||
void stop();
|
||||
void fail_at_allocation_index(size_t failure_index);
|
||||
std::set<size_t> outstanding_allocation_indices();
|
||||
std::vector<size_t> outstanding_allocation_indices();
|
||||
size_t allocation_count();
|
||||
|
||||
} // namespace record_alloc
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue