]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Added pool_get_name(), for debugging mostly.
authorTimo Sirainen <tss@iki.fi>
Mon, 19 May 2003 09:50:24 +0000 (12:50 +0300)
committerTimo Sirainen <tss@iki.fi>
Mon, 19 May 2003 09:50:24 +0000 (12:50 +0300)
--HG--
branch : HEAD

src/lib/mempool-alloconly.c
src/lib/mempool-datastack.c
src/lib/mempool-system.c
src/lib/mempool.h

index dc3f89863304675c250c8f5ed0c886caf5d1cb11..33910a687b350a41f4c2968a6f4c044a44209241 100644 (file)
@@ -57,6 +57,7 @@ struct pool_block {
 #define POOL_BLOCK_DATA(block) \
        ((char *) (block) + SIZEOF_POOLBLOCK)
 
+static const char *pool_alloconly_get_name(pool_t pool);
 static void pool_alloconly_ref(pool_t pool);
 static void pool_alloconly_unref(pool_t pool);
 static void *pool_alloconly_malloc(pool_t pool, size_t size);
@@ -68,6 +69,8 @@ static void pool_alloconly_clear(pool_t pool);
 static void block_alloc(struct alloconly_pool *pool, size_t size);
 
 static struct pool static_alloconly_pool = {
+       pool_alloconly_get_name,
+
        pool_alloconly_ref,
        pool_alloconly_unref,
 
@@ -112,6 +115,13 @@ static void pool_alloconly_destroy(struct alloconly_pool *apool)
        free(apool);
 }
 
+static const char *pool_alloconly_get_name(pool_t pool)
+{
+       struct alloconly_pool *apool = (struct alloconly_pool *) pool;
+
+       return apool->name;
+}
+
 static void pool_alloconly_ref(pool_t pool)
 {
        struct alloconly_pool *apool = (struct alloconly_pool *) pool;
index 94929593f11db3bf0b5702def14bfeb54ea79a66..7dfcbee4b8642c54cc062b97ad74ab48bcb6dbfc 100644 (file)
@@ -28,6 +28,7 @@
 
 #include <stdlib.h>
 
+static const char *pool_data_stack_get_name(pool_t pool);
 static void pool_data_stack_ref(pool_t pool);
 static void pool_data_stack_unref(pool_t pool);
 static void *pool_data_stack_malloc(pool_t pool, size_t size);
@@ -37,6 +38,8 @@ static void *pool_data_stack_realloc(pool_t pool, void *mem,
 static void pool_data_stack_clear(pool_t pool);
 
 static struct pool static_data_stack_pool = {
+       pool_data_stack_get_name,
+
        pool_data_stack_ref,
        pool_data_stack_unref,
 
@@ -52,6 +55,11 @@ static struct pool static_data_stack_pool = {
 
 pool_t data_stack_pool = &static_data_stack_pool;
 
+static const char *pool_data_stack_get_name(pool_t pool __attr_unused__)
+{
+       return "data stack";
+}
+
 static void pool_data_stack_ref(pool_t pool __attr_unused__)
 {
 }
index b55fc8ec9688c0e96fe411488446c1b1d38c08ef..aef33e3759b5aeb9ccc7c6e3f556ef1b3e37f68c 100644 (file)
@@ -30,6 +30,7 @@
 
 #include <stdlib.h>
 
+static const char *pool_system_get_name(pool_t pool);
 static void pool_system_ref(pool_t pool);
 static void pool_system_unref(pool_t pool);
 static void *pool_system_malloc(pool_t pool, size_t size);
@@ -39,6 +40,8 @@ static void *pool_system_realloc(pool_t pool, void *mem,
 static void pool_system_clear(pool_t pool);
 
 static struct pool static_system_pool = {
+       pool_system_get_name,
+
        pool_system_ref,
        pool_system_unref,
 
@@ -54,6 +57,11 @@ static struct pool static_system_pool = {
 
 pool_t system_pool = &static_system_pool;
 
+static const char *pool_system_get_name(pool_t pool __attr_unused__)
+{
+       return "system";
+}
+
 static void pool_system_ref(pool_t pool __attr_unused__)
 {
 }
index 519c1548a9ccf861e3c34bcdf09ffd1e73cac99f..53c84bc33940bc5c329a9c9241bf3e91ab4fe1ad 100644 (file)
@@ -12,6 +12,8 @@
 typedef struct pool *pool_t;
 
 struct pool {
+       const char *(*get_name)(pool_t pool);
+
        void (*ref)(pool_t pool);
        void (*unref)(pool_t pool);
 
@@ -40,6 +42,7 @@ extern pool_t data_stack_pool;
 pool_t pool_alloconly_create(const char *name, size_t size);
 
 /* Pools should be used through these macros: */
+#define pool_get_name(pool) (pool)->get_name(pool)
 #define pool_ref(pool) (pool)->ref(pool)
 #define pool_unref(pool) (pool)->unref(pool)