Use more vector resize_exact
This commit is contained in:
parent
b6be455020
commit
8f2345ca36
|
@ -88,9 +88,7 @@ struct hb_bit_set_t
|
|||
bool resize (unsigned int count, bool clear = true)
|
||||
{
|
||||
if (unlikely (!successful)) return false;
|
||||
pages.alloc (count, true); /* Exact allocation. */
|
||||
page_map.alloc (count, true); /* Exact allocation. */
|
||||
if (unlikely (!pages.resize (count, clear) || !page_map.resize (count, clear)))
|
||||
if (unlikely (!pages.resize (count, clear, true) || !page_map.resize (count, clear, true)))
|
||||
{
|
||||
pages.resize (page_map.length);
|
||||
successful = false;
|
||||
|
@ -424,8 +422,7 @@ struct hb_bit_set_t
|
|||
private:
|
||||
bool allocate_compact_workspace (hb_vector_t<unsigned>& workspace)
|
||||
{
|
||||
workspace.alloc (pages.length, true);
|
||||
if (unlikely (!workspace.resize (pages.length)))
|
||||
if (unlikely (!workspace.resize_exact (pages.length)))
|
||||
{
|
||||
successful = false;
|
||||
return false;
|
||||
|
|
|
@ -45,8 +45,7 @@ struct blend_arg_t : number_t
|
|||
numValues = numValues_;
|
||||
valueIndex = valueIndex_;
|
||||
unsigned numBlends = blends_.length;
|
||||
deltas.alloc (numBlends, true); /* Exact-size allocation. */
|
||||
if (unlikely (!deltas.resize (numBlends)))
|
||||
if (unlikely (!deltas.resize_exact (numBlends)))
|
||||
return;
|
||||
for (unsigned int i = 0; i < numBlends; i++)
|
||||
deltas.arrayZ[i] = blends_.arrayZ[i];
|
||||
|
@ -119,8 +118,7 @@ struct cff2_cs_interp_env_t : cs_interp_env_t<ELEM, CFF2Subrs>
|
|||
region_count = varStore->varStore.get_region_index_count (get_ivs ());
|
||||
if (do_blend)
|
||||
{
|
||||
scalars.alloc (region_count, true);
|
||||
if (unlikely (!scalars.resize (region_count)))
|
||||
if (unlikely (!scalars.resize_exact (region_count)))
|
||||
SUPER::set_error ();
|
||||
else
|
||||
varStore->varStore.get_region_scalars (get_ivs (), coords, num_coords,
|
||||
|
|
Loading…
Reference in New Issue