aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/fstring.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil/fstring.c')
-rw-r--r--src/libutil/fstring.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/libutil/fstring.c b/src/libutil/fstring.c
index fac3b364b..2cfbd7bf8 100644
--- a/src/libutil/fstring.c
+++ b/src/libutil/fstring.c
@@ -223,8 +223,6 @@ rspamd_fstring_erase (rspamd_fstring_t *str, gsize pos, gsize len)
}
}
-char *rspamd_fstring_cstr (const rspamd_fstring_t *str);
-
/* Compat code */
static guint32
fstrhash_c (gchar c, guint32 hval)
@@ -418,6 +416,22 @@ rspamd_fstring_cstr (const rspamd_fstring_t *s)
return result;
}
+char *
+rspamd_ftok_cstr (const rspamd_ftok_t *s)
+{
+ char *result;
+
+ if (s == NULL) {
+ return NULL;
+ }
+
+ result = g_malloc (s->len + 1);
+ memcpy (result, s->begin, s->len);
+ result[s->len] = '\0';
+
+ return result;
+}
+
gboolean
rspamd_ftok_cstr_equal (const rspamd_ftok_t *s, const gchar *pat,
gboolean icase)