#include "mem_pool.h"
#include "fstring.h"
#include "logger.h"
-#include "util.h"
-#include "rspamd.h"
#include "utlist.h"
#include "ottery.h"
return newstr;
}
+gchar *
+rspamd_mempool_ftokdup (rspamd_mempool_t *pool, const rspamd_ftok_t *src)
+{
+ gchar *newstr;
+
+ if (src == NULL) {
+ return NULL;
+ }
+
+ newstr = rspamd_mempool_alloc (pool, src->len + 1);
+ memcpy (newstr, src->begin, src->len);
+ newstr[src->len] = '\0';
+ return newstr;
+}
gchar *
rspamd_mempool_strdup_shared (rspamd_mempool_t * pool, const gchar *src)
gchar * rspamd_mempool_fstrdup (rspamd_mempool_t * pool,
const struct f_str_s *src);
+struct f_str_tok;
+
+/**
+ * Make a copy of fixed string token in pool as null terminated string
+ * @param pool memory pool object
+ * @param src source string
+ * @return pointer to newly created string that is copy of src
+ */
+gchar * rspamd_mempool_ftokdup (rspamd_mempool_t *pool,
+ const struct f_str_tok *src);
+
/**
* Allocate piece of shared memory
* @param pool memory pool object
* @param pool memory pool object
* @param pointer pointer of shared memory object that is to be unlocked (the whole page that contains that object is locked)
*/
-void rspamd_mempool_lock_shared (rspamd_mempool_t *pool, void *pointer);
+void rspamd_mempool_unlock_shared (rspamd_mempool_t *pool, void *pointer);
/**
* Add destructor callback to pool