diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2011-09-25 07:43:36 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2011-09-25 07:43:36 +0000 |
commit | d7372533d07c3168715f9efdace76da1d3983fee (patch) | |
tree | 65cdb81ca8c7607dc3ec8323723dee71ed511263 | |
parent | 40f05b6ca1709d91dfcd120c7758b36af1cce06b (diff) | |
download | rockbox-d7372533d07c3168715f9efdace76da1d3983fee.tar.gz rockbox-d7372533d07c3168715f9efdace76da1d3983fee.zip |
Partial fix for FS#12289 - comment lines would waste lots of buffer space. Still not perfect but should get 90+% of comments completly ignored now.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30596 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | lib/skin_parser/skin_parser.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/lib/skin_parser/skin_parser.c b/lib/skin_parser/skin_parser.c index c4bd78c8ee..7408252949 100644 --- a/lib/skin_parser/skin_parser.c +++ b/lib/skin_parser/skin_parser.c | |||
@@ -93,7 +93,6 @@ struct skin_element* skin_parse(const char* document) | |||
93 | 93 | ||
94 | while(*cursor != '\0') | 94 | while(*cursor != '\0') |
95 | { | 95 | { |
96 | |||
97 | if(!root) | 96 | if(!root) |
98 | to_write = &root; | 97 | to_write = &root; |
99 | else | 98 | else |
@@ -227,7 +226,17 @@ static struct skin_element* skin_parse_viewport(const char** document) | |||
227 | } | 226 | } |
228 | else | 227 | else |
229 | { | 228 | { |
230 | 229 | #ifdef ROCKBOX | |
230 | /* strip all leading comments */ | ||
231 | while(*cursor == '#') | ||
232 | { | ||
233 | skip_comment(&cursor); | ||
234 | skin_line++; | ||
235 | |||
236 | } | ||
237 | if (check_viewport(cursor)) | ||
238 | break; | ||
239 | #endif | ||
231 | *to_write = skin_parse_line(&cursor); | 240 | *to_write = skin_parse_line(&cursor); |
232 | last = *to_write; | 241 | last = *to_write; |
233 | if(!last) | 242 | if(!last) |
@@ -243,6 +252,18 @@ static struct skin_element* skin_parse_viewport(const char** document) | |||
243 | cursor++; | 252 | cursor++; |
244 | skin_line++; | 253 | skin_line++; |
245 | } | 254 | } |
255 | #ifdef ROCKBOX | ||
256 | /* strip all comments */ | ||
257 | while(*cursor == '#') | ||
258 | { | ||
259 | skip_comment(&cursor); | ||
260 | skin_line++; | ||
261 | |||
262 | } | ||
263 | if (check_viewport(cursor)) | ||
264 | break; | ||
265 | #endif | ||
266 | |||
246 | } | 267 | } |
247 | while(*cursor != '\0' && !(check_viewport(cursor) && cursor != *document)); | 268 | while(*cursor != '\0' && !(check_viewport(cursor) && cursor != *document)); |
248 | 269 | ||
@@ -359,7 +380,6 @@ static struct skin_element* skin_parse_line_optional(const char** document, | |||
359 | } | 380 | } |
360 | } | 381 | } |
361 | 382 | ||
362 | |||
363 | /* Moving up the calling function's pointer */ | 383 | /* Moving up the calling function's pointer */ |
364 | *document = cursor; | 384 | *document = cursor; |
365 | 385 | ||