summaryrefslogtreecommitdiffstats
path: root/src/lib/util/pool.cpp
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2021-02-14 11:05:57 -0500
committer AJR <ajrhacker@users.noreply.github.com>2021-02-14 11:05:57 -0500
commitbc0146c2038c46f789a246d5616afd7c425157f3 (patch)
treeb4d39194034b4c6e56ccd4035d25636034be43ca /src/lib/util/pool.cpp
parent91310bcdeb7ab0ff661738b212017bf836f4e8ad (diff)
Eliminate ARRAY_LENGTH template in favor of C++17's std::size
* osdcomm.h: Move definition of EQUIVALENT_ARRAY to coretmpl.h * sharc.cpp, gt64xxx.cpp, ym2413.cpp, gb_lcd.cpp, snes_ppu.cpp: Use STRUCT_MEMBER for save state registration * gio/newport.cpp, megadrive/svp.cpp, nes_ctrl/bcbattle.cpp, arm7.cpp, tms9995.cpp, pckeybrd.cpp, sa1110.cpp, sa1111.cpp, jangou_blitter.cpp, vic4567.cpp: Use std::fill(_n) instead of memset * emucore.h: Remove obsolete typedef
Diffstat (limited to 'src/lib/util/pool.cpp')
-rw-r--r--src/lib/util/pool.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/util/pool.cpp b/src/lib/util/pool.cpp
index faf1de170ae..509c4f76984 100644
--- a/src/lib/util/pool.cpp
+++ b/src/lib/util/pool.cpp
@@ -14,8 +14,8 @@
#include "osdcomm.h"
#include <cstdarg>
-#include <cstddef>
#include <cstdlib>
+#include <iterator>
/***************************************************************************
@@ -35,7 +35,7 @@
struct objtype_entry
{
objtype_entry * next;
- uint32_t type;
+ uint32_t type;
const char * friendly;
void (*destructor)(void *, size_t);
};
@@ -296,7 +296,7 @@ void *pool_object_add_file_line(object_pool *pool, object_type _type, void *obje
pool->blocklist = block;
/* add all entries to the free list */
- for (entrynum = 0; entrynum < ARRAY_LENGTH(block->entry); entrynum++)
+ for (entrynum = 0; entrynum < std::size(block->entry); entrynum++)
{
block->entry[entrynum].next = pool->freelist;
pool->freelist = &block->entry[entrynum];
@@ -615,8 +615,8 @@ bool test_memory_pools()
/* some heavier stress tests */
for (i = 0; i < 512; i++)
{
- ptrs[i % ARRAY_LENGTH(ptrs)] = pool_realloc_lib(pool,
- ptrs[i % ARRAY_LENGTH(ptrs)], rand() % 1000);
+ ptrs[i % std::size(ptrs)] = pool_realloc_lib(pool,
+ ptrs[i % std::size(ptrs)], rand() % 1000);
}
pool_free_lib(pool);