diff options
author | Behdad Esfahbod <behdad@gnome.org> | 2005-11-04 20:53:03 +0000 |
---|---|---|
committer | Behdad Esfahbod <behdad@src.gnome.org> | 2005-11-04 20:53:03 +0000 |
commit | 69bbb89d5436cae4602579f952d68e84efe9ec24 (patch) | |
tree | cafa20b6afa089fb6b8f834fbdccfdac30371cb4 /pango | |
parent | f3d4ab2fecbc21745436e54b81729a330a915648 (diff) | |
download | pango-69bbb89d5436cae4602579f952d68e84efe9ec24.tar.gz |
Use quarks for GObject data to improve performance. (Patch from Federico
2005-11-04 Behdad Esfahbod <behdad@gnome.org>
* pango/pangocairo-fontmap.c: Use quarks for GObject data to improve
performance. (Patch from Federico Mena Quintero)
* pango/modules.c (pango_module_load), pango/querymodules.c: Pass
G_MODULE_BIND_LAZY to g_module_open. (Pointed by John Rice)
Diffstat (limited to 'pango')
-rw-r--r-- | pango/modules.c | 2 | ||||
-rw-r--r-- | pango/pangocairo-fontmap.c | 14 | ||||
-rw-r--r-- | pango/querymodules.c | 2 |
3 files changed, 12 insertions, 6 deletions
diff --git a/pango/modules.c b/pango/modules.c index 719ec66e..d0ede877 100644 --- a/pango/modules.c +++ b/pango/modules.c @@ -169,7 +169,7 @@ pango_module_load (GTypeModule *module) if (pango_module->path) { - pango_module->library = g_module_open (pango_module->path, 0); + pango_module->library = g_module_open (pango_module->path, G_MODULE_BIND_LAZY); if (!pango_module->library) { g_warning (g_module_error()); diff --git a/pango/pangocairo-fontmap.c b/pango/pangocairo-fontmap.c index 9fd7d87a..8dd82877 100644 --- a/pango/pangocairo-fontmap.c +++ b/pango/pangocairo-fontmap.c @@ -220,8 +220,14 @@ static PangoCairoContextInfo * get_context_info (PangoContext *context, gboolean create) { - PangoCairoContextInfo *info = g_object_get_data (G_OBJECT (context), - "pango-cairo-context-info"); + static GQuark context_info_quark; + PangoCairoContextInfo *info; + + if (!context_info_quark) + context_info_quark = g_quark_from_static_string ("pango-cairo-context-info"); + + info = g_object_get_qdata (G_OBJECT (context), context_info_quark); + if (!info && create) { info = g_new (PangoCairoContextInfo, 1); @@ -230,8 +236,8 @@ get_context_info (PangoContext *context, info->surface_options = NULL; info->merged_options = NULL; - g_object_set_data_full (G_OBJECT (context), "pango-cairo-context-info", - info, (GDestroyNotify)free_context_info); + g_object_set_qdata_full (G_OBJECT (context), context_info_quark, + info, (GDestroyNotify)free_context_info); } return info; diff --git a/pango/querymodules.c b/pango/querymodules.c index 557ae7ac..8c5553d1 100644 --- a/pango/querymodules.c +++ b/pango/querymodules.c @@ -136,7 +136,7 @@ query_module (const char *dir, const char *name) else path = g_build_filename (dir, name, NULL); - module = g_module_open (path, 0); + module = g_module_open (path, G_MODULE_BIND_LAZY); if (!module) g_printerr ("Cannot load module %s: %s\n", path, g_module_error ()); |