summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2007-09-07 23:27:11 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2007-09-07 23:27:11 +0000
commitc7c8da4617da9c3069725ca4bfadabb1f5924aba (patch)
treeec4f474d90bde8231f98aff1506e2ef3f6f1bc5b
parented419fa5c98ca55f2a8dd0fea06633512964b2df (diff)
downloadpango-c7c8da4617da9c3069725ca4bfadabb1f5924aba.tar.gz
Switch some g_new (*, 1) to g_slice_new ()... I know...
2007-09-07 Behdad Esfahbod <behdad@gnome.org> * pango/pangox-fontcache.c (free_cache_entry), (pango_x_font_cache_free), (pango_x_font_cache_new), (pango_x_font_cache_load): * pango/pangox-fontmap.c (pango_x_font_map_finalize), (pango_x_insert_font): * pango/pangox.c (free_context_info), (pango_x_get_context), (pango_x_font_init), (pango_x_font_get_metrics), (pango_x_insert_subfont), (free_metrics_info), (pango_x_font_finalize): Switch some g_new (*, 1) to g_slice_new ()... I know... svn path=/trunk/; revision=2423
-rw-r--r--pango/pangox.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/pango/pangox.c b/pango/pangox.c
index 6ca0e578..0a55cf30 100644
--- a/pango/pangox.c
+++ b/pango/pangox.c
@@ -156,6 +156,12 @@ pango_x_get_font_struct (PangoFont *font, PangoXSubfontInfo *info)
return info->font_struct;
}
+static void
+free_context_info (PangoXContextInfo *info)
+{
+ g_slice_free (PangoXContextInfo, info);
+}
+
/**
* pango_x_get_context:
* @display: an X display (As returned by XOpenDisplay().)
@@ -185,12 +191,12 @@ pango_x_get_context (Display *display)
result = pango_context_new ();
- info = g_new (PangoXContextInfo, 1);
+ info = g_slice_new (PangoXContextInfo);
info->get_gc_func = NULL;
info->free_gc_func = NULL;
g_object_set_qdata_full (G_OBJECT (result),
g_quark_from_static_string ("pango-x-info"),
- info, (GDestroyNotify)g_free);
+ info, (GDestroyNotify)free_context_info);
pango_context_set_font_map (result, pango_x_font_map_for_display (display));
@@ -255,11 +261,12 @@ static void
pango_x_font_init (PangoXFont *xfont)
{
xfont->subfonts_by_charset = g_hash_table_new (g_str_hash, g_str_equal);
- xfont->subfonts = g_new (PangoXSubfontInfo *, 1);
xfont->n_subfonts = 0;
xfont->max_subfonts = 1;
+ xfont->subfonts = g_new (PangoXSubfontInfo *, xfont->max_subfonts);
+
xfont->metrics_by_lang = NULL;
xfont->size = -1;
@@ -962,7 +969,7 @@ pango_x_font_get_metrics (PangoFont *font,
{
PangoFontMetrics *metrics;
- info = g_new0 (PangoXMetricsInfo, 1);
+ info = g_slice_new0 (PangoXMetricsInfo);
xfont->metrics_by_lang = g_slist_prepend (xfont->metrics_by_lang, info);
@@ -1060,7 +1067,7 @@ pango_x_insert_subfont (PangoFont *font, const char *xlfd)
PangoXFont *xfont = (PangoXFont *)font;
PangoXSubfontInfo *info;
- info = g_new (PangoXSubfontInfo, 1);
+ info = g_slice_new (PangoXSubfontInfo);
info->xlfd = g_strdup (xlfd);
info->font_struct = NULL;
@@ -1270,7 +1277,7 @@ static void
free_metrics_info (PangoXMetricsInfo *info)
{
pango_font_metrics_unref (info->metrics);
- g_free (info);
+ g_slice_free (PangoXMetricsInfo, info);
}
static void
@@ -1290,7 +1297,7 @@ pango_x_font_finalize (GObject *object)
if (info->font_struct)
pango_x_font_cache_unload (cache, info->font_struct);
- g_free (info);
+ g_slice_free (PangoXSubfontInfo, info);
}
g_free (xfont->subfonts);