diff options
| author | Björn Stenberg <bjorn@haxx.se> | 2011-10-05 11:44:22 +0000 |
|---|---|---|
| committer | Björn Stenberg <bjorn@haxx.se> | 2011-10-05 11:44:22 +0000 |
| commit | 725ed0ad3fd78b92746a31fed8e484208fb74b70 (patch) | |
| tree | 9ce2c6e8c4bfa18c71f1c6782ba9e17dcd55a668 | |
| parent | a604345ae11bd7aae977c49bf6bb058f40b970a7 (diff) | |
| download | rockbox-725ed0ad3fd78b92746a31fed8e484208fb74b70.zip rockbox-725ed0ad3fd78b92746a31fed8e484208fb74b70.tar.gz rockbox-725ed0ad3fd78b92746a31fed8e484208fb74b70.tar.bz2 rockbox-725ed0ad3fd78b92746a31fed8e484208fb74b70.tar.xz | |
Only alloc if necessary. Patch by Jonathan Gordon.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30716 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | firmware/font.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/firmware/font.c b/firmware/font.c index f00ff0e..0546061 100644 --- a/firmware/font.c +++ b/firmware/font.c @@ -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; } |