aboutsummaryrefslogtreecommitdiffstats
path: root/src/mem_pool.h
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2010-05-13 17:07:20 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2010-05-13 17:07:20 +0400
commit2a45f0daa25c66db449741d9c93a7ea6ef868729 (patch)
tree1140aa892fec576561e614fd10337720ce03a298 /src/mem_pool.h
parentd85518101f1b1363ee965c2b4af595e379f89afe (diff)
downloadrspamd-2a45f0daa25c66db449741d9c93a7ea6ef868729.tar.gz
rspamd-2a45f0daa25c66db449741d9c93a7ea6ef868729.zip
* Fix config reloading
* Add ability to register variables in memory pools (hash with known lifetime) * Avoid of using of some global variables
Diffstat (limited to 'src/mem_pool.h')
-rw-r--r--src/mem_pool.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/mem_pool.h b/src/mem_pool.h
index b55670c95..81d4a85fa 100644
--- a/src/mem_pool.h
+++ b/src/mem_pool.h
@@ -74,6 +74,7 @@ typedef struct memory_pool_s {
struct _pool_chain *first_pool; /**< first page */
struct _pool_chain_shared *shared_pool; /**< shared chain */
struct _pool_destructors *destructors; /**< destructors chain */
+ GHashTable *variables; /**< private memory pool variables */
} memory_pool_t;
/**
@@ -236,6 +237,24 @@ void memory_pool_stat (memory_pool_stat_t *st);
memory_pool_ssize_t memory_pool_get_size ();
/**
+ * Set memory pool variable
+ * @param pool memory pool object
+ * @param name name of variable
+ * @param gpointer value value of variable
+ * @param destructor pointer to function-destructor
+ */
+void memory_pool_set_variable (memory_pool_t *pool, const gchar *name, gpointer value, pool_destruct_func destructor);
+
+/**
+ * Get memory pool variable
+ * @param pool memory pool object
+ * @param name name of variable
+ * @return NULL or pointer to variable data
+ */
+gpointer memory_pool_get_variable (memory_pool_t *pool, const gchar *name);
+
+
+/**
* Macro that return free space in pool page
* @param x pool page struct
*/