From 6980c1e9988a7c959876ad77b760e042272a9ec2 Mon Sep 17 00:00:00 2001 From: Robert Bieber Date: Sat, 29 May 2010 00:04:04 +0000 Subject: Theme Editor: Got code generation tentatively working along with a solid C++ tree structure for WPS parse trees git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26367 a1c6a512-1295-4272-9138-f99709370657 --- utils/themeeditor/skin_parser.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) (limited to 'utils/themeeditor/skin_parser.c') diff --git a/utils/themeeditor/skin_parser.c b/utils/themeeditor/skin_parser.c index a6c5ea41a2..2f68cdf1c8 100644 --- a/utils/themeeditor/skin_parser.c +++ b/utils/themeeditor/skin_parser.c @@ -103,7 +103,14 @@ struct skin_element* skin_parse(char* document) else to_write = &(last->next); - if(sublines) + if(*cursor == '\n') + { + *to_write = skin_alloc_element(); + skin_parse_newline(*to_write, &cursor); + if(!last) + return NULL; + } + else if(sublines) { *to_write = skin_parse_sublines(&cursor); last = *to_write; @@ -202,23 +209,6 @@ struct skin_element* skin_parse_line_optional(char** document, int conditional) } } - if(*cursor == '\n') - { - /* Allocating memory if necessary */ - if(root) - { - current->next = skin_alloc_element(); - current = current->next; - } - else - { - current = skin_alloc_element(); - root = current; - } - if(!skin_parse_newline(current, &cursor)) - return NULL; - } - /* Moving up the calling function's pointer */ *document = cursor; -- cgit v1.2.3