aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libucl/ucl_emitter.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-10-13 17:05:19 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-10-13 17:05:19 +0100
commitbb4a6a9ae9a22fa3a9d5d6d80f8db6f1fd345c0a (patch)
treea6329d843da8a15acf844e4d91101ed2e920f620 /contrib/libucl/ucl_emitter.c
parent9aac6193c2265ea954fbddd5b3a98ebf0026101f (diff)
downloadrspamd-bb4a6a9ae9a22fa3a9d5d6d80f8db6f1fd345c0a.tar.gz
rspamd-bb4a6a9ae9a22fa3a9d5d6d80f8db6f1fd345c0a.zip
Sync with libucl.
Diffstat (limited to 'contrib/libucl/ucl_emitter.c')
-rw-r--r--contrib/libucl/ucl_emitter.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/contrib/libucl/ucl_emitter.c b/contrib/libucl/ucl_emitter.c
index 12cd31c7d..8bfbf09b8 100644
--- a/contrib/libucl/ucl_emitter.c
+++ b/contrib/libucl/ucl_emitter.c
@@ -498,7 +498,14 @@ ucl_emit_msgpack_elt (struct ucl_emitter_context *ctx,
case UCL_STRING:
ucl_emitter_print_key_msgpack (print_key, ctx, obj);
- ucl_emitter_print_string_msgpack (ctx, obj->value.sv, obj->len);
+
+ if (obj->flags & UCL_OBJECT_BINARY) {
+ ucl_emitter_print_binary_string_msgpack (ctx, obj->value.sv,
+ obj->len);
+ }
+ else {
+ ucl_emitter_print_string_msgpack (ctx, obj->value.sv, obj->len);
+ }
break;
case UCL_NULL:
@@ -509,27 +516,31 @@ ucl_emit_msgpack_elt (struct ucl_emitter_context *ctx,
case UCL_OBJECT:
ucl_emitter_print_key_msgpack (print_key, ctx, obj);
ucl_emit_msgpack_start_obj (ctx, obj, print_key);
- it = ucl_object_iterate_new (obj);
+ it = NULL;
- while ((cur = ucl_object_iterate_safe (it, true)) != NULL) {
+ while ((cur = ucl_iterate_object (obj, &it, true)) != NULL) {
LL_FOREACH (cur, celt) {
ucl_emit_msgpack_elt (ctx, celt, false, true);
+ /* XXX:
+ * in msgpack the length of objects is encoded within a single elt
+ * so in case of multi-value keys we are using merely the first
+ * element ignoring others
+ */
+ break;
}
}
- ucl_object_iterate_free (it);
break;
case UCL_ARRAY:
ucl_emitter_print_key_msgpack (print_key, ctx, obj);
ucl_emit_msgpack_start_array (ctx, obj, print_key);
- it = ucl_object_iterate_new (obj);
+ it = NULL;
- while ((cur = ucl_object_iterate_safe (it, true)) != NULL) {
+ while ((cur = ucl_iterate_object (obj, &it, true)) != NULL) {
ucl_emit_msgpack_elt (ctx, cur, false, false);
}
- ucl_object_iterate_free (it);
break;
case UCL_USERDATA: