[HarfBuzz] harfbuzz: Branch 'master' - 5 commits
Behdad Esfahbod
behdad at kemper.freedesktop.org
Sat Jan 31 22:31:21 PST 2009
src/harfbuzz-dump-main.c | 144 ---------------------------------------------
src/harfbuzz-gdef.c | 8 --
src/harfbuzz-gpos.c | 148 ++++++++++-------------------------------------
src/harfbuzz-gsub.c | 31 ---------
src/harfbuzz-impl.c | 4 -
src/harfbuzz-open.c | 30 ---------
src/harfbuzz-open.h | 8 --
7 files changed, 39 insertions(+), 334 deletions(-)
New commits:
commit 3d2873ee3bb249a9962ee388c8e16c0f86d93988
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Sun Feb 1 01:30:51 2009 -0500
Allocate all Mark2Array array rows in a single ALLOC call
Saves over 100 alloc calls when loading DejaVu Sans.
Backport from pango.
diff --git a/src/harfbuzz-gpos.c b/src/harfbuzz-gpos.c
index a6e0df4..fbd1c0d 100644
--- a/src/harfbuzz-gpos.c
+++ b/src/harfbuzz-gpos.c
@@ -2719,11 +2719,11 @@ static HB_Error Load_Mark2Array( HB_Mark2Array* m2a,
{
HB_Error error;
- HB_UShort k, m, n, count;
+ HB_UShort k, m, n, count;
HB_UInt cur_offset, new_offset, base_offset;
- HB_Mark2Record* m2r;
- HB_Anchor* m2an;
+ HB_Mark2Record *m2r;
+ HB_Anchor *m2an, *m2ans;
base_offset = FILE_Pos();
@@ -2742,19 +2742,19 @@ static HB_Error Load_Mark2Array( HB_Mark2Array* m2a,
m2r = m2a->Mark2Record;
- for ( m = 0; m < count; m++ )
- {
- m2r[m].Mark2Anchor = NULL;
+ m2ans = NULL;
- if ( ALLOC_ARRAY( m2r[m].Mark2Anchor, num_classes, HB_Anchor ) )
- goto Fail;
+ if ( ALLOC_ARRAY( m2ans, count * num_classes, HB_Anchor ) )
+ goto Fail;
- m2an = m2r[m].Mark2Anchor;
+ for ( m = 0; m < count; m++ )
+ {
+ m2an = m2r[m].Mark2Anchor = m2ans + m * num_classes;
for ( n = 0; n < num_classes; n++ )
{
if ( ACCESS_Frame( 2L ) )
- goto Fail0;
+ goto Fail;
new_offset = GET_UShort() + base_offset;
@@ -2770,30 +2770,15 @@ static HB_Error Load_Mark2Array( HB_Mark2Array* m2a,
cur_offset = FILE_Pos();
if ( FILE_Seek( new_offset ) ||
( error = Load_Anchor( &m2an[n], stream ) ) != HB_Err_Ok )
- goto Fail0;
+ goto Fail;
(void)FILE_Seek( cur_offset );
}
-
- continue;
- Fail0:
- for ( k = 0; k < n; k++ )
- Free_Anchor( &m2an[k] );
- goto Fail;
}
return HB_Err_Ok;
Fail:
- for ( k = 0; k < m; k++ )
- {
- m2an = m2r[k].Mark2Anchor;
-
- for ( n = 0; n < num_classes; n++ )
- Free_Anchor( &m2an[n] );
-
- FREE( m2an );
- }
-
+ FREE( m2ans );
FREE( m2r );
return error;
}
@@ -2802,27 +2787,17 @@ Fail:
static void Free_Mark2Array( HB_Mark2Array* m2a,
HB_UShort num_classes )
{
- HB_UShort m, n, count;
-
- HB_Mark2Record* m2r;
- HB_Anchor* m2an;
+ HB_Mark2Record *m2r;
+ HB_Anchor *m2ans;
+ HB_UNUSED(num_classes);
if ( m2a->Mark2Record )
{
- count = m2a->Mark2Count;
m2r = m2a->Mark2Record;
+ m2ans = m2r[0].Mark2Anchor;
- for ( m = 0; m < count; m++ )
- {
- m2an = m2r[m].Mark2Anchor;
-
- for ( n = 0; n < num_classes; n++ )
- Free_Anchor( &m2an[n] );
-
- FREE( m2an );
- }
-
+ FREE( m2ans );
FREE( m2r );
}
}
commit 4284c57cdb62ab5b0b8edfe0181dce853d708025
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Sun Feb 1 01:29:55 2009 -0500
Remove ClassDef->Defined field
This is the comment accompanying it:
The `Defined' field is not defined in the OpenType specification
but apparently needed for processing fonts like trado.ttf: This
font refers to a class which contains not a single element. We
map such classes to class 0.
The comment is correct that trado.ttf (MS Traditional Arabic) uses
such classes. However, in my testing I couldn't identify any
problems with the font if the special handling is removed. I also
processed as many fonts as I could get my hand on and trado.ttf was
the only not-totally-broken font hitting the special-case code.
DejaVu fonts hit it too, but I'm sure they do not require the
special-handling code. Most probably, that code introduces bugs
in them.
The special-casing was consuming lots of memory. EIGHT MEGABYTES
for loading DejaVu Sans! While this could be complete fixed, I
decided to remove the special-handling code altogether. I don't
think it will make any real difference, and if it does, we'll fix
fonts. Such hacks will not be in harfbuzz-ng anyway.
Bug originally reported by nsf.
Backported from pango.
diff --git a/src/harfbuzz-gdef.c b/src/harfbuzz-gdef.c
index 6e3693e..ff3a1f4 100644
--- a/src/harfbuzz-gdef.c
+++ b/src/harfbuzz-gdef.c
@@ -775,8 +775,6 @@ static HB_Error Make_ClassRange( HB_ClassDefinition* cd,
crr[index].End = end;
crr[index].Class = class;
- cd->Defined[class] = TRUE;
-
return HB_Err_Ok;
}
@@ -806,11 +804,6 @@ HB_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef,
gcd->ClassFormat = 2;
- /* A GlyphClassDef table contains at most 5 different class values */
-
- if ( ALLOC_ARRAY( gcd->Defined, 5, HB_Bool ) )
- return error;
-
gcd->cd.cd2.ClassRangeCount = 0;
gcd->cd.cd2.ClassRangeRecord = NULL;
@@ -958,7 +951,6 @@ Fail3:
FREE( gcd->cd.cd2.ClassRangeRecord );
Fail4:
- FREE( gcd->Defined );
return error;
}
diff --git a/src/harfbuzz-gpos.c b/src/harfbuzz-gpos.c
index a2e20b9..a6e0df4 100644
--- a/src/harfbuzz-gpos.c
+++ b/src/harfbuzz-gpos.c
@@ -3346,7 +3346,6 @@ static HB_Error Load_PosClassRule( HB_ContextPosFormat2* cpf2,
HB_UShort* c;
HB_PosLookupRecord* plr;
- HB_Bool* d;
if ( ACCESS_Frame( 4L ) )
@@ -3368,22 +3367,13 @@ static HB_Error Load_PosClassRule( HB_ContextPosFormat2* cpf2,
return error;
c = pcr->Class;
- d = cpf2->ClassDef.Defined;
if ( ACCESS_Frame( count * 2L ) )
goto Fail2;
for ( n = 0; n < count; n++ )
- {
c[n] = GET_UShort();
- /* We check whether the specific class is used at all. If not,
- class 0 is used instead. */
-
- if ( !d[c[n]] )
- c[n] = 0;
- }
-
FORGET_Frame();
pcr->PosLookupRecord = NULL;
@@ -4360,7 +4350,6 @@ static HB_Error Load_ChainPosClassRule(
HB_UShort* i;
HB_UShort* l;
HB_PosLookupRecord* plr;
- HB_Bool* d;
if ( ACCESS_Frame( 2L ) )
@@ -4381,22 +4370,13 @@ static HB_Error Load_ChainPosClassRule(
return error;
b = cpcr->Backtrack;
- d = ccpf2->BacktrackClassDef.Defined;
if ( ACCESS_Frame( count * 2L ) )
goto Fail4;
for ( n = 0; n < count; n++ )
- {
b[n] = GET_UShort();
- /* We check whether the specific class is used at all. If not,
- class 0 is used instead. */
-
- if ( !d[b[n]] )
- b[n] = 0;
- }
-
FORGET_Frame();
if ( ACCESS_Frame( 2L ) )
@@ -4417,19 +4397,13 @@ static HB_Error Load_ChainPosClassRule(
goto Fail4;
i = cpcr->Input;
- d = ccpf2->InputClassDef.Defined;
if ( ACCESS_Frame( count * 2L ) )
goto Fail3;
for ( n = 0; n < count; n++ )
- {
i[n] = GET_UShort();
- if ( !d[i[n]] )
- i[n] = 0;
- }
-
FORGET_Frame();
if ( ACCESS_Frame( 2L ) )
@@ -4450,19 +4424,13 @@ static HB_Error Load_ChainPosClassRule(
goto Fail3;
l = cpcr->Lookahead;
- d = ccpf2->LookaheadClassDef.Defined;
if ( ACCESS_Frame( count * 2L ) )
goto Fail2;
for ( n = 0; n < count; n++ )
- {
l[n] = GET_UShort();
- if ( !d[l[n]] )
- l[n] = 0;
- }
-
FORGET_Frame();
if ( ACCESS_Frame( 2L ) )
diff --git a/src/harfbuzz-gsub.c b/src/harfbuzz-gsub.c
index b869fa0..5f08040 100644
--- a/src/harfbuzz-gsub.c
+++ b/src/harfbuzz-gsub.c
@@ -1385,7 +1385,6 @@ static HB_Error Load_SubClassRule( HB_ContextSubstFormat2* csf2,
HB_UShort* c;
HB_SubstLookupRecord* slr;
- HB_Bool* d;
if ( ACCESS_Frame( 4L ) )
@@ -1407,21 +1406,13 @@ static HB_Error Load_SubClassRule( HB_ContextSubstFormat2* csf2,
return error;
c = scr->Class;
- d = csf2->ClassDef.Defined;
if ( ACCESS_Frame( count * 2L ) )
goto Fail2;
for ( n = 0; n < count; n++ )
- {
c[n] = GET_UShort();
- /* We check whether the specific class is used at all. If not,
- class 0 is used instead. */
- if ( !d[c[n]] )
- c[n] = 0;
- }
-
FORGET_Frame();
scr->SubstLookupRecord = NULL;
@@ -2379,7 +2370,6 @@ static HB_Error Load_ChainSubClassRule(
HB_UShort* i;
HB_UShort* l;
HB_SubstLookupRecord* slr;
- HB_Bool* d;
if ( ACCESS_Frame( 2L ) )
@@ -2400,22 +2390,13 @@ static HB_Error Load_ChainSubClassRule(
return error;
b = cscr->Backtrack;
- d = ccsf2->BacktrackClassDef.Defined;
if ( ACCESS_Frame( count * 2L ) )
goto Fail4;
for ( n = 0; n < count; n++ )
- {
b[n] = GET_UShort();
- /* We check whether the specific class is used at all. If not,
- class 0 is used instead. */
-
- if ( !d[b[n]] )
- b[n] = 0;
- }
-
FORGET_Frame();
if ( ACCESS_Frame( 2L ) )
@@ -2436,19 +2417,13 @@ static HB_Error Load_ChainSubClassRule(
goto Fail4;
i = cscr->Input;
- d = ccsf2->InputClassDef.Defined;
if ( ACCESS_Frame( count * 2L ) )
goto Fail3;
for ( n = 0; n < count; n++ )
- {
i[n] = GET_UShort();
- if ( !d[i[n]] )
- i[n] = 0;
- }
-
FORGET_Frame();
if ( ACCESS_Frame( 2L ) )
@@ -2469,19 +2444,13 @@ static HB_Error Load_ChainSubClassRule(
goto Fail3;
l = cscr->Lookahead;
- d = ccsf2->LookaheadClassDef.Defined;
if ( ACCESS_Frame( count * 2L ) )
goto Fail2;
for ( n = 0; n < count; n++ )
- {
l[n] = GET_UShort();
- if ( !d[l[n]] )
- l[n] = 0;
- }
-
FORGET_Frame();
if ( ACCESS_Frame( 2L ) )
diff --git a/src/harfbuzz-open.c b/src/harfbuzz-open.c
index c277f20..cde5465 100644
--- a/src/harfbuzz-open.c
+++ b/src/harfbuzz-open.c
@@ -942,7 +942,6 @@ static HB_Error Load_ClassDef1( HB_ClassDefinition* cd,
HB_UShort n, count;
HB_UShort* cva;
- HB_Bool* d;
HB_ClassDefFormat1* cdf1;
@@ -967,7 +966,6 @@ static HB_Error Load_ClassDef1( HB_ClassDefinition* cd,
if ( ALLOC_ARRAY( cdf1->ClassValueArray, count, HB_UShort ) )
return error;
- d = cd->Defined;
cva = cdf1->ClassValueArray;
if ( ACCESS_Frame( count * 2L ) )
@@ -981,7 +979,6 @@ static HB_Error Load_ClassDef1( HB_ClassDefinition* cd,
error = ERR(HB_Err_Invalid_SubTable);
goto Fail;
}
- d[cva[n]] = TRUE;
}
FORGET_Frame();
@@ -1012,7 +1009,6 @@ static HB_Error Load_ClassDef2( HB_ClassDefinition* cd,
HB_UShort n, count;
HB_ClassRangeRecord* crr;
- HB_Bool* d;
HB_ClassDefFormat2* cdf2;
@@ -1032,7 +1028,6 @@ static HB_Error Load_ClassDef2( HB_ClassDefinition* cd,
if ( ALLOC_ARRAY( cdf2->ClassRangeRecord, count, HB_ClassRangeRecord ) )
return error;
- d = cd->Defined;
crr = cdf2->ClassRangeRecord;
if ( ACCESS_Frame( count * 6L ) )
@@ -1056,8 +1051,6 @@ static HB_Error Load_ClassDef2( HB_ClassDefinition* cd,
n--;
count--;
}
- else
- d[crr[n].Class] = TRUE;
}
FORGET_Frame();
@@ -1088,11 +1081,8 @@ _HB_OPEN_Load_ClassDefinition( HB_ClassDefinition* cd,
{
HB_Error error;
- if ( ALLOC_ARRAY( cd->Defined, limit, HB_Bool ) )
- return error;
-
if ( ACCESS_Frame( 2L ) )
- goto Fail;
+ return error;
cd->ClassFormat = GET_UShort();
@@ -1106,15 +1096,11 @@ _HB_OPEN_Load_ClassDefinition( HB_ClassDefinition* cd,
}
if ( error )
- goto Fail;
+ return error;
cd->loaded = TRUE;
return HB_Err_Ok;
-
-Fail:
- FREE( cd->Defined );
- return error;
}
@@ -1123,20 +1109,12 @@ _HB_OPEN_Load_EmptyClassDefinition( HB_ClassDefinition* cd )
{
HB_Error error;
- if ( ALLOC_ARRAY( cd->Defined, 1, HB_Bool ) )
- return error;
-
cd->ClassFormat = 1; /* Meaningless */
- cd->Defined[0] = FALSE;
if ( ALLOC_ARRAY( cd->cd.cd1.ClassValueArray, 1, HB_UShort ) )
- goto Fail;
+ return error;
return HB_Err_Ok;
-
-Fail:
- FREE( cd->Defined );
- return error;
}
HB_INTERNAL HB_Error
@@ -1171,8 +1149,6 @@ _HB_OPEN_Free_ClassDefinition( HB_ClassDefinition* cd )
if ( !cd->loaded )
return;
- FREE( cd->Defined );
-
switch ( cd->ClassFormat )
{
case 1: Free_ClassDef1( &cd->cd.cd1 ); break;
diff --git a/src/harfbuzz-open.h b/src/harfbuzz-open.h
index e092673..bdc6358 100644
--- a/src/harfbuzz-open.h
+++ b/src/harfbuzz-open.h
@@ -240,18 +240,10 @@ struct HB_ClassDefFormat2_
typedef struct HB_ClassDefFormat2_ HB_ClassDefFormat2;
-/* The `Defined' field is not defined in the OpenType specification but
- apparently needed for processing fonts like trado.ttf: This font
- refers to a class which contains not a single element. We map such
- classes to class 0. */
-
struct HB_ClassDefinition_
{
HB_Bool loaded;
- HB_Bool* Defined; /* array of Booleans.
- If Defined[n] is FALSE,
- class n contains no glyphs. */
HB_UShort ClassFormat; /* 1 or 2 */
union
commit b3a58f4bcb50cc02f0ea4781768defbdf7ed58fe
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Sun Feb 1 01:28:27 2009 -0500
Use calloc(), instead of malloc()ing and memset()ing.
Backport from pango.
diff --git a/src/harfbuzz-impl.c b/src/harfbuzz-impl.c
index 5a8e075..96859cb 100644
--- a/src/harfbuzz-impl.c
+++ b/src/harfbuzz-impl.c
@@ -38,11 +38,9 @@ _hb_alloc(HB_UInt size,
if ( size > 0 )
{
- block = malloc( size );
+ block = calloc( 1, size );
if ( !block )
error = ERR(HB_Err_Out_Of_Memory);
- else
- memset( (char*)block, 0, (size_t)size );
}
*perror = error;
commit 96ea3fae3faad871d3c9590ecc8e5e54ab1042da
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Sun Feb 1 01:27:38 2009 -0500
Remove old cruft
Backport from pango.
diff --git a/src/harfbuzz-dump-main.c b/src/harfbuzz-dump-main.c
index 3d294da..dfb35fb 100644
--- a/src/harfbuzz-dump-main.c
+++ b/src/harfbuzz-dump-main.c
@@ -40,140 +40,6 @@ croak (const char *situation, HB_Error error)
exit (1);
}
-#if 0
-enum {
- I = 1 << 0,
- M = 1 << 1,
- F = 1 << 2,
- L = 1 << 3
-};
-
-static void
-print_tag (HB_UInt tag)
-{
- fprintf (stderr, "%c%c%c%c",
- (unsigned char)(tag >> 24),
- (unsigned char)((tag >> 16) & 0xff),
- (unsigned char)((tag >> 8) & 0xff),
- (unsigned char)(tag & 0xff));
-}
-
-static void
-maybe_add_feature (HB_GSUB gsub,
- HB_UShort script_index,
- HB_UInt tag,
- HB_UShort property)
-{
- HB_Error error;
- HB_UShort feature_index;
-
- /* 0xffff == default language system */
- error = HB_GSUB_Select_Feature (gsub, tag, script_index, 0xffff, &feature_index);
-
- if (error)
- {
- if (error == HB_Err_Not_Covered)
- {
- print_tag (tag);
- fprintf (stderr, " not covered, ignored\n");
- return;
- }
-
- croak ("HB_GSUB_Select_Feature", error);
- }
-
- if ((error = HB_GSUB_Add_Feature (gsub, feature_index, property)))
- croak ("HB_GSUB_Add_Feature", error);
-}
-
-static void
-add_features (HB_GSUB gsub)
-{
- HB_Error error;
- HB_UInt tag = HB_MAKE_TAG ('a', 'r', 'a', 'b');
- HB_UShort script_index;
-
- error = HB_GSUB_Select_Script (gsub, tag, &script_index);
-
- if (error)
- {
- if (error == HB_Err_Not_Covered)
- {
- fprintf (stderr, "Arabic not covered, no features used\n");
- return;
- }
-
- croak ("HB_GSUB_Select_Script", error);
- }
-
- maybe_add_feature (gsub, script_index, HB_MAKE_TAG ('i', 'n', 'i', 't'), I);
- maybe_add_feature (gsub, script_index, HB_MAKE_TAG ('m', 'e', 'd', 'i'), M);
- maybe_add_feature (gsub, script_index, HB_MAKE_TAG ('f', 'i', 'n', 'a'), F);
- maybe_add_feature (gsub, script_index, HB_MAKE_TAG ('l', 'i', 'g', 'a'), L);
-}
-#endif
-
-#if 0
-void
-dump_string (HB_GSUB_String *str)
-{
- HB_UInt i;
-
- fprintf (stderr, ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
- for (i = 0; i < str->length; i++)
- {
- fprintf (stderr, "%2lu: %#06x %#06x %4d %4d\n",
- i,
- str->string[i],
- str->properties[i],
- str->components[i],
- str->ligIDs[i]);
- }
- fprintf (stderr, "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
-}
-
-HB_UShort arabic_str[] = { 0x645, 0x643, 0x64a, 0x644, 0x639, 0x20, 0x645, 0x627, 0x644, 0x633, 0x644, 0x627 };
-HB_UShort arabic_props[] = { I|L, M|L, M|L, M|L, M|L, F|L, I|L, M|L, M|L, M|L, M|L, F|L };
-
-void
-try_string (FT_Library library,
- HB_Font font,
- HB_GSUB gsub)
-{
- HB_Error error;
- HB_GSUB_String *in_str;
- HB_GSUB_String *out_str;
- HB_UInt i;
-
- if ((error = HB_GSUB_String_New (font->memory, &in_str)))
- croak ("HB_GSUB_String_New", error);
- if ((error = HB_GSUB_String_New (font->memory, &out_str)))
- croak ("HB_GSUB_String_New", error);
-
- if ((error = HB_GSUB_String_Set_Length (in_str, N_ELEMENTS (arabic_str))))
- croak ("HB_GSUB_String_Set_Length", error);
-
- for (i=0; i < N_ELEMENTS (arabic_str); i++)
- {
- in_str->string[i] = FT_Get_Char_Index (font, arabic_str[i]);
- in_str->properties[i] = arabic_props[i];
- in_str->components[i] = i;
- in_str->ligIDs[i] = i;
- }
-
- if ((error = HB_GSUB_Apply_String (gsub, in_str, out_str)))
- croak ("HB_GSUB_Apply_String", error);
-
- dump_string (in_str);
- dump_string (out_str);
-
- if ((error = HB_GSUB_String_Done (in_str)))
- croak ("HB_GSUB_String_New", error);
- if ((error = HB_GSUB_String_Done (out_str)))
- croak ("HB_GSUB_String_New", error);
-}
-#endif
-
int
main (int argc, char **argv)
{
@@ -185,7 +51,7 @@ main (int argc, char **argv)
if (argc != 2)
{
- fprintf (stderr, "Usage: ottest MYFONT.TTF\n");
+ fprintf (stderr, "Usage: harfbuzz-dump MYFONT.TTF\n");
exit(1);
}
@@ -220,14 +86,6 @@ main (int argc, char **argv)
printf ("</OpenType>\n");
-#if 0
- select_cmap (font);
-
- add_features (gsub);
- try_string (library, font, gsub);
-#endif
-
-
if ((error = FT_Done_Face (font)))
croak ("FT_Done_Face", error);
commit 68ed5bd9636ba9cf5ecd5935b2fc525296cfc694
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Sun Feb 1 01:25:40 2009 -0500
Allocate all BaseArray array rows in a single ALLOC call.
Saves over 2000 alloc calls when loading DejaVu Sans!
Backport from Pango.
diff --git a/src/harfbuzz-gpos.c b/src/harfbuzz-gpos.c
index 7a769f1..a2e20b9 100644
--- a/src/harfbuzz-gpos.c
+++ b/src/harfbuzz-gpos.c
@@ -1984,11 +1984,11 @@ static HB_Error Load_BaseArray( HB_BaseArray* ba,
{
HB_Error error;
- HB_UShort m, n, k, count;
+ HB_UShort m, n, count;
HB_UInt cur_offset, new_offset, base_offset;
- HB_BaseRecord* br;
- HB_Anchor* ban;
+ HB_BaseRecord *br;
+ HB_Anchor *ban, *bans;
base_offset = FILE_Pos();
@@ -2007,19 +2007,21 @@ static HB_Error Load_BaseArray( HB_BaseArray* ba,
br = ba->BaseRecord;
+ bans = NULL;
+
+ if ( ALLOC_ARRAY( bans, count * num_classes, HB_Anchor ) )
+ goto Fail;
+
for ( m = 0; m < count; m++ )
{
br[m].BaseAnchor = NULL;
- if ( ALLOC_ARRAY( br[m].BaseAnchor, num_classes, HB_Anchor ) )
- goto Fail;
-
- ban = br[m].BaseAnchor;
+ ban = br[m].BaseAnchor = bans + m * num_classes;
for ( n = 0; n < num_classes; n++ )
{
if ( ACCESS_Frame( 2L ) )
- goto Fail0;
+ goto Fail;
new_offset = GET_UShort() + base_offset;
@@ -2037,30 +2039,15 @@ static HB_Error Load_BaseArray( HB_BaseArray* ba,
cur_offset = FILE_Pos();
if ( FILE_Seek( new_offset ) ||
( error = Load_Anchor( &ban[n], stream ) ) != HB_Err_Ok )
- goto Fail0;
+ goto Fail;
(void)FILE_Seek( cur_offset );
}
-
- continue;
- Fail0:
- for ( k = 0; k < n; k++ )
- Free_Anchor( &ban[k] );
- goto Fail;
}
return HB_Err_Ok;
Fail:
- for ( k = 0; k < m; k++ )
- {
- ban = br[k].BaseAnchor;
-
- for ( n = 0; n < num_classes; n++ )
- Free_Anchor( &ban[n] );
-
- FREE( ban );
- }
-
+ FREE( bans );
FREE( br );
return error;
}
@@ -2069,27 +2056,17 @@ Fail:
static void Free_BaseArray( HB_BaseArray* ba,
HB_UShort num_classes )
{
- HB_UShort m, n, count;
-
- HB_BaseRecord* br;
- HB_Anchor* ban;
+ HB_BaseRecord *br;
+ HB_Anchor *bans;
+ HB_UNUSED(num_classes);
if ( ba->BaseRecord )
{
- count = ba->BaseCount;
br = ba->BaseRecord;
+ bans = br[0].BaseAnchor;
- for ( m = 0; m < count; m++ )
- {
- ban = br[m].BaseAnchor;
-
- for ( n = 0; n < num_classes; n++ )
- Free_Anchor( &ban[n] );
-
- FREE( ban );
- }
-
+ FREE( bans );
FREE( br );
}
}
More information about the HarfBuzz
mailing list