aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/fstring.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-10-07 14:24:15 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-10-07 14:24:15 +0100
commit4af2ef67e91974144de793be97b8866d2a63c658 (patch)
treedf3027d94959e08623b64190f25dafb5456ad4c1 /src/libutil/fstring.c
parentee9def66ca6120fdaa9acc623b8c8e49b1b2ea93 (diff)
downloadrspamd-4af2ef67e91974144de793be97b8866d2a63c658.tar.gz
rspamd-4af2ef67e91974144de793be97b8866d2a63c658.zip
Add emitting of ucl object to rspamd_fstring_t.
Diffstat (limited to 'src/libutil/fstring.c')
-rw-r--r--src/libutil/fstring.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/libutil/fstring.c b/src/libutil/fstring.c
index e63912c9a..32fabcea4 100644
--- a/src/libutil/fstring.c
+++ b/src/libutil/fstring.c
@@ -144,6 +144,22 @@ rspamd_fstring_append (rspamd_fstring_t *str, const char *in, gsize len)
return str;
}
+rspamd_fstring_t *
+rspamd_fstring_append_chars (rspamd_fstring_t *str,
+ char c, gsize len)
+{
+ gsize avail = fstravail (str);
+
+ if (avail < len) {
+ str = rspamd_fstring_grow (str, len);
+ }
+
+ memset (str->str + str->len, c, len);
+ str->len += len;
+
+ return str;
+}
+
void
rspamd_fstring_erase (rspamd_fstring_t *str, gsize pos, gsize len)
{
@@ -329,4 +345,16 @@ rspamd_fstring_mapped_ftok_free (gpointer p)
storage = (rspamd_fstring_t *) (tok->begin - 2 * sizeof (gsize));
rspamd_fstring_free (storage);
g_slice_free1 (sizeof (*tok), tok);
+}
+
+rspamd_ftok_t *
+rspamd_ftok_map (const rspamd_fstring_t *s)
+{
+ rspamd_ftok_t *tok;
+
+ g_assert (s != NULL);
+
+ tok = g_slice_alloc (sizeof (*tok));
+ tok->begin = s->str;
+ tok->len = s->len;
} \ No newline at end of file