[dovecot-cvs] dovecot/src/lib mempool-alloconly.c,1.21,1.22
mempool-datastack.c,1.7,1.8 mempool-system.c,1.11,1.12
mempool.h,1.10,1.11
cras at procontrol.fi
cras at procontrol.fi
Mon May 19 13:50:26 EEST 2003
Update of /home/cvs/dovecot/src/lib
In directory danu:/tmp/cvs-serv2479
Modified Files:
mempool-alloconly.c mempool-datastack.c mempool-system.c
mempool.h
Log Message:
Added pool_get_name(), for debugging mostly.
Index: mempool-alloconly.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/mempool-alloconly.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- mempool-alloconly.c 10 Apr 2003 22:37:01 -0000 1.21
+++ mempool-alloconly.c 19 May 2003 09:50:24 -0000 1.22
@@ -57,6 +57,7 @@
#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 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,
@@ -110,6 +113,13 @@
#endif
free(apool->block);
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)
Index: mempool-datastack.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/mempool-datastack.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- mempool-datastack.c 11 Jan 2003 15:09:35 -0000 1.7
+++ mempool-datastack.c 19 May 2003 09:50:24 -0000 1.8
@@ -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_clear(pool_t pool);
static struct pool static_data_stack_pool = {
+ pool_data_stack_get_name,
+
pool_data_stack_ref,
pool_data_stack_unref,
@@ -51,6 +54,11 @@
};
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: mempool-system.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/mempool-system.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- mempool-system.c 11 Jan 2003 15:09:35 -0000 1.11
+++ mempool-system.c 19 May 2003 09:50:24 -0000 1.12
@@ -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_clear(pool_t pool);
static struct pool static_system_pool = {
+ pool_system_get_name,
+
pool_system_ref,
pool_system_unref,
@@ -53,6 +56,11 @@
};
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: mempool.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib/mempool.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- mempool.h 11 Jan 2003 15:09:35 -0000 1.10
+++ mempool.h 19 May 2003 09:50:24 -0000 1.11
@@ -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 @@
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)
More information about the dovecot-cvs
mailing list