freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] master ec95f9c: [bdf, pcf] Avoid memory zeroing (contd.).


From: Werner Lemberg
Subject: [freetype2] master ec95f9c: [bdf, pcf] Avoid memory zeroing (contd.).
Date: Sun, 2 May 2021 18:31:07 -0400 (EDT)

branch: master
commit ec95f9c9212e9bf9371471f845903bb0e895807d
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: 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.
---
 ChangeLog         |  8 ++++++++
 src/bdf/bdflib.c  | 24 ++++++++++++------------
 src/pcf/pcfread.c |  4 ++--
 3 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f6fbaba..122fc56 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        * src/cid/cidload.c (cid_read_subrs): Tweak allocaton macro.
diff --git a/src/bdf/bdflib.c b/src/bdf/bdflib.c
index af276f4..a27a6fe 100644
--- a/src/bdf/bdflib.c
+++ b/src/bdf/bdflib.c
@@ -844,9 +844,9 @@
     if ( ft_hash_str_lookup( name, &(font->proptbl) ) )
       goto Exit;
 
-    if ( FT_RENEW_ARRAY( font->user_props,
-                         font->nuser_props,
-                         font->nuser_props + 1 ) )
+    if ( FT_QRENEW_ARRAY( font->user_props,
+                          font->nuser_props,
+                          font->nuser_props + 1 ) )
       goto Exit;
 
     p = font->user_props + font->nuser_props;
@@ -941,9 +941,9 @@
     FT_Error   error  = FT_Err_Ok;
 
 
-    if ( FT_RENEW_ARRAY( font->comments,
-                         font->comments_len,
-                         font->comments_len + len + 1 ) )
+    if ( FT_QRENEW_ARRAY( font->comments,
+                          font->comments_len,
+                          font->comments_len + len + 1 ) )
       goto Exit;
 
     cp = font->comments + font->comments_len;
@@ -1158,9 +1158,9 @@
     /* Allocate another property if this is overflowing. */
     if ( font->props_used == font->props_size )
     {
-      if ( FT_RENEW_ARRAY( font->props,
-                           font->props_size,
-                           font->props_size + 1 ) )
+      if ( FT_QRENEW_ARRAY( font->props,
+                            font->props_size,
+                            font->props_size + 1 ) )
         goto Exit;
 
       fp = font->props + font->props_size;
@@ -2279,9 +2279,9 @@
 
       if ( p->font->comments_len > 0 )
       {
-        if ( FT_RENEW_ARRAY( p->font->comments,
-                             p->font->comments_len,
-                             p->font->comments_len + 1 ) )
+        if ( FT_QRENEW_ARRAY( p->font->comments,
+                              p->font->comments_len,
+                              p->font->comments_len + 1 ) )
           goto Fail;
 
         p->font->comments[p->font->comments_len] = 0;
diff --git a/src/pcf/pcfread.c b/src/pcf/pcfread.c
index 439bc6c..060554a 100644
--- a/src/pcf/pcfread.c
+++ b/src/pcf/pcfread.c
@@ -613,7 +613,7 @@ THE SOFTWARE.
 
     strings[string_size] = '\0';
 
-    if ( FT_NEW_ARRAY( properties, nprops ) )
+    if ( FT_QNEW_ARRAY( properties, nprops ) )
       goto Bail;
 
     face->properties = properties;
@@ -766,7 +766,7 @@ THE SOFTWARE.
 
     face->nmetrics = nmetrics + 1;
 
-    if ( FT_NEW_ARRAY( face->metrics, face->nmetrics ) )
+    if ( FT_QNEW_ARRAY( face->metrics, face->nmetrics ) )
       return error;
 
     /* we handle glyph index 0 later on */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]