freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master b25265fe5 3/3: [bdf] Use concise macros.


From: Werner Lemberg
Subject: [freetype2] master b25265fe5 3/3: [bdf] Use concise macros.
Date: Sun, 19 May 2024 23:07:07 -0400 (EDT)

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

    [bdf] Use concise macros.
    
    * src/bdf/bdflib.c (bdf_create_property): Use FT_STRDUP.
    (bdf_parse_glyphs_, bdf_parse_start_): Use FT_DUP for brevity.
---
 src/bdf/bdflib.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/src/bdf/bdflib.c b/src/bdf/bdflib.c
index 0fa7e0a8c..813a4d839 100644
--- a/src/bdf/bdflib.c
+++ b/src/bdf/bdflib.c
@@ -864,15 +864,9 @@
 
     p = font->user_props + font->nuser_props;
 
-    n = ft_strlen( name ) + 1;
-    if ( n > FT_LONG_MAX )
-      return FT_THROW( Invalid_Argument );
-
-    if ( FT_QALLOC( p->name, n ) )
+    if ( FT_STRDUP( p->name, name ) )
       goto Exit;
 
-    FT_MEM_COPY( (char *)p->name, name, n );
-
     p->format     = format;
     p->builtin    = 0;
     p->value.atom = NULL;  /* nothing is ever stored here */
@@ -1442,11 +1436,9 @@
         goto Exit;
       }
 
-      if ( FT_QALLOC( p->glyph_name, slen + 1 ) )
+      if ( FT_DUP( p->glyph_name, s, slen + 1 ) )
         goto Exit;
 
-      FT_MEM_COPY( p->glyph_name, s, slen + 1 );
-
       p->flags |= BDF_GLYPH_;
 
       FT_TRACE4(( DBGMSG1, lineno, s ));
@@ -2051,9 +2043,8 @@
       /* Allowing multiple `FONT' lines (which is invalid) doesn't hurt... */
       FT_FREE( p->font->name );
 
-      if ( FT_QALLOC( p->font->name, slen + 1 ) )
+      if ( FT_DUP( p->font->name, s, slen + 1 ) )
         goto Exit;
-      FT_MEM_COPY( p->font->name, s, slen + 1 );
 
       /* If the font name is an XLFD name, set the spacing to the one in  */
       /* the font name.  If there is no spacing fall back on the default. */



reply via email to

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