From 8b3941764fb422c9fdcd16922075de51d7cdbf03 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 7 Sep 2017 17:48:44 -0700 Subject: [PATCH] Make outstanding_allocation_indices return a vector, not a set --- test/helpers/record_alloc.cc | 14 ++++++-------- test/helpers/record_alloc.h | 4 ++-- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/test/helpers/record_alloc.cc b/test/helpers/record_alloc.cc index a3f0b49f..43e11abe 100644 --- a/test/helpers/record_alloc.cc +++ b/test/helpers/record_alloc.cc @@ -1,9 +1,9 @@ #include #include -#include +#include 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 outstanding_allocation_indices() { - set result; +vector outstanding_allocation_indices() { + vector 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; diff --git a/test/helpers/record_alloc.h b/test/helpers/record_alloc.h index 50cd62ad..1f5968ac 100644 --- a/test/helpers/record_alloc.h +++ b/test/helpers/record_alloc.h @@ -1,14 +1,14 @@ #ifndef HELPERS_RECORD_ALLOC_H_ #define HELPERS_RECORD_ALLOC_H_ -#include +#include namespace record_alloc { void start(); void stop(); void fail_at_allocation_index(size_t failure_index); -std::set outstanding_allocation_indices(); +std::vector outstanding_allocation_indices(); size_t allocation_count(); } // namespace record_alloc