diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-02-08 18:45:08 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-02-08 18:45:08 +0000 |
commit | 3c870de8e3a3ea5640127ef45584cdbc6b1d3840 (patch) | |
tree | 2f1cb9f35c96341aed4ea20e93584f0738d63c4f | |
parent | ff660e595fb04857e73e1f84d1e13d412fb980ef (diff) | |
download | rspamd-3c870de8e3a3ea5640127ef45584cdbc6b1d3840.tar.gz rspamd-3c870de8e3a3ea5640127ef45584cdbc6b1d3840.zip |
Fix for the new libucl API
-rw-r--r-- | src/controller.c | 2 | ||||
-rw-r--r-- | src/fuzzy_storage.c | 2 | ||||
-rw-r--r-- | src/libserver/dynamic_cfg.c | 2 | ||||
-rw-r--r-- | src/libserver/roll_history.c | 2 | ||||
-rw-r--r-- | src/libserver/symbols_cache.c | 2 | ||||
-rw-r--r-- | src/libutil/str_util.c | 14 | ||||
-rw-r--r-- | src/libutil/str_util.h | 17 | ||||
-rw-r--r-- | src/rspamadm/keypair.c | 2 |
8 files changed, 27 insertions, 16 deletions
diff --git a/src/controller.c b/src/controller.c index b4602414f..c88e51ef2 100644 --- a/src/controller.c +++ b/src/controller.c @@ -2346,7 +2346,7 @@ rspamd_controller_store_saved_stats (struct rspamd_controller_worker_ctx *ctx) ucl_object_emit_full (top, UCL_EMIT_JSON_COMPACT, - ucl_object_emit_fd_funcs (fd)); + ucl_object_emit_fd_funcs (fd), NULL); rspamd_file_unlock (fd, FALSE); close (fd); diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c index 3810bb640..71dfda2ef 100644 --- a/src/fuzzy_storage.c +++ b/src/fuzzy_storage.c @@ -1028,7 +1028,7 @@ rspamd_fuzzy_storage_stat (struct rspamd_main *rspamd_main, obj = rspamd_fuzzy_stat_to_ucl (ctx, TRUE); emit_subr = ucl_object_emit_fd_funcs (outfd); - ucl_object_emit_full (obj, UCL_EMIT_JSON_COMPACT, emit_subr); + ucl_object_emit_full (obj, UCL_EMIT_JSON_COMPACT, emit_subr, NULL); ucl_object_emit_funcs_free (emit_subr); ucl_object_unref (obj); /* Rewind output file */ diff --git a/src/libserver/dynamic_cfg.c b/src/libserver/dynamic_cfg.c index 1149a92e0..92447a037 100644 --- a/src/libserver/dynamic_cfg.c +++ b/src/libserver/dynamic_cfg.c @@ -290,7 +290,7 @@ dump_dynamic_config (struct rspamd_config *cfg) } if (!ucl_object_emit_full (cfg->current_dynamic_conf, UCL_EMIT_JSON, - ucl_object_emit_fd_funcs (fd))) { + ucl_object_emit_fd_funcs (fd), NULL)) { msg_err ("cannot emit ucl object: %s", strerror (errno)); close (fd); return FALSE; diff --git a/src/libserver/roll_history.c b/src/libserver/roll_history.c index e94eccad6..89185825a 100644 --- a/src/libserver/roll_history.c +++ b/src/libserver/roll_history.c @@ -372,7 +372,7 @@ rspamd_roll_history_save (struct roll_history *history, const gchar *filename) } emitter_func = ucl_object_emit_fd_funcs (fd); - ucl_object_emit_full (obj, UCL_EMIT_JSON_COMPACT, emitter_func); + ucl_object_emit_full (obj, UCL_EMIT_JSON_COMPACT, emitter_func, NULL); ucl_object_emit_funcs_free (emitter_func); ucl_object_unref (obj); diff --git a/src/libserver/symbols_cache.c b/src/libserver/symbols_cache.c index b8a0170e4..77cc75c2d 100644 --- a/src/libserver/symbols_cache.c +++ b/src/libserver/symbols_cache.c @@ -500,7 +500,7 @@ rspamd_symbols_cache_save_items (struct symbols_cache *cache, const gchar *name) g_assert (f != NULL); efunc = ucl_object_emit_file_funcs (f); - ret = ucl_object_emit_full (top, UCL_EMIT_JSON_COMPACT, efunc); + ret = ucl_object_emit_full (top, UCL_EMIT_JSON_COMPACT, efunc, NULL); ucl_object_emit_funcs_free (efunc); ucl_object_unref (top); fclose (f); diff --git a/src/libutil/str_util.c b/src/libutil/str_util.c index f4bd75d69..6daf83993 100644 --- a/src/libutil/str_util.c +++ b/src/libutil/str_util.c @@ -1511,9 +1511,10 @@ rspamd_gstring_append_double (double val, void *ud) } void -rspamd_ucl_emit_gstring (const ucl_object_t *obj, +rspamd_ucl_emit_gstring_comments (const ucl_object_t *obj, enum ucl_emitter emit_type, - GString *target) + GString *target, + const ucl_object_t *comments) { struct ucl_emitter_functions func = { .ucl_emitter_append_character = rspamd_gstring_append_character, @@ -1523,7 +1524,7 @@ rspamd_ucl_emit_gstring (const ucl_object_t *obj, }; func.ud = target; - ucl_object_emit_full (obj, emit_type, &func); + ucl_object_emit_full (obj, emit_type, &func, comments); } /* @@ -1579,9 +1580,10 @@ rspamd_fstring_emit_append_double (double val, void *ud) } void -rspamd_ucl_emit_fstring (const ucl_object_t *obj, +rspamd_ucl_emit_fstring_comments (const ucl_object_t *obj, enum ucl_emitter emit_type, - rspamd_fstring_t **buf) + rspamd_fstring_t **buf, + const ucl_object_t *comments) { struct ucl_emitter_functions func = { .ucl_emitter_append_character = rspamd_fstring_emit_append_character, @@ -1591,5 +1593,5 @@ rspamd_ucl_emit_fstring (const ucl_object_t *obj, }; func.ud = buf; - ucl_object_emit_full (obj, emit_type, &func); + ucl_object_emit_full (obj, emit_type, &func, comments); } diff --git a/src/libutil/str_util.h b/src/libutil/str_util.h index 8e26b37dc..75cc6fb0a 100644 --- a/src/libutil/str_util.h +++ b/src/libutil/str_util.h @@ -260,24 +260,33 @@ goffset rspamd_substring_search_caseless (const gchar *in, gsize inlen, */ goffset rspamd_string_find_eoh (GString *input); + +#define rspamd_ucl_emit_gstring(o, t, target) \ + rspamd_ucl_emit_gstring_comments((o), (t), (target), NULL) /** * Emit UCL object to gstring * @param obj object to emit * @param emit_type emitter type + * @param comments optional comments object * @param target target string */ -void rspamd_ucl_emit_gstring (const ucl_object_t *obj, +void rspamd_ucl_emit_gstring_comments (const ucl_object_t *obj, enum ucl_emitter emit_type, - GString *target); + GString *target, + const ucl_object_t *comments); +#define rspamd_ucl_emit_fstring(o, t, target) \ + rspamd_ucl_emit_fstring_comments((o), (t), (target), NULL) /** * Emit UCL object to fstring * @param obj object to emit * @param emit_type emitter type + * * @param comments optional comments object * @param target target string */ -void rspamd_ucl_emit_fstring (const ucl_object_t *obj, +void rspamd_ucl_emit_fstring_comments (const ucl_object_t *obj, enum ucl_emitter emit_type, - rspamd_fstring_t **target); + rspamd_fstring_t **target, + const ucl_object_t *comments); #endif /* SRC_LIBUTIL_STR_UTIL_H_ */ diff --git a/src/rspamadm/keypair.c b/src/rspamadm/keypair.c index ab1e25166..c339a7d88 100644 --- a/src/rspamadm/keypair.c +++ b/src/rspamadm/keypair.c @@ -122,7 +122,7 @@ rspamadm_keypair (gint argc, gchar **argv) if (ucl) { ucl_out = rspamd_keypair_to_ucl (kp, hex_encode); ucl_emit_subr = ucl_object_emit_file_funcs (stdout); - ucl_object_emit_full (ucl_out, UCL_EMIT_CONFIG, ucl_emit_subr); + ucl_object_emit_full (ucl_out, UCL_EMIT_CONFIG, ucl_emit_subr, NULL); ucl_object_emit_funcs_free (ucl_emit_subr); ucl_object_unref (ucl_out); } |