Mercurial > audlegacy
diff audacious/memorypool.c @ 2224:4446a9e7bdee trunk
[svn] - memory_pool_alloc_object()
- memory_pool_strdup()
- controlsocket now uses a memory pool for packet data
author | nenolod |
---|---|
date | Fri, 29 Dec 2006 21:01:49 -0800 |
parents | e0d7335f56c3 |
children | 9fc150e3542e |
line wrap: on
line diff
--- a/audacious/memorypool.c Fri Dec 29 20:38:02 2006 -0800 +++ b/audacious/memorypool.c Fri Dec 29 21:01:49 2006 -0800 @@ -16,7 +16,10 @@ */ #include <glib.h> +#include <stdlib.h> +#include <string.h> +#include "util.h" #include "memorypool.h" /* visibility of this object is not available to the outside */ @@ -105,3 +108,15 @@ g_mutex_free(pool->mutex); g_free(pool); } + +gchar * +memory_pool_strdup(MemoryPool * pool, gchar * src) +{ + gchar *out; + gsize sz = strlen(src) + 1; + + out = memory_pool_allocate(pool, sz); + g_strlcpy(out, src, sz); + + return out; +}