Speed-up gfxterm by slightly agglomerating mallocs.

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2013-05-04 15:07:13 +02:00
parent b7c036bce3
commit 22b06e9685
3 changed files with 45 additions and 44 deletions

View file

@ -274,6 +274,21 @@ grub_unicode_glyph_dup (const struct grub_unicode_glyph *in)
return out;
}
static inline void
grub_unicode_set_glyph (struct grub_unicode_glyph *out,
const struct grub_unicode_glyph *in)
{
grub_memcpy (out, in, sizeof (*in));
if (in->combining)
{
out->combining = grub_malloc (in->ncomb * sizeof (out->combining[0]));
if (!out->combining)
return;
grub_memcpy (out->combining, in->combining,
in->ncomb * sizeof (out->combining[0]));
}
}
static inline struct grub_unicode_glyph *
grub_unicode_glyph_from_code (grub_uint32_t code)
{
@ -287,6 +302,15 @@ grub_unicode_glyph_from_code (grub_uint32_t code)
return ret;
}
static inline void
grub_unicode_set_glyph_from_code (struct grub_unicode_glyph *glyph,
grub_uint32_t code)
{
grub_memset (glyph, 0, sizeof (*glyph));
glyph->base = code;
}
grub_uint32_t
grub_unicode_mirror_code (grub_uint32_t in);
grub_uint32_t