summaryrefslogtreecommitdiffstats
path: root/src/xplist.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xplist.c')
-rw-r--r--src/xplist.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/xplist.c b/src/xplist.c
index d905b92..bb27f53 100644
--- a/src/xplist.c
+++ b/src/xplist.c
@@ -199,12 +199,12 @@ static void node_to_xml(node_t* node, bytearray_t **outbuf, uint32_t depth)
199 case PLIST_ARRAY: 199 case PLIST_ARRAY:
200 tag = XPLIST_ARRAY; 200 tag = XPLIST_ARRAY;
201 tag_len = XPLIST_ARRAY_LEN; 201 tag_len = XPLIST_ARRAY_LEN;
202 isStruct = TRUE; 202 isStruct = (node->children) ? TRUE : FALSE;
203 break; 203 break;
204 case PLIST_DICT: 204 case PLIST_DICT:
205 tag = XPLIST_DICT; 205 tag = XPLIST_DICT;
206 tag_len = XPLIST_DICT_LEN; 206 tag_len = XPLIST_DICT_LEN;
207 isStruct = TRUE; 207 isStruct = (node->children) ? TRUE : FALSE;
208 break; 208 break;
209 case PLIST_DATE: 209 case PLIST_DATE:
210 tag = XPLIST_DATE; 210 tag = XPLIST_DATE;
@@ -350,11 +350,11 @@ static void node_to_xml(node_t* node, bytearray_t **outbuf, uint32_t depth)
350 } 350 }
351 free(val); 351 free(val);
352 352
353 /* add return for structured types */ 353 if (isStruct) {
354 if (node_data->type == PLIST_ARRAY || node_data->type == PLIST_DICT) 354 /* add newline for structured types */
355 str_buf_append(*outbuf, "\n", 1); 355 str_buf_append(*outbuf, "\n", 1);
356 356
357 if (isStruct) { 357 /* add child nodes */
358 if (node_data->type == PLIST_DICT && node->children) { 358 if (node_data->type == PLIST_DICT && node->children) {
359 assert((node->children->count % 2) == 0); 359 assert((node->children->count % 2) == 0);
360 } 360 }
@@ -362,10 +362,8 @@ static void node_to_xml(node_t* node, bytearray_t **outbuf, uint32_t depth)
362 for (ch = node_first_child(node); ch; ch = node_next_sibling(ch)) { 362 for (ch = node_first_child(node); ch; ch = node_next_sibling(ch)) {
363 node_to_xml(ch, outbuf, depth+1); 363 node_to_xml(ch, outbuf, depth+1);
364 } 364 }
365 }
366 365
367 /* fix indent for structured types */ 366 /* fix indent for structured types */
368 if (node_data->type == PLIST_ARRAY || node_data->type == PLIST_DICT) {
369 for (i = 0; i < depth; i++) { 367 for (i = 0; i < depth; i++) {
370 str_buf_append(*outbuf, "\t", 1); 368 str_buf_append(*outbuf, "\t", 1);
371 } 369 }