From 3ebac69e0c0a9aeeaf7a98d2bdf847d916881462 Mon Sep 17 00:00:00 2001 From: nolan-veed <88709630+nolan-veed@users.noreply.github.com> Date: Thu, 16 Nov 2023 08:17:28 +0000 Subject: [PATCH] Renamed flags. --- src/internal_modules/roc_core/slab_pool.h | 10 +++++----- src/internal_modules/roc_core/slab_pool_impl.cpp | 4 ++-- src/tests/roc_core/test_slab_pool.cpp | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/internal_modules/roc_core/slab_pool.h b/src/internal_modules/roc_core/slab_pool.h index df1f37024b..7eb0b32cc3 100644 --- a/src/internal_modules/roc_core/slab_pool.h +++ b/src/internal_modules/roc_core/slab_pool.h @@ -24,13 +24,13 @@ namespace roc { namespace core { //! Memory pool flags. -enum PoolFlags { +enum SlabPoolFlags { //! Enable guards for buffer overflow, invalid ownership, etc. - PoolFlag_EnableGuards = (1 << 0), + SlabPoolFlag_EnableGuards = (1 << 0), }; //! Default memory pool flags. -enum { DefaultPoolFlags = (PoolFlag_EnableGuards) }; +enum { DefaultSlabPoolFlags = (SlabPoolFlag_EnableGuards) }; //! Memory pool. //! @@ -72,13 +72,13 @@ class SlabPool : public IPool, public NonCopyable<> { //! - @p object_size defines size of single object in bytes //! - @p min_alloc_bytes defines minimum size in bytes per request to arena //! - @p max_alloc_bytes defines maximum size in bytes per request to arena - //! - @p flags defines options to modify behaviour as indicated in PoolFlags + //! - @p flags defines options to modify behaviour as indicated in SlabPoolFlags explicit SlabPool(const char* name, IArena& arena, size_t object_size = sizeof(T), size_t min_alloc_bytes = 0, size_t max_alloc_bytes = 0, - size_t flags = DefaultPoolFlags) + size_t flags = DefaultSlabPoolFlags) : impl_(name, arena, object_size, diff --git a/src/internal_modules/roc_core/slab_pool_impl.cpp b/src/internal_modules/roc_core/slab_pool_impl.cpp index 9b63fa479e..02b1e408d8 100644 --- a/src/internal_modules/roc_core/slab_pool_impl.cpp +++ b/src/internal_modules/roc_core/slab_pool_impl.cpp @@ -148,7 +148,7 @@ SlabPoolImpl::Slot* SlabPoolImpl::take_slot_from_user_(void* memory) { if (!is_owner) { num_guard_failures_++; - if (flags_ & PoolFlag_EnableGuards) { + if (flags_ & SlabPoolFlag_EnableGuards) { roc_panic("pool: attempt to deallocate slot not belonging to this pool:" " name=%s this_pool=%p slot_pool=%p", name_, (const void*)this, (const void*)slot_hdr->owner); @@ -166,7 +166,7 @@ SlabPoolImpl::Slot* SlabPoolImpl::take_slot_from_user_(void* memory) { if (!canary_before_ok || !canary_after_ok) { num_guard_failures_++; - if (flags_ & PoolFlag_EnableGuards) { + if (flags_ & SlabPoolFlag_EnableGuards) { roc_panic("pool: detected memory violation: name=%s ok_before=%d ok_after=%d", name_, (int)canary_before_ok, (int)canary_after_ok); } diff --git a/src/tests/roc_core/test_slab_pool.cpp b/src/tests/roc_core/test_slab_pool.cpp index 90c69a4816..d8614abc45 100644 --- a/src/tests/roc_core/test_slab_pool.cpp +++ b/src/tests/roc_core/test_slab_pool.cpp @@ -500,7 +500,7 @@ TEST(slab_pool, guard_object) { TEST(slab_pool, guard_object_violations) { TestArena arena; SlabPool pool("test", arena, sizeof(TestObject), 0, 0, - (DefaultPoolFlags & ~PoolFlag_EnableGuards)); + (DefaultSlabPoolFlags & ~SlabPoolFlag_EnableGuards)); void* pointers[2] = {}; pointers[0] = pool.allocate(); @@ -529,7 +529,7 @@ TEST(slab_pool, guard_object_violations) { TEST(slab_pool, object_ownership_guard) { TestArena arena; SlabPool pool0("test", arena, sizeof(TestObject), 0, 0, - (DefaultPoolFlags & ~PoolFlag_EnableGuards)); + (DefaultSlabPoolFlags & ~SlabPoolFlag_EnableGuards)); SlabPool pool1("test", arena); void* pointers[2] = {};