diff options
author | Andreas Kling <andreas.kling@nokia.com> | 2010-06-15 09:44:11 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2010-06-15 14:58:29 +0200 |
commit | e9ba90f8633d44fa251166d6fe4e1e12949a2ae7 (patch) | |
tree | a497f3cfcabe16dd29a78f1bb49a704140100f2c | |
parent | 5ab1e41c5b7d5dbe8d1a0d31dfcde582c5b2f390 (diff) |
Pack all internal Harfbuzz structures.
This cuts persistent memory consumption by over 1MB when simply browsing
some popular websites with QtWebKit.
Signed-off-by: Simon Hausmann <simon.hausmann@nokia.com>
Signed-off-by: Lars Knoll <lars.knoll@nokia.com>
-rw-r--r-- | src/harfbuzz-buffer.h | 8 | ||||
-rw-r--r-- | src/harfbuzz-gdef-private.h | 8 | ||||
-rw-r--r-- | src/harfbuzz-gdef.h | 7 | ||||
-rw-r--r-- | src/harfbuzz-global.h | 4 | ||||
-rw-r--r-- | src/harfbuzz-gpos-private.h | 7 | ||||
-rw-r--r-- | src/harfbuzz-gsub-private.h | 7 | ||||
-rw-r--r-- | src/harfbuzz-gsub.h | 7 | ||||
-rw-r--r-- | src/harfbuzz-open.h | 7 | ||||
-rw-r--r-- | src/harfbuzz-shaper.h | 8 | ||||
-rw-r--r-- | src/harfbuzz-stream.h | 7 |
10 files changed, 70 insertions, 0 deletions
diff --git a/src/harfbuzz-buffer.h b/src/harfbuzz-buffer.h index b134407..7e6ad83 100644 --- a/src/harfbuzz-buffer.h +++ b/src/harfbuzz-buffer.h @@ -32,6 +32,10 @@ HB_BEGIN_HEADER +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(push, 1) +#endif + typedef struct HB_GlyphItemRec_ { HB_UInt gindex; HB_UInt properties; @@ -89,6 +93,10 @@ hb_buffer_add_glyph( HB_Buffer buffer, HB_UInt properties, HB_UInt cluster ); +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(pop) +#endif + HB_END_HEADER #endif /* HARFBUZZ_BUFFER_H */ diff --git a/src/harfbuzz-gdef-private.h b/src/harfbuzz-gdef-private.h index 0e9c03c..da29d99 100644 --- a/src/harfbuzz-gdef-private.h +++ b/src/harfbuzz-gdef-private.h @@ -34,6 +34,10 @@ HB_BEGIN_HEADER +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(push, 1) +#endif + /* Attachment related structures */ struct HB_AttachPoint_ @@ -123,6 +127,10 @@ _HB_GDEF_LoadMarkAttachClassDef_From_LookupFlags( HB_GDEFHeader* gdef, HB_Lookup* lo, HB_UShort num_lookups ); +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(pop) +#endif + HB_END_HEADER #endif /* HARFBUZZ_GDEF_PRIVATE_H */ diff --git a/src/harfbuzz-gdef.h b/src/harfbuzz-gdef.h index b6dcadc..9b5dee0 100644 --- a/src/harfbuzz-gdef.h +++ b/src/harfbuzz-gdef.h @@ -31,6 +31,10 @@ HB_BEGIN_HEADER +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(push, 1) +#endif + /* GDEF glyph properties. Note that HB_GDEF_COMPONENT has no corresponding * flag in the LookupFlag field. */ #define HB_GDEF_BASE_GLYPH 0x0002 @@ -129,6 +133,9 @@ HB_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef, HB_UShort* glyph_array, HB_UShort* class_array ); +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(pop) +#endif HB_END_HEADER diff --git a/src/harfbuzz-global.h b/src/harfbuzz-global.h index d4e6b46..5b2b679 100644 --- a/src/harfbuzz-global.h +++ b/src/harfbuzz-global.h @@ -39,6 +39,10 @@ #define HB_END_HEADER /* nothing */ #endif +#if defined(__GNUC__) || defined(__ARMCC__) || defined(__CC_ARM) || defined(_MSC_VER) +#define HB_USE_PACKED_STRUCTS +#endif + HB_BEGIN_HEADER #ifndef FALSE diff --git a/src/harfbuzz-gpos-private.h b/src/harfbuzz-gpos-private.h index 6408b84..d513c27 100644 --- a/src/harfbuzz-gpos-private.h +++ b/src/harfbuzz-gpos-private.h @@ -32,6 +32,9 @@ HB_BEGIN_HEADER +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(push, 1) +#endif /* shared tables */ @@ -713,6 +716,10 @@ HB_INTERNAL void _HB_GPOS_Free_SubTable( HB_GPOS_SubTable* st, HB_UShort lookup_type ); +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(pop) +#endif + HB_END_HEADER #endif /* HARFBUZZ_GPOS_PRIVATE_H */ diff --git a/src/harfbuzz-gsub-private.h b/src/harfbuzz-gsub-private.h index 4e08839..9f16546 100644 --- a/src/harfbuzz-gsub-private.h +++ b/src/harfbuzz-gsub-private.h @@ -32,6 +32,9 @@ HB_BEGIN_HEADER +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(push, 1) +#endif typedef union HB_GSUB_SubTable_ HB_GSUB_SubTable; @@ -471,6 +474,10 @@ HB_INTERNAL void _HB_GSUB_Free_SubTable( HB_GSUB_SubTable* st, HB_UShort lookup_type ); +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(pop) +#endif + HB_END_HEADER #endif /* HARFBUZZ_GSUB_PRIVATE_H */ diff --git a/src/harfbuzz-gsub.h b/src/harfbuzz-gsub.h index 1ca3f0c..5b989ee 100644 --- a/src/harfbuzz-gsub.h +++ b/src/harfbuzz-gsub.h @@ -32,6 +32,10 @@ HB_BEGIN_HEADER +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(push, 1) +#endif + /* Lookup types for glyph substitution */ #define HB_GSUB_LOOKUP_SINGLE 1 @@ -135,6 +139,9 @@ HB_Error HB_GSUB_Register_Alternate_Function( HB_GSUBHeader* gsub, HB_Error HB_GSUB_Apply_String( HB_GSUBHeader* gsub, HB_Buffer buffer ); +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(pop) +#endif HB_END_HEADER diff --git a/src/harfbuzz-open.h b/src/harfbuzz-open.h index 7d3bc1b..752f17d 100644 --- a/src/harfbuzz-open.h +++ b/src/harfbuzz-open.h @@ -30,6 +30,10 @@ HB_BEGIN_HEADER +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(push, 1) +#endif + /* Use this if a feature applies to all glyphs */ #define HB_ALL_GLYPHS 0xFFFF @@ -276,6 +280,9 @@ enum HB_Type_ typedef enum HB_Type_ HB_Type; +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(pop) +#endif HB_END_HEADER diff --git a/src/harfbuzz-shaper.h b/src/harfbuzz-shaper.h index 470e27b..32f5781 100644 --- a/src/harfbuzz-shaper.h +++ b/src/harfbuzz-shaper.h @@ -34,6 +34,10 @@ HB_BEGIN_HEADER +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(push, 1) +#endif + /* using anything else than signed or unsigned for bitfields in C is non standard, but accepted by almost all compilers. And it gives a significant reduction in @@ -281,6 +285,10 @@ struct HB_ShaperItem_ { HB_Bool HB_ShapeItem(HB_ShaperItem *item); +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(pop) +#endif + HB_END_HEADER #endif diff --git a/src/harfbuzz-stream.h b/src/harfbuzz-stream.h index 9991936..0670804 100644 --- a/src/harfbuzz-stream.h +++ b/src/harfbuzz-stream.h @@ -30,6 +30,10 @@ HB_BEGIN_HEADER +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(push, 1) +#endif + typedef struct HB_StreamRec_ { HB_Byte* base; @@ -39,6 +43,9 @@ typedef struct HB_StreamRec_ HB_Byte* cursor; } HB_StreamRec; +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(pop) +#endif HB_END_HEADER |