diff options
author | Behdad Esfahbod <behdad@gnome.org> | 2006-01-05 16:14:49 +0000 |
---|---|---|
committer | Behdad Esfahbod <behdad@src.gnome.org> | 2006-01-05 16:14:49 +0000 |
commit | 59e692ee5a119653d8743dcd7e066800a56cb9ff (patch) | |
tree | b9a526d0d32a1654eb6b034cbecb6f26641a59c3 | |
parent | 8462bd8cbfa15641147781889820b6e9b1ce1fb3 (diff) | |
download | pango-59e692ee5a119653d8743dcd7e066800a56cb9ff.tar.gz |
pango/Makefile.am, pango/fonts.c, pango/glyphstring.c,
2006-01-05 Behdad Esfahbod <behdad@gnome.org>
* pango/Makefile.am,
* pango/fonts.c,
* pango/glyphstring.c,
* pango/pango-attributes.c,
* pango/pango-color.c,
* pango/pango-impl-utils.h,
* pango/pango-item.c,
* pango/pango-layout.c,
* pango/pango-tabs.c,
* pango/pango-utils.c,
* pango/pango-utils.h,
* pango/pangoatsui-fontmap.c,
* pango/pangocairo-font.c,
* pango/pangocairo-fontmap.c,
* pango/pangofc-fontmap.c,
* pango/pangowin32-fontmap.c,
* pango/pangox-fontmap.c,
* pango/pangox.c,
* pango/opentype/pango-ot-info.c,
* pango/opentype/pango-ot-ruleset.c: Intern strings to avoid
unnecessary strdups in the type system. (bug #325832, Matthias Clasen)
-rw-r--r-- | ChangeLog | 24 | ||||
-rw-r--r-- | pango/Makefile.am | 2 | ||||
-rw-r--r-- | pango/fonts.c | 4 | ||||
-rw-r--r-- | pango/glyphstring.c | 3 | ||||
-rw-r--r-- | pango/opentype/pango-ot-info.c | 3 | ||||
-rw-r--r-- | pango/opentype/pango-ot-ruleset.c | 3 | ||||
-rw-r--r-- | pango/pango-attributes.c | 4 | ||||
-rw-r--r-- | pango/pango-color.c | 3 | ||||
-rw-r--r-- | pango/pango-impl-utils.h | 2 | ||||
-rw-r--r-- | pango/pango-item.c | 3 | ||||
-rw-r--r-- | pango/pango-layout.c | 5 | ||||
-rw-r--r-- | pango/pango-tabs.c | 3 | ||||
-rw-r--r-- | pango/pango-utils.c | 4 | ||||
-rw-r--r-- | pango/pango-utils.h | 4 | ||||
-rw-r--r-- | pango/pangoatsui-fontmap.c | 5 | ||||
-rw-r--r-- | pango/pangocairo-font.c | 3 | ||||
-rw-r--r-- | pango/pangocairo-fontmap.c | 3 | ||||
-rw-r--r-- | pango/pangofc-fontmap.c | 5 | ||||
-rw-r--r-- | pango/pangowin32-fontmap.c | 4 | ||||
-rw-r--r-- | pango/pangox-fontmap.c | 6 | ||||
-rw-r--r-- | pango/pangox.c | 4 |
21 files changed, 68 insertions, 29 deletions
@@ -1,3 +1,27 @@ +2006-01-05 Behdad Esfahbod <behdad@gnome.org> + + * pango/Makefile.am, + * pango/fonts.c, + * pango/glyphstring.c, + * pango/pango-attributes.c, + * pango/pango-color.c, + * pango/pango-impl-utils.h, + * pango/pango-item.c, + * pango/pango-layout.c, + * pango/pango-tabs.c, + * pango/pango-utils.c, + * pango/pango-utils.h, + * pango/pangoatsui-fontmap.c, + * pango/pangocairo-font.c, + * pango/pangocairo-fontmap.c, + * pango/pangofc-fontmap.c, + * pango/pangowin32-fontmap.c, + * pango/pangox-fontmap.c, + * pango/pangox.c, + * pango/opentype/pango-ot-info.c, + * pango/opentype/pango-ot-ruleset.c: Intern strings to avoid + unnecessary strdups in the type system. (bug #325832, Matthias Clasen) + 2006-01-04 Behdad Esfahbod <behdad@gnome.org> * docs/Makefile.am (IGNORE_HFILES): Add pangocairo-atsui.h and diff --git a/pango/Makefile.am b/pango/Makefile.am index 15901878..caf43a3e 100644 --- a/pango/Makefile.am +++ b/pango/Makefile.am @@ -138,7 +138,7 @@ s-enum-types-c: @REBUILD@ $(pango_headers) Makefile --fprod "\n/* enumerations from \"@filename@\" */" \ --vhead "GType\n@enum_name@_get_type (void)\n{\n static GType etype = 0;\n if (etype == 0) {\n static const G@Type@Value values[] = {" \ --vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \ - --vtail " { 0, NULL, NULL }\n };\n etype = g_@type@_register_static (\"@EnumName@\", values);\n }\n return etype;\n}\n" \ + --vtail " { 0, NULL, NULL }\n };\n etype = g_@type@_register_static (g_intern_static_string (\"@EnumName@\"), values);\n }\n return etype;\n}\n" \ $(pango_headers) ) > tmp-pango-enum-types.c \ && (cmp -s tmp-pango-enum-types.c pango-enum-types.c || cp tmp-pango-enum-types.c pango-enum-types.c ) \ && rm -f tmp-pango-enum-types.c \ diff --git a/pango/fonts.c b/pango/fonts.c index 60b6dffb..fcd84fca 100644 --- a/pango/fonts.c +++ b/pango/fonts.c @@ -50,7 +50,7 @@ pango_font_description_get_type (void) static GType our_type = 0; if (our_type == 0) - our_type = g_boxed_type_register_static ("PangoFontDescription", + our_type = g_boxed_type_register_static (I_("PangoFontDescription"), (GBoxedCopyFunc)pango_font_description_copy, (GBoxedFreeFunc)pango_font_description_free); @@ -1214,7 +1214,7 @@ pango_font_metrics_get_type (void) static GType our_type = 0; if (our_type == 0) - our_type = g_boxed_type_register_static ("PangoFontMetrics", + our_type = g_boxed_type_register_static (I_("PangoFontMetrics"), (GBoxedCopyFunc)pango_font_metrics_ref, (GBoxedFreeFunc)pango_font_metrics_unref); diff --git a/pango/glyphstring.c b/pango/glyphstring.c index 4c10f56e..848f5233 100644 --- a/pango/glyphstring.c +++ b/pango/glyphstring.c @@ -22,6 +22,7 @@ #include <glib.h> #include <pango/pango-glyph.h> #include <pango/pango-font.h> +#include <pango/pango-utils.h> /** * pango_glyph_string_new: @@ -77,7 +78,7 @@ pango_glyph_string_get_type (void) static GType our_type = 0; if (our_type == 0) - our_type = g_boxed_type_register_static ("PangoGlyphString", + our_type = g_boxed_type_register_static (I_("PangoGlyphString"), (GBoxedCopyFunc)pango_glyph_string_copy, (GBoxedFreeFunc)pango_glyph_string_free); diff --git a/pango/opentype/pango-ot-info.c b/pango/opentype/pango-ot-info.c index 57ecd27e..87a2a4eb 100644 --- a/pango/opentype/pango-ot-info.c +++ b/pango/opentype/pango-ot-info.c @@ -20,6 +20,7 @@ */ #include "pango-ot-private.h" +#include "../pango-utils.h" #include "ftglue.h" #include FT_MODULE_H @@ -57,7 +58,7 @@ pango_ot_info_get_type (void) }; object_type = g_type_register_static (G_TYPE_OBJECT, - "PangoOTInfo", + I_("PangoOTInfo"), &object_info, 0); } diff --git a/pango/opentype/pango-ot-ruleset.c b/pango/opentype/pango-ot-ruleset.c index 23126582..b61a28e0 100644 --- a/pango/opentype/pango-ot-ruleset.c +++ b/pango/opentype/pango-ot-ruleset.c @@ -21,6 +21,7 @@ #include <pango/pango-ot.h> #include "pango-ot-private.h" +#include "../pango-utils.h" typedef struct _PangoOTRule PangoOTRule; @@ -59,7 +60,7 @@ pango_ot_ruleset_get_type (void) }; object_type = g_type_register_static (G_TYPE_OBJECT, - "PangoOTRuleset", + I_("PangoOTRuleset"), &object_info, 0); } diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c index 160dcbc8..6c851f1e 100644 --- a/pango/pango-attributes.c +++ b/pango/pango-attributes.c @@ -848,7 +848,7 @@ pango_attr_shape_copy (const PangoAttribute *attr) static void pango_attr_shape_destroy (PangoAttribute *attr) { - const PangoAttrShape *shape_attr = (PangoAttrShape *)attr; + PangoAttrShape *shape_attr = (PangoAttrShape *)attr; if (shape_attr->destroy_func) shape_attr->destroy_func (shape_attr->data); @@ -952,7 +952,7 @@ pango_attr_list_get_type (void) static GType our_type = 0; if (our_type == 0) - our_type = g_boxed_type_register_static ("PangoAttrList", + our_type = g_boxed_type_register_static (I_("PangoAttrList"), (GBoxedCopyFunc) pango_attr_list_copy, (GBoxedFreeFunc) pango_attr_list_unref); diff --git a/pango/pango-color.c b/pango/pango-color.c index 3c0c8a1a..6628225b 100644 --- a/pango/pango-color.c +++ b/pango/pango-color.c @@ -24,6 +24,7 @@ #include <string.h> #include "pango-attributes.h" +#include "pango-utils.h" GType pango_color_get_type (void) @@ -31,7 +32,7 @@ pango_color_get_type (void) static GType our_type = 0; if (our_type == 0) - our_type = g_boxed_type_register_static ("PangoColor", + our_type = g_boxed_type_register_static (I_("PangoColor"), (GBoxedCopyFunc) pango_color_copy, (GBoxedFreeFunc) pango_color_free); diff --git a/pango/pango-impl-utils.h b/pango/pango-impl-utils.h index 498a886c..7dabeb47 100644 --- a/pango/pango-impl-utils.h +++ b/pango/pango-impl-utils.h @@ -51,7 +51,7 @@ prefix ## _get_type (void) \ }; \ \ object_type = g_type_register_static (parent_type, \ - # name, \ + g_intern_static_string (# name), \ &object_info, abstract); \ } \ \ diff --git a/pango/pango-item.c b/pango/pango-item.c index a8b5aae0..26b4d356 100644 --- a/pango/pango-item.c +++ b/pango/pango-item.c @@ -21,6 +21,7 @@ #include <pango-attributes.h> #include <pango-item.h> +#include <pango-utils.h> /** * pango_item_new: @@ -99,7 +100,7 @@ pango_item_get_type (void) static GType our_type = 0; if (our_type == 0) - our_type = g_boxed_type_register_static ("PangoItem", + our_type = g_boxed_type_register_static (I_("PangoItem"), (GBoxedCopyFunc) pango_item_copy, (GBoxedFreeFunc) pango_item_free); return our_type; diff --git a/pango/pango-layout.c b/pango/pango-layout.c index 99d4e9e7..1190dd27 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -23,6 +23,7 @@ #include <pango/pango-break.h> #include <pango/pango-item.h> #include <pango/pango-engine.h> +#include <pango/pango-utils.h> #include <string.h> #include "pango-layout-private.h" @@ -3388,7 +3389,7 @@ pango_layout_line_get_type(void) static GType our_type = 0; if (our_type == 0) - our_type = g_boxed_type_register_static ("PangoLayoutLine", + our_type = g_boxed_type_register_static (I_("PangoLayoutLine"), (GBoxedCopyFunc) pango_layout_line_ref, (GBoxedFreeFunc) pango_layout_line_unref); return our_type; @@ -4571,7 +4572,7 @@ pango_layout_iter_get_type (void) static GType our_type = 0; if (our_type == 0) - our_type = g_boxed_type_register_static ("PangoLayoutIter", + our_type = g_boxed_type_register_static (I_("PangoLayoutIter"), (GBoxedCopyFunc)pango_layout_iter_copy, (GBoxedFreeFunc)pango_layout_iter_free); diff --git a/pango/pango-tabs.c b/pango/pango-tabs.c index 5728733b..50073494 100644 --- a/pango/pango-tabs.c +++ b/pango/pango-tabs.c @@ -20,6 +20,7 @@ */ #include "pango-tabs.h" +#include "pango-utils.h" #include <string.h> typedef struct _PangoTab PangoTab; @@ -158,7 +159,7 @@ pango_tab_array_get_type (void) static GType our_type = 0; if (our_type == 0) - our_type = g_boxed_type_register_static ("PangoTabArray", + our_type = g_boxed_type_register_static (I_("PangoTabArray"), (GBoxedCopyFunc)pango_tab_array_copy, (GBoxedFreeFunc)pango_tab_array_free); return our_type; diff --git a/pango/pango-utils.c b/pango/pango-utils.c index c4af168e..481a9d2d 100644 --- a/pango/pango-utils.c +++ b/pango/pango-utils.c @@ -1000,7 +1000,7 @@ pango_matrix_get_type (void) static GType our_type = 0; if (our_type == 0) - our_type = g_boxed_type_register_static ("PangoMatrix", + our_type = g_boxed_type_register_static (I_("PangoMatrix"), (GBoxedCopyFunc) pango_matrix_copy, (GBoxedFreeFunc) pango_matrix_free); @@ -1269,7 +1269,7 @@ pango_language_get_type (void) static GType our_type = 0; if (our_type == 0) - our_type = g_boxed_type_register_static ("PangoLanguage", + our_type = g_boxed_type_register_static (I_("PangoLanguage"), (GBoxedCopyFunc)pango_language_copy, (GBoxedFreeFunc)pango_language_free); return our_type; diff --git a/pango/pango-utils.h b/pango/pango-utils.h index ab0dd012..ac7de99b 100644 --- a/pango/pango-utils.h +++ b/pango/pango-utils.h @@ -99,6 +99,10 @@ G_CONST_RETURN char *pango_language_get_sample_string (PangoLanguage *language); */ G_GNUC_CONST gboolean pango_is_zero_width (gunichar ch); +/* String interning for static strings */ +#define I_(string) g_intern_static_string (string) + + G_END_DECLS #endif /* __PANGO_UTILS_H__ */ diff --git a/pango/pangoatsui-fontmap.c b/pango/pangoatsui-fontmap.c index 4d0fdc06..75c5a890 100644 --- a/pango/pangoatsui-fontmap.c +++ b/pango/pangoatsui-fontmap.c @@ -21,6 +21,7 @@ */ #include "pangoatsui-private.h" +#include "pango-utils.h" #import <Cocoa/Cocoa.h> @@ -205,7 +206,7 @@ pango_atsui_family_get_type (void) }; object_type = g_type_register_static (PANGO_TYPE_FONT_FAMILY, - "PangoATSUIFamily", + I_("PangoATSUIFamily"), &object_info, 0); } @@ -324,7 +325,7 @@ pango_atsui_face_get_type (void) }; object_type = g_type_register_static (PANGO_TYPE_FONT_FACE, - "PangoATSUIFace", + I_("PangoATSUIFace"), &object_info, 0); } diff --git a/pango/pangocairo-font.c b/pango/pangocairo-font.c index 451b9b80..008fd1d5 100644 --- a/pango/pangocairo-font.c +++ b/pango/pangocairo-font.c @@ -21,6 +21,7 @@ #include "pangocairo.h" #include "pangocairo-private.h" +#include "pango-utils.h" GType pango_cairo_font_get_type (void) @@ -44,7 +45,7 @@ pango_cairo_font_get_type (void) }; cairo_font_type = - g_type_register_static (G_TYPE_INTERFACE, "PangoCairoFont", + g_type_register_static (G_TYPE_INTERFACE, I_("PangoCairoFont"), &cairo_font_info, 0); g_type_interface_add_prerequisite (cairo_font_type, PANGO_TYPE_FONT); diff --git a/pango/pangocairo-fontmap.c b/pango/pangocairo-fontmap.c index 501592d5..d3232222 100644 --- a/pango/pangocairo-fontmap.c +++ b/pango/pangocairo-fontmap.c @@ -23,6 +23,7 @@ #include "pangocairo.h" #include "pangocairo-private.h" +#include "pango-utils.h" #if defined (HAVE_CAIRO_ATSUI) # include "pangocairo-atsui.h" @@ -54,7 +55,7 @@ pango_cairo_font_map_get_type (void) }; cairo_font_map_type = - g_type_register_static (G_TYPE_INTERFACE, "PangoCairoFontMap", + g_type_register_static (G_TYPE_INTERFACE, I_("PangoCairoFontMap"), &cairo_font_map_info, 0); g_type_interface_add_prerequisite (cairo_font_map_type, PANGO_TYPE_FONT_MAP); diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c index 858939d7..36c5a1e4 100644 --- a/pango/pangofc-fontmap.c +++ b/pango/pangofc-fontmap.c @@ -27,6 +27,7 @@ #include "pango-context.h" #include "pangofc-fontmap.h" #include "pangofc-private.h" +#include "pango-utils.h" #include "modules.h" typedef struct _PangoFcCoverageKey PangoFcCoverageKey; @@ -1808,7 +1809,7 @@ pango_fc_face_get_type (void) }; object_type = g_type_register_static (PANGO_TYPE_FONT_FACE, - "PangoFcFace", + I_("PangoFcFace"), &object_info, 0); } @@ -1936,7 +1937,7 @@ pango_fc_family_get_type (void) }; object_type = g_type_register_static (PANGO_TYPE_FONT_FAMILY, - "PangoFcFamily", + I_("PangoFcFamily"), &object_info, 0); } diff --git a/pango/pangowin32-fontmap.c b/pango/pangowin32-fontmap.c index 171883fa..343b34ad 100644 --- a/pango/pangowin32-fontmap.c +++ b/pango/pangowin32-fontmap.c @@ -324,7 +324,7 @@ pango_win32_family_get_type (void) }; object_type = g_type_register_static (PANGO_TYPE_FONT_FAMILY, - "PangoWin32Family", + I_("PangoWin32Family"), &object_info, 0); } @@ -963,7 +963,7 @@ pango_win32_face_get_type (void) }; object_type = g_type_register_static (PANGO_TYPE_FONT_FACE, - "PangoWin32Face", + I_("PangoWin32Face"), &object_info, 0); } diff --git a/pango/pangox-fontmap.c b/pango/pangox-fontmap.c index e108bc71..a899f356 100644 --- a/pango/pangox-fontmap.c +++ b/pango/pangox-fontmap.c @@ -194,7 +194,7 @@ pango_x_font_map_get_type (void) }; object_type = g_type_register_static (PANGO_TYPE_FONT_MAP, - "PangoXFontMap", + I_("PangoXFontMap"), &object_info, 0); } @@ -1510,7 +1510,7 @@ pango_x_face_get_type (void) }; object_type = g_type_register_static (PANGO_TYPE_FONT_FACE, - "PangoXFace", + I_("PangoXFace"), &object_info, 0); } @@ -1669,7 +1669,7 @@ pango_x_family_get_type (void) }; object_type = g_type_register_static (PANGO_TYPE_FONT_FAMILY, - "PangoXFamily", + I_("PangoXFamily"), &object_info, 0); } diff --git a/pango/pangox.c b/pango/pangox.c index 23f76728..3b03d77b 100644 --- a/pango/pangox.c +++ b/pango/pangox.c @@ -177,7 +177,7 @@ pango_x_get_context (Display *display) static gboolean registered_modules = FALSE; g_return_val_if_fail (display != NULL, NULL); - + if (!registered_modules) { registered_modules = TRUE; @@ -247,7 +247,7 @@ pango_x_font_get_type (void) }; object_type = g_type_register_static (PANGO_TYPE_FONT, - "PangoXFont", + I_("PangoXFont"), &object_info, 0); } |