freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master 6423ddb8a: * src/cff/cffload.c (cff_encoding_load): O


From: Werner Lemberg
Subject: [freetype2] master 6423ddb8a: * src/cff/cffload.c (cff_encoding_load): Optimize array zeroing.
Date: Sat, 25 Feb 2023 22:18:30 -0500 (EST)

branch: master
commit 6423ddb8a077c44ddf90e6b149c308a801a7bb78
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>

    * src/cff/cffload.c (cff_encoding_load): Optimize array zeroing.
    
    This is unnecessary for predefined standard and expert encodings.
    Even for custom encodings the arrays might be already zeroed when
    CFF_FontRec is created but we keep it just in case.
---
 src/cff/cffload.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/cff/cffload.c b/src/cff/cffload.c
index 4b8c6e16c..be5fce21b 100644
--- a/src/cff/cffload.c
+++ b/src/cff/cffload.c
@@ -1650,13 +1650,6 @@
       goto Exit;
     }
 
-    /* Zero out the code to gid/sid mappings. */
-    for ( j = 0; j < 256; j++ )
-    {
-      encoding->sids [j] = 0;
-      encoding->codes[j] = 0;
-    }
-
     /* Note: The encoding table in a CFF font is indexed by glyph index;  */
     /* the first encoded glyph index is 1.  Hence, we read the character  */
     /* code (`glyph_code') at index j and make the assignment:            */
@@ -1671,6 +1664,10 @@
 
     if ( offset > 1 )
     {
+      /* Zero out the code to gid/sid mappings. */
+      FT_ARRAY_ZERO( encoding->sids,  256 );
+      FT_ARRAY_ZERO( encoding->codes, 256 );
+
       encoding->offset = base_offset + offset;
 
       /* we need to parse the table to determine its size */



reply via email to

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