Only alloc if necessary. Patch by Jonathan Gordon.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30716 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Björn Stenberg 2011-10-05 11:44:22 +00:00
parent a604345ae1
commit 725ed0ad3f
1 changed files with 7 additions and 4 deletions

View File

@ -594,10 +594,13 @@ struct font* font_get(int font)
return &sysfont;
while (1) {
struct buflib_alloc_data *alloc = core_get_data(buflib_allocations[font]);
pf = &alloc->font;
if (pf && pf->height)
return pf;
if (buflib_allocations[font] > 0)
{
struct buflib_alloc_data *alloc = core_get_data(buflib_allocations[font]);
pf = &alloc->font;
if (pf && pf->height)
return pf;
}
if (--font < 0)
return &sysfont;
}