Agglomerate more mallocs to speed-up gfxterm.

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2013-05-04 22:23:23 +02:00
parent 22b06e9685
commit 85002bf34a
15 changed files with 254 additions and 187 deletions

View file

@ -42,7 +42,6 @@ grub_font_draw_string (const char *str, grub_font_t font,
int left_x, int baseline_y)
{
int x;
struct grub_font_glyph *glyph;
grub_uint32_t *logical;
grub_ssize_t logical_len, visual_len;
struct grub_unicode_glyph *visual, *ptr;
@ -60,18 +59,18 @@ grub_font_draw_string (const char *str, grub_font_t font,
for (ptr = visual, x = left_x; ptr < visual + visual_len; ptr++)
{
grub_err_t err;
struct grub_font_glyph *glyph;
glyph = grub_font_construct_glyph (font, ptr);
if (!glyph)
return grub_errno;
err = grub_font_draw_glyph (glyph, color, x, baseline_y);
x += glyph->device_width;
grub_free (glyph);
if (err)
return err;
}
for (ptr = visual; ptr < visual + visual_len; ptr++)
grub_free (ptr->combining);
grub_unicode_destroy_glyph (ptr);
grub_free (visual);
return GRUB_ERR_NONE;
@ -104,7 +103,7 @@ grub_font_get_string_width (grub_font_t font, const char *str)
&glyph);
width += grub_font_get_constructed_device_width (font, &glyph);
grub_free (glyph.combining);
grub_unicode_destroy_glyph (&glyph);
}
grub_free (logical);

View file

@ -87,6 +87,7 @@ list_destroy (void *vself)
self->scrollbar_thumb->destroy (self->scrollbar_thumb);
if (self->scrollbar_frame)
self->scrollbar_frame->destroy (self->scrollbar_frame);
grub_free (self->scrollbar_thumb_pattern);
grub_free (self);
}

View file

@ -59,6 +59,9 @@ static void
progress_bar_destroy (void *vself)
{
grub_gui_progress_bar_t self = vself;
grub_free (self->theme_dir);
grub_free (self->template);
grub_free (self->id);
grub_gfxmenu_timeout_unregister ((grub_gui_component_t) self);
grub_free (self);
}