* src/base/ftobjs.c (destroy_charmaps): New function. (destroy_face, open_face): Use `destroy_charmaps'.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
diff --git a/ChangeLog b/ChangeLog
index e7d38ec..3710b45 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-01-03 Masatake YAMATO <jet@gyve.org>
+
+ * src/base/ftobjs.c (destroy_charmaps): New function.
+ (destroy_face, open_face): Use `destroy_charmaps'.
+
2004-01-01 Werner Lemberg <wl@gnu.org>
* docs/CHANGES: Updated.
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 8e02377..b48288c 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -4,7 +4,7 @@
/* */
/* The FreeType private base classes (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003 by */
+/* Copyright 1996-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -669,6 +669,28 @@
}
+ static void
+ destroy_charmaps( FT_Face face,
+ FT_Memory memory )
+ {
+ FT_Int n;
+
+
+ for ( n = 0; n < face->num_charmaps; n++ )
+ {
+ FT_CMap cmap = FT_CMAP( face->charmaps[n] );
+
+
+ FT_CMap_Done( cmap );
+
+ face->charmaps[n] = NULL;
+ }
+
+ FT_FREE( face->charmaps );
+ face->num_charmaps = 0;
+ }
+
+
/* destructor for faces list */
static void
destroy_face( FT_Memory memory,
@@ -699,25 +721,8 @@
face->generic.finalizer( face );
/* discard charmaps */
- {
- FT_Int n;
-
-
- for ( n = 0; n < face->num_charmaps; n++ )
- {
- FT_CMap cmap = FT_CMAP( face->charmaps[n] );
-
-
- FT_CMap_Done( cmap );
-
- face->charmaps[n] = NULL;
- }
-
- FT_FREE( face->charmaps );
- face->num_charmaps = 0;
- }
-
-
+ destroy_charmaps( face, memory );
+
/* finalize format-specific stuff */
if ( clazz->done_face )
clazz->done_face( face );
@@ -924,6 +929,7 @@
Fail:
if ( error )
{
+ destroy_charmaps( face, memory );
clazz->done_face( face );
FT_FREE( internal );
FT_FREE( face );
diff --git a/src/winfonts/winfnt.c b/src/winfonts/winfnt.c
index e6f7edc..abca96a 100644
--- a/src/winfonts/winfnt.c
+++ b/src/winfonts/winfnt.c
@@ -4,7 +4,7 @@
/* */
/* FreeType font driver for Windows FNT/FON files */
/* */
-/* Copyright 1996-2001, 2002, 2003 by */
+/* Copyright 1996-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */