From 453a65c386075e803ebdddd01f3145a0f221a12a Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 18 May 2015 16:54:29 +0100 Subject: [PATCH] Add helper to use GString in pool destructors. --- src/libutil/util.c | 8 ++++++++ src/libutil/util.h | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/src/libutil/util.c b/src/libutil/util.c index 6efe1b477..15f73bf09 100644 --- a/src/libutil/util.c +++ b/src/libutil/util.c @@ -2386,6 +2386,14 @@ rspamd_array_free_hard (gpointer p) g_array_free (ar, TRUE); } +void +rspamd_gstring_free_hard (gpointer p) +{ + GString *ar = (GString *)p; + + g_string_free (ar, TRUE); +} + void rspamd_init_libs (void) diff --git a/src/libutil/util.h b/src/libutil/util.h index f3a8dcbc5..af2e00065 100644 --- a/src/libutil/util.h +++ b/src/libutil/util.h @@ -451,6 +451,11 @@ void rspamd_ptr_array_free_hard (gpointer p); * @param p */ void rspamd_array_free_hard (gpointer p); +/** + * Special utility to help GString freeing in rspamd_mempool + * @param p + */ +void rspamd_gstring_free_hard (gpointer p); /** * Initialize rspamd libraries -- 2.39.5