[bdf,pcf] Avoid memory zeroing (contd.).

* src/bdf/bdflib.c (bdf_create_property, _bdf_add_comment,
_bdf_add_property, bdf_load_font): Tweak allocation macros.
* src/pcf/pcfread.c (pcf_get_properties, pcf_get_metrics): Ditto.
This commit is contained in:
Alexei Podtelezhnikov 2021-05-02 18:30:22 -04:00
parent d911cb5392
commit ec95f9c921
3 changed files with 22 additions and 14 deletions

View File

@ -1,3 +1,11 @@
2021-04-25 Alexei Podtelezhnikov <apodtele@gmail.com>
[bdf,pcf] Avoid memory zeroing (contd.).
* src/bdf/bdflib.c (bdf_create_property, _bdf_add_comment,
_bdf_add_property, bdf_load_font): Tweak allocation macros.
* src/pcf/pcfread.c (pcf_get_properties, pcf_get_metrics): Ditto.
2021-05-01 Alexei Podtelezhnikov <apodtele@gmail.com> 2021-05-01 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cid/cidload.c (cid_read_subrs): Tweak allocaton macro. * src/cid/cidload.c (cid_read_subrs): Tweak allocaton macro.

View File

@ -844,9 +844,9 @@
if ( ft_hash_str_lookup( name, &(font->proptbl) ) ) if ( ft_hash_str_lookup( name, &(font->proptbl) ) )
goto Exit; goto Exit;
if ( FT_RENEW_ARRAY( font->user_props, if ( FT_QRENEW_ARRAY( font->user_props,
font->nuser_props, font->nuser_props,
font->nuser_props + 1 ) ) font->nuser_props + 1 ) )
goto Exit; goto Exit;
p = font->user_props + font->nuser_props; p = font->user_props + font->nuser_props;
@ -941,9 +941,9 @@
FT_Error error = FT_Err_Ok; FT_Error error = FT_Err_Ok;
if ( FT_RENEW_ARRAY( font->comments, if ( FT_QRENEW_ARRAY( font->comments,
font->comments_len, font->comments_len,
font->comments_len + len + 1 ) ) font->comments_len + len + 1 ) )
goto Exit; goto Exit;
cp = font->comments + font->comments_len; cp = font->comments + font->comments_len;
@ -1158,9 +1158,9 @@
/* Allocate another property if this is overflowing. */ /* Allocate another property if this is overflowing. */
if ( font->props_used == font->props_size ) if ( font->props_used == font->props_size )
{ {
if ( FT_RENEW_ARRAY( font->props, if ( FT_QRENEW_ARRAY( font->props,
font->props_size, font->props_size,
font->props_size + 1 ) ) font->props_size + 1 ) )
goto Exit; goto Exit;
fp = font->props + font->props_size; fp = font->props + font->props_size;
@ -2279,9 +2279,9 @@
if ( p->font->comments_len > 0 ) if ( p->font->comments_len > 0 )
{ {
if ( FT_RENEW_ARRAY( p->font->comments, if ( FT_QRENEW_ARRAY( p->font->comments,
p->font->comments_len, p->font->comments_len,
p->font->comments_len + 1 ) ) p->font->comments_len + 1 ) )
goto Fail; goto Fail;
p->font->comments[p->font->comments_len] = 0; p->font->comments[p->font->comments_len] = 0;

View File

@ -613,7 +613,7 @@ THE SOFTWARE.
strings[string_size] = '\0'; strings[string_size] = '\0';
if ( FT_NEW_ARRAY( properties, nprops ) ) if ( FT_QNEW_ARRAY( properties, nprops ) )
goto Bail; goto Bail;
face->properties = properties; face->properties = properties;
@ -766,7 +766,7 @@ THE SOFTWARE.
face->nmetrics = nmetrics + 1; face->nmetrics = nmetrics + 1;
if ( FT_NEW_ARRAY( face->metrics, face->nmetrics ) ) if ( FT_QNEW_ARRAY( face->metrics, face->nmetrics ) )
return error; return error;
/* we handle glyph index 0 later on */ /* we handle glyph index 0 later on */