[cairo-scaled-font-subsets] Shortcut empty subset.

If the font_subset if empty, avoid allocating zero bytes and iterating
over the empty hash table.
This commit is contained in:
Chris Wilson 2007-05-11 10:14:57 +01:00
parent c175cf7b83
commit 5b2b008048

View file

@ -618,6 +618,10 @@ _cairo_scaled_font_subsets_foreach_internal (cairo_scaled_font_subsets_t
collection.glyphs_size = font_subsets->max_glyphs_per_scaled_subset_used;
else
collection.glyphs_size = font_subsets->max_glyphs_per_unscaled_subset_used;
if (! collection.glyphs_size)
return CAIRO_STATUS_SUCCESS;
collection.glyphs = malloc (collection.glyphs_size * sizeof(unsigned long));
if (collection.glyphs == NULL)
return CAIRO_STATUS_NO_MEMORY;