aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/fstring.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-05-23 18:15:56 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-05-23 18:15:56 +0100
commit163f058f1fdf93c7b557d6eb95f4d245337c8350 (patch)
treec7152d54a0f229e18287818945cffec5a8c029ad /src/libutil/fstring.c
parentc15fd65bc3e7f447a816e9539afa92f444f53480 (diff)
downloadrspamd-163f058f1fdf93c7b557d6eb95f4d245337c8350.tar.gz
rspamd-163f058f1fdf93c7b557d6eb95f4d245337c8350.zip
[Feature] Add function to convert fstring_t to c string
Diffstat (limited to 'src/libutil/fstring.c')
-rw-r--r--src/libutil/fstring.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/libutil/fstring.c b/src/libutil/fstring.c
index 285940f9c..a70290a0b 100644
--- a/src/libutil/fstring.c
+++ b/src/libutil/fstring.c
@@ -416,3 +416,19 @@ rspamd_ftokdup (const rspamd_ftok_t *src)
return newstr;
}
+
+gchar *
+rspamd_fstringdup (const rspamd_fstring_t *src)
+{
+ gchar *newstr;
+
+ if (src == NULL) {
+ return NULL;
+ }
+
+ newstr = g_malloc (src->len + 1);
+ memcpy (newstr, src->str, src->len);
+ newstr[src->len] = '\0';
+
+ return newstr;
+}