diff --git a/ChangeLog b/ChangeLog index 06a853789..160165699 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2012-02-11 Werner Lemberg + + Clean up `generic' fields. + + * include/freetype/internal/ftobjs.h (FT_ModuleRec, FT_LibraryRec): + Remove `generic' field since users can't access it. + + * src/base/ftobjs.c (FT_Done_GlyphSlot): Call `generic.finalizer' as + advertised in the documentation of FT_Generic. + (Destroy_Module, FT_Done_Library): Updated to changes in `ftobjs.h'. + 2012-02-07 Werner Lemberg [autofit] Harmonize function arguments. diff --git a/include/freetype/fttypes.h b/include/freetype/fttypes.h index a57ffa69b..325552744 100644 --- a/include/freetype/fttypes.h +++ b/include/freetype/fttypes.h @@ -4,7 +4,7 @@ /* */ /* FreeType simple types definitions (specification only). */ /* */ -/* Copyright 1996-2001, 2002, 2004, 2006, 2007, 2008 by */ +/* Copyright 1996-2002, 2004, 2006-2009, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -434,7 +434,7 @@ FT_BEGIN_HEADER /* variety of FreeType core objects. For example, a text layout API */ /* might want to associate a glyph cache to a given size object. */ /* */ - /* Most FreeType object contains a `generic' field, of type */ + /* Some FreeType object contains a `generic' field, of type */ /* FT_Generic, which usage is left to client applications and font */ /* servers. */ /* */ diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h index 5c227e19e..30e8ad688 100644 --- a/include/freetype/internal/ftobjs.h +++ b/include/freetype/internal/ftobjs.h @@ -4,7 +4,7 @@ /* */ /* The FreeType private base classes (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008, 2010 by */ +/* Copyright 1996-2006, 2008, 2010, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -436,19 +436,16 @@ FT_BEGIN_HEADER /* */ /* memory :: A handle to the memory manager. */ /* */ - /* generic :: A generic structure for user-level extensibility (?). */ - /* */ typedef struct FT_ModuleRec_ { FT_Module_Class* clazz; FT_Library library; FT_Memory memory; - FT_Generic generic; } FT_ModuleRec; - /* typecast an object to a FT_Module */ + /* typecast an object to an FT_Module */ #define FT_MODULE( x ) ((FT_Module)( x )) #define FT_MODULE_CLASS( x ) FT_MODULE( x )->clazz #define FT_MODULE_LIBRARY( x ) FT_MODULE( x )->library @@ -776,9 +773,6 @@ FT_BEGIN_HEADER /* memory :: The library's memory object. Manages memory */ /* allocation. */ /* */ - /* generic :: Client data variable. Used to extend the */ - /* Library class by higher levels and clients. */ - /* */ /* version_major :: The major version number of the library. */ /* */ /* version_minor :: The minor version number of the library. */ @@ -838,8 +832,6 @@ FT_BEGIN_HEADER { FT_Memory memory; /* library's memory manager */ - FT_Generic generic; - FT_Int version_major; FT_Int version_minor; FT_Int version_patch; diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index b776a951b..36ee79749 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -4,7 +4,7 @@ /* */ /* The FreeType private base classes (body). */ /* */ -/* Copyright 1996-2011 by */ +/* Copyright 1996-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -445,6 +445,10 @@ else prev->next = cur->next; + /* finalize client-specific data */ + if ( slot->generic.finalizer ) + slot->generic.finalizer( slot ); + ft_glyphslot_done( slot ); FT_FREE( slot ); break; @@ -4085,10 +4089,10 @@ /* all child faces. */ /* */ /* */ - /* module :: A handle to the target driver object. */ + /* module :: A handle to the target driver object. */ /* */ /* */ - /* The driver _must_ be LOCKED! */ + /* The driver _must_ be LOCKED! */ /* */ static void Destroy_Module( FT_Module module ) @@ -4098,10 +4102,6 @@ FT_Library library = module->library; - /* finalize client-data - before anything else */ - if ( module->generic.finalizer ) - module->generic.finalizer( module ); - if ( library && library->auto_hinter == module ) library->auto_hinter = 0; @@ -4318,6 +4318,7 @@ FT_Module* cur = library->modules; FT_Module* limit = cur + library->num_modules; + for ( ; cur < limit; cur++ ) { if ( cur[0] != module ) @@ -4511,10 +4512,6 @@ memory = library->memory; - /* Discard client-data */ - if ( library->generic.finalizer ) - library->generic.finalizer( library ); - /* * Close all faces in the library. If we don't do this, we can have * some subtle memory leaks.