Deleted Added
full compact
ucl_emitter.c (275223) ucl_emitter.c (279549)
1/* Copyright (c) 2013, Vsevolod Stakhov
2 * All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 * * Redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer.
8 * * Redistributions in binary form must reproduce the above copyright

--- 236 unchanged lines hidden (view full) ---

245 * @param obj object to write
246 * @param compact compact flag
247 */
248static void
249ucl_emitter_common_start_array (struct ucl_emitter_context *ctx,
250 const ucl_object_t *obj, bool print_key, bool compact)
251{
252 const ucl_object_t *cur;
1/* Copyright (c) 2013, Vsevolod Stakhov
2 * All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 * * Redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer.
8 * * Redistributions in binary form must reproduce the above copyright

--- 236 unchanged lines hidden (view full) ---

245 * @param obj object to write
246 * @param compact compact flag
247 */
248static void
249ucl_emitter_common_start_array (struct ucl_emitter_context *ctx,
250 const ucl_object_t *obj, bool print_key, bool compact)
251{
252 const ucl_object_t *cur;
253 ucl_object_iter_t iter = NULL;
253 const struct ucl_emitter_functions *func = ctx->func;
254 bool first = true;
255
256 ucl_emitter_print_key (print_key, ctx, obj, compact);
257
258 if (compact) {
259 func->ucl_emitter_append_character ('[', 1, func->ud);
260 }
261 else {
262 func->ucl_emitter_append_len ("[\n", 2, func->ud);
263 }
264
265 ctx->indent ++;
266
267 if (obj->type == UCL_ARRAY) {
268 /* explicit array */
254 const struct ucl_emitter_functions *func = ctx->func;
255 bool first = true;
256
257 ucl_emitter_print_key (print_key, ctx, obj, compact);
258
259 if (compact) {
260 func->ucl_emitter_append_character ('[', 1, func->ud);
261 }
262 else {
263 func->ucl_emitter_append_len ("[\n", 2, func->ud);
264 }
265
266 ctx->indent ++;
267
268 if (obj->type == UCL_ARRAY) {
269 /* explicit array */
269 cur = obj->value.av;
270 while ((cur = ucl_iterate_object (obj, &iter, true)) != NULL) {
271 ucl_emitter_common_elt (ctx, cur, first, false, compact);
272 first = false;
273 }
270 }
271 else {
272 /* implicit array */
273 cur = obj;
274 }
275 else {
276 /* implicit array */
277 cur = obj;
278 while (cur) {
279 ucl_emitter_common_elt (ctx, cur, first, false, compact);
280 first = false;
281 cur = cur->next;
282 }
274 }
275
283 }
284
276 while (cur) {
277 ucl_emitter_common_elt (ctx, cur, first, false, compact);
278 first = false;
279 cur = cur->next;
280 }
285
281}
282
283/**
284 * Start emit standard UCL object
285 * @param ctx emitter context
286 * @param obj object to write
287 * @param compact compact flag
288 */

--- 218 unchanged lines hidden ---
286}
287
288/**
289 * Start emit standard UCL object
290 * @param ctx emitter context
291 * @param obj object to write
292 * @param compact compact flag
293 */

--- 218 unchanged lines hidden ---