diff options
Diffstat (limited to 'src/fstring.c')
-rw-r--r-- | src/fstring.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/fstring.c b/src/fstring.c index 2935fe8e6..b2008c047 100644 --- a/src/fstring.c +++ b/src/fstring.c @@ -1,4 +1,5 @@ #include <stdlib.h> +#include <string.h> #include "fstring.h" @@ -155,6 +156,21 @@ fstrcat (f_str_t *dest, f_str_t *src) } /* + * Make copy of string to 0-terminated string + */ +char* +fstrcstr (f_str_t *str, memory_pool_t *pool) +{ + char *res; + res = memory_pool_alloc (pool, str->len + 1); + + memcpy (res, str->begin, str->len); + res[str->len] = 0; + + return res; +} + +/* * Push one character to fstr */ int |