--- a/libpurple/Makefile.am Sat Mar 22 17:59:35 2014 +0100
+++ b/libpurple/Makefile.am Tue Mar 25 14:19:13 2014 +0100
@@ -114,6 +114,7 @@
@@ -188,6 +189,7 @@
--- a/libpurple/memorypool.c Sat Mar 22 17:59:35 2014 +0100
+++ b/libpurple/memorypool.c Tue Mar 25 14:19:13 2014 +0100
@@ -293,3 +293,24 @@
+purple_memory_pool_strdup(PurpleMemoryPool *pool, const gchar *str) + g_return_val_if_fail(PURPLE_IS_MEMORY_POOL(pool), NULL); + str_dup = purple_memory_pool_alloc(pool, str_len + 1, sizeof(gchar)); + g_return_val_if_fail(str_dup != NULL, NULL); + memcpy(str_dup, str, str_len); + str_dup[str_len] = '\0'; --- a/libpurple/memorypool.h Sat Mar 22 17:59:35 2014 +0100
+++ b/libpurple/memorypool.h Tue Mar 25 14:19:13 2014 +0100
@@ -72,7 +72,7 @@
* Creates a new memory pool.
- * Returns: The new PurpleMemoryPool.
+ * Returns: The new #PurpleMemoryPool. purple_memory_pool_new(gulong block_size);
@@ -112,11 +112,25 @@
* @mem: The pointer to a memory block.
* Frees a memory allocated within a memory pool. This can be a no-op in certain
+ * implementations. Thus, it don't need to be called in every case. purple_memory_pool_free(PurpleMemoryPool *pool, gpointer mem);
+ * purple_memory_pool_strdup: + * @pool: The memory pool. + * @str: The string to duplicate. + * Duplicates a string using a memory allocated within a memory pool. If @str is + * %NULL it returns %NULL. The returned string should be freed with g_free() + * when no longer needed. + * Returns: a newly-allocated copy of @str +purple_memory_pool_strdup(PurpleMemoryPool *pool, const gchar *str); #endif /* PURPLE_MEMORY_POOL_H */