mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 10:07:38 -04:00
skin_parser Reduce ram usage for conditionals on %ft() file text tags
the skin engine calls the tags for each conditional to check them since %ft erases it's var if the file doesn't exist %?ft is likely only being called to check existance of a file or line of a file this patch allocates 2 bytes to satisify the conditional if the line exists Change-Id: Ic74bf5fec9a5d9b6724692c49a0997bfa4cff48d
This commit is contained in:
parent
ebd1021fe4
commit
33cbefb310
3 changed files with 9 additions and 0 deletions
|
@ -1380,7 +1380,13 @@ static int parse_filetext(struct skin_element *element,
|
|||
goto failure;
|
||||
}
|
||||
|
||||
if (element->is_conditional)
|
||||
{
|
||||
rd = 1; /* just alloc enough for the conditional to work*/
|
||||
}
|
||||
|
||||
buf[rd] = '\0';
|
||||
|
||||
char * skinbuf = skin_buffer_alloc(rd+1);
|
||||
|
||||
if (!skinbuf)
|
||||
|
|
|
@ -932,6 +932,7 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc
|
|||
* value */
|
||||
element->type = TAG;
|
||||
element->line = skin_line;
|
||||
element->is_conditional = true;
|
||||
|
||||
/* Parsing the tag first */
|
||||
if(!skin_parse_tag(element, &cursor))
|
||||
|
@ -1152,6 +1153,7 @@ static struct skin_element* skin_alloc_element()
|
|||
retval->params_count = 0;
|
||||
retval->children_count = 0;
|
||||
retval->data = INVALID_OFFSET;
|
||||
retval->is_conditional = false;
|
||||
|
||||
return retval;
|
||||
|
||||
|
|
|
@ -146,6 +146,7 @@ struct skin_element
|
|||
enum skin_element_type type;
|
||||
/* Number of elements in the params array */
|
||||
char params_count;
|
||||
bool is_conditional;
|
||||
};
|
||||
|
||||
enum skin_cb_returnvalue
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue