From 50b784c99e9e6b3f959354919ec030ccda203508 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Tue, 19 Jan 2010 15:42:30 +0000 Subject: [PATCH] pool.c calls renamed so they can me used by MAMEUI and MESS (no whatsnew needed) --- src/lib/util/pool.c | 39 +++++++++++++++++++-------------------- src/lib/util/pool.h | 10 +++++----- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/src/lib/util/pool.c b/src/lib/util/pool.c index b75c99c96fd..0091978f178 100644 --- a/src/lib/util/pool.c +++ b/src/lib/util/pool.c @@ -40,7 +40,6 @@ #include #include #include - #include "pool.h" #include "coreutil.h" @@ -165,7 +164,7 @@ INLINE objtype_entry *get_object_type(object_pool *pool, object_type type) pool_alloc - allocates a new memory pool -------------------------------------------------*/ -object_pool *pool_alloc(void (*fail)(const char *message)) +object_pool *pool_alloc_lib(void (*fail)(const char *message)) { object_pool *pool; @@ -252,7 +251,7 @@ void pool_clear(object_pool *pool) contained memory blocks -------------------------------------------------*/ -void pool_free(object_pool *pool) +void pool_free_lib(object_pool *pool) { object_entry_block *block, *nextblock; objtype_entry *type, *nexttype; @@ -610,37 +609,37 @@ int test_memory_pools(void) int i; has_memory_error = FALSE; - pool = pool_alloc(memory_error); + pool = pool_alloc_lib(memory_error); memset(ptrs, 0, sizeof(ptrs)); - ptrs[0] = pool_malloc(pool, 50); - ptrs[1] = pool_malloc(pool, 100); + ptrs[0] = pool_malloc_lib(pool, 50); + ptrs[1] = pool_malloc_lib(pool, 100); - ptrs[0] = pool_realloc(pool, ptrs[0], 150); - ptrs[1] = pool_realloc(pool, ptrs[1], 200); + ptrs[0] = pool_realloc_lib(pool, ptrs[0], 150); + ptrs[1] = pool_realloc_lib(pool, ptrs[1], 200); - ptrs[2] = pool_malloc(pool, 250); - ptrs[3] = pool_malloc(pool, 300); + ptrs[2] = pool_malloc_lib(pool, 250); + ptrs[3] = pool_malloc_lib(pool, 300); - ptrs[0] = pool_realloc(pool, ptrs[0], 350); - ptrs[1] = pool_realloc(pool, ptrs[1], 400); + ptrs[0] = pool_realloc_lib(pool, ptrs[0], 350); + ptrs[1] = pool_realloc_lib(pool, ptrs[1], 400); - ptrs[2] = pool_realloc(pool, ptrs[2], 450); - ptrs[3] = pool_realloc(pool, ptrs[3], 500); + ptrs[2] = pool_realloc_lib(pool, ptrs[2], 450); + ptrs[3] = pool_realloc_lib(pool, ptrs[3], 500); - ptrs[0] = pool_realloc(pool, ptrs[0], 0); - ptrs[1] = pool_realloc(pool, ptrs[1], 0); + ptrs[0] = pool_realloc_lib(pool, ptrs[0], 0); + ptrs[1] = pool_realloc_lib(pool, ptrs[1], 0); - ptrs[2] = pool_realloc(pool, ptrs[2], 550); - ptrs[3] = pool_realloc(pool, ptrs[3], 600); + ptrs[2] = pool_realloc_lib(pool, ptrs[2], 550); + ptrs[3] = pool_realloc_lib(pool, ptrs[3], 600); /* some heavier stress tests */ for (i = 0; i < 512; i++) { - ptrs[i % ARRAY_LENGTH(ptrs)] = pool_realloc(pool, + ptrs[i % ARRAY_LENGTH(ptrs)] = pool_realloc_lib(pool, ptrs[i % ARRAY_LENGTH(ptrs)], rand() % 1000); } - pool_free(pool); + pool_free_lib(pool); return has_memory_error; } diff --git a/src/lib/util/pool.h b/src/lib/util/pool.h index 5ddb9383773..ed65741a48a 100644 --- a/src/lib/util/pool.h +++ b/src/lib/util/pool.h @@ -48,9 +48,9 @@ ***************************************************************************/ /* helper macros for memory pools that pass file/line number */ -#define pool_malloc(pool, size) pool_malloc_file_line((pool), (size), __FILE__, __LINE__) -#define pool_realloc(pool, ptr, size) pool_realloc_file_line((pool), (ptr), (size), __FILE__, __LINE__) -#define pool_strdup(pool, size) pool_strdup_file_line((pool), (size), __FILE__, __LINE__) +#define pool_malloc_lib(pool, size) pool_malloc_file_line((pool), (size), __FILE__, __LINE__) +#define pool_realloc_lib(pool, ptr, size) pool_realloc_file_line((pool), (ptr), (size), __FILE__, __LINE__) +#define pool_strdup_lib(pool, size) pool_strdup_file_line((pool), (size), __FILE__, __LINE__) /* macro to define a 4-character type for a pool */ #define OBJECT_TYPE(a,b,c,d) (((a) << 24) | ((b) << 16) | ((c) << 8) | (d)) @@ -84,7 +84,7 @@ typedef struct _object_pool_iterator object_pool_iterator; /* ----- object pool management ----- */ /* allocate a new object pool */ -object_pool *pool_alloc(void (*fail)(const char *message)); +object_pool *pool_alloc_lib(void (*fail)(const char *message)); /* register a new object type; returns TRUE if the type already existed and was overridden */ void pool_type_register(object_pool *pool, object_type type, const char *friendly, void (*destructor)(void *, size_t)); @@ -93,7 +93,7 @@ void pool_type_register(object_pool *pool, object_type type, const char *friendl void pool_clear(object_pool *pool); /* free an object pool, including all allocated objects */ -void pool_free(object_pool *pool); +void pool_free_lib(object_pool *pool);