diff options
Diffstat (limited to 'src/mem_pool.c')
-rw-r--r-- | src/mem_pool.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mem_pool.c b/src/mem_pool.c index df4c544f9..76ae1141b 100644 --- a/src/mem_pool.c +++ b/src/mem_pool.c @@ -24,6 +24,7 @@ #include "config.h" #include "mem_pool.h" +#include "fstring.h" /* Sleep time for spin lock in nanoseconds */ #define MUTEX_SLEEP_TIME 10000000L @@ -228,6 +229,22 @@ memory_pool_strdup (memory_pool_t *pool, const char *src) } char * +memory_pool_fstrdup (memory_pool_t *pool, const struct f_str_s *src) +{ + char *newstr; + + if (src == NULL) { + return NULL; + } + + newstr = memory_pool_alloc (pool, src->len + 1); + memcpy (newstr, src->begin, src->len); + newstr[src->len] = '\0'; + return newstr; +} + + +char * memory_pool_strdup_shared (memory_pool_t *pool, const char *src) { memory_pool_ssize_t len; |