freetype-commit
[Top][All Lists]
Advanced

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

[freetype2-demos] master fa731c3 2/2: [ftdump] Always finalize FreeType.


From: Werner LEMBERG
Subject: [freetype2-demos] master fa731c3 2/2: [ftdump] Always finalize FreeType.
Date: Sat, 28 Jan 2017 15:04:09 +0000 (UTC)

branch: master
commit fa731c3baa81cf21a826d2677aefa1bdc52b213c
Author: Werner Lemberg <address@hidden>
Commit: Werner Lemberg <address@hidden>

    [ftdump] Always finalize FreeType.
    
    * src/ftdump.c (PanicZ, usage): Add `library' argument so that we
    can call `FT_Done_FreeType'.
    (main): Updated.
---
 ChangeLog    |    8 ++++++++
 src/ftdump.c |   20 +++++++++++++-------
 2 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8508380..975dfa9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2017-01-28  Werner Lemberg  <address@hidden>
 
+       [ftdump] Always finalize FreeType.
+
+       * src/ftdump.c (PanicZ, usage): Add `library' argument so that we
+       can call `FT_Done_FreeType'.
+       (main): Updated.
+
+2017-01-28  Werner Lemberg  <address@hidden>
+
        [ftdump] Sync with current FreeType.
 
        * src/ftdump.c (name_id): Use updated ID macros.
diff --git a/src/ftdump.c b/src/ftdump.c
index 632b46f..952450c 100644
--- a/src/ftdump.c
+++ b/src/ftdump.c
@@ -44,8 +44,11 @@
 
   /* PanicZ */
   static void
-  PanicZ( const char*  message )
+  PanicZ( FT_Library   library,
+          const char*  message )
   {
+    FT_Done_FreeType( library );
+
     fprintf( stderr, "%s\n  error = 0x%04x\n", message, error );
     exit( 1 );
   }
@@ -63,8 +66,11 @@
 
 
   static void
-  usage( char*  execname )
+  usage( FT_Library  library,
+         char*       execname )
   {
+    FT_Done_FreeType( library );
+
     fprintf( stderr,
       "\n"
       "ftdump: simple font dumper -- part of the FreeType project\n"
@@ -738,7 +744,7 @@
     /* Initialize engine */
     error = FT_Init_FreeType( &library );
     if ( error )
-      PanicZ( "Could not initialize FreeType library" );
+      PanicZ( library, "Could not initialize FreeType library" );
 
     while ( 1 )
     {
@@ -781,7 +787,7 @@
         break;
 
       default:
-        usage( execname );
+        usage( library, execname );
         break;
       }
     }
@@ -790,7 +796,7 @@
     argv += optind;
 
     if ( argc != 1 )
-      usage( execname );
+      usage( library, execname );
 
     file = 0;
 
@@ -824,7 +830,7 @@
     /* Load face */
     error = FT_New_Face( library, filename, 0, &face );
     if ( error )
-      PanicZ( "Could not open face." );
+      PanicZ( library, "Could not open face." );
 
   Success:
     num_faces = face->num_faces;
@@ -839,7 +845,7 @@
     {
       error = FT_New_Face( library, filename, i, &face );
       if ( error )
-        PanicZ( "Could not open face." );
+        PanicZ( library, "Could not open face." );
 
       printf( "\n----- Face number: %d -----\n\n", i );
       Print_Name( face );



reply via email to

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