aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil/util.c')
-rw-r--r--src/libutil/util.c80
1 files changed, 0 insertions, 80 deletions
diff --git a/src/libutil/util.c b/src/libutil/util.c
index fd66cc321..5706a2f49 100644
--- a/src/libutil/util.c
+++ b/src/libutil/util.c
@@ -1743,86 +1743,6 @@ restart:
#endif
}
-/*
- * GString ucl emitting functions
- */
-static int
-rspamd_gstring_append_character (unsigned char c, size_t len, void *ud)
-{
- GString *buf = ud;
- gsize old_len;
-
- if (len == 1) {
- g_string_append_c (buf, c);
- }
- else {
- if (buf->allocated_len - buf->len <= len) {
- old_len = buf->len;
- g_string_set_size (buf, buf->len + len + 1);
- buf->len = old_len;
- }
- memset (&buf->str[buf->len], c, len);
- buf->len += len;
- }
-
- return 0;
-}
-
-static int
-rspamd_gstring_append_len (const unsigned char *str, size_t len, void *ud)
-{
- GString *buf = ud;
-
- g_string_append_len (buf, str, len);
-
- return 0;
-}
-
-static int
-rspamd_gstring_append_int (int64_t val, void *ud)
-{
- GString *buf = ud;
-
- rspamd_printf_gstring (buf, "%L", (intmax_t)val);
- return 0;
-}
-
-static int
-rspamd_gstring_append_double (double val, void *ud)
-{
- GString *buf = ud;
- const double delta = 0.0000001;
-
- if (val == (double)(int)val) {
- rspamd_printf_gstring (buf, "%.1f", val);
- }
- else if (fabs (val - (double)(int)val) < delta) {
- /* Write at maximum precision */
- rspamd_printf_gstring (buf, "%.*g", DBL_DIG, val);
- }
- else {
- rspamd_printf_gstring (buf, "%f", val);
- }
-
- return 0;
-}
-
-void
-rspamd_ucl_emit_gstring (ucl_object_t *obj,
- enum ucl_emitter emit_type,
- GString *target)
-{
- struct ucl_emitter_functions func = {
- .ucl_emitter_append_character = rspamd_gstring_append_character,
- .ucl_emitter_append_len = rspamd_gstring_append_len,
- .ucl_emitter_append_int = rspamd_gstring_append_int,
- .ucl_emitter_append_double = rspamd_gstring_append_double
- };
-
- func.ud = target;
- ucl_object_emit_full (obj, emit_type, &func);
-}
-
gdouble
rspamd_get_ticks (void)
{