From 74cc475787cdcac35186771a3acbe02bec56a06c Mon Sep 17 00:00:00 2001 From: Matthew Parkinson Date: Thu, 14 Nov 2019 13:34:57 +0000 Subject: [PATCH] Code review feedback. --- src/mem/alloc.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/mem/alloc.h b/src/mem/alloc.h index acedaa8..53d49cf 100644 --- a/src/mem/alloc.h +++ b/src/mem/alloc.h @@ -876,15 +876,16 @@ namespace snmalloc } /** - * If result parameter is non-null, then is_empty is passsed into the - * the location pointed to by result. + * If result parameter is non-null, then false is assigned into the + * the location pointed to by result if this allocator is non-empty. * - * Otherwise, asserts that it is empty. + * If result pointer is null, then this code raises a Pal::error on the + * particular check that fails, if any do fail. **/ void debug_is_empty(bool* result) { - auto test = [&result](bool value) { - if (!value) + auto test = [&result](auto& queue) { + if (!queue.is_empty()) { if (result != nullptr) *result = false; @@ -914,16 +915,16 @@ namespace snmalloc prev = n; } - test(small_classes[i].is_empty()); + test(small_classes[i]); } for (auto & medium_class : medium_classes) { - test(medium_class.is_empty()); + test(medium_class); } - test(super_available.is_empty()); - test(super_only_short_available.is_empty()); + test(super_available); + test(super_only_short_available); // Place the static stub message on the queue. init_message_queue();