diff options
author | Matthias Clasen <mclasen@redhat.com> | 2006-01-04 07:06:12 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2006-01-04 07:06:12 +0000 |
commit | 04eceaf621aec4388bc37e10b63a49da4d2a6942 (patch) | |
tree | bddf2cd7704e2174c2cfba8bb1d65036b2a72801 /gtk/gtkgc.c | |
parent | f827de4ec41b5f5bba304f2a062b8d67690542d6 (diff) | |
download | gdk-pixbuf-04eceaf621aec4388bc37e10b63a49da4d2a6942.tar.gz |
Use the slice allocator for many small allocations.
2006-01-04 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkaccelmap.c:
* gtk/gtkactiongroup.c:
* gtk/gtkdialog.c:
* gtk/gtkfilesystemunix.c:
* gtk/gtkgc.c:
* gtk/gtkkeyhash.c:
* gtk/gtkplug.c:
* gtk/gtktextiter.c:
* gtk/gtktextlayout.c:
* gtk/gtkuimanager.c:
* gtk/gtkwidget.c:
* gtk/gtkwindow.c:
* gtk/gtkxembed.c: Use the slice allocator for many small
allocations.
* gtk/gtkcolorsel.c:
* gtk/gtktreeview.c: Use IPN.
* gtk/gtkwidget.c: Remove an unused field from the AccelPath
struct.
Diffstat (limited to 'gtk/gtkgc.c')
-rw-r--r-- | gtk/gtkgc.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/gtk/gtkgc.c b/gtk/gtkgc.c index a2cf6e4c0..867d446b0 100644 --- a/gtk/gtkgc.c +++ b/gtk/gtkgc.c @@ -64,7 +64,7 @@ static gint gtk_gc_drawable_equal (GtkGCDrawable *a, static gint initialize = TRUE; static GCache *gc_cache = NULL; - +static GQuark quark_gtk_gc_drawable_ht = 0; GdkGC* gtk_gc_get (gint depth, @@ -102,21 +102,21 @@ free_gc_drawable (gpointer data) { GtkGCDrawable *drawable = data; g_object_unref (drawable->drawable); - g_free (drawable); + g_slice_free (GtkGCDrawable, drawable); } static GHashTable* gtk_gc_get_drawable_ht (GdkScreen *screen) { - GHashTable *ht = g_object_get_data (G_OBJECT (screen), "gtk-gc-drawable-ht"); + GHashTable *ht = g_object_get_qdata (G_OBJECT (screen), quark_gtk_gc_drawable_ht); if (!ht) { ht = g_hash_table_new_full ((GHashFunc) gtk_gc_drawable_hash, (GEqualFunc) gtk_gc_drawable_equal, NULL, free_gc_drawable); - g_object_set_data_full (G_OBJECT (screen), - I_("gtk-gc-drawable-ht"), ht, - (GDestroyNotify)g_hash_table_destroy); + g_object_set_qdata_full (G_OBJECT (screen), + quark_gtk_gc_drawable_ht, ht, + (GDestroyNotify)g_hash_table_destroy); } return ht; @@ -127,6 +127,8 @@ gtk_gc_init (void) { initialize = FALSE; + quark_gtk_gc_drawable_ht = g_quark_from_static_string ("gtk-gc-drawable-ht"); + gc_cache = g_cache_new ((GCacheNewFunc) gtk_gc_new, (GCacheDestroyFunc) gtk_gc_destroy, (GCacheDupFunc) gtk_gc_key_dup, @@ -170,7 +172,7 @@ gtk_gc_new (gpointer key) drawable = g_hash_table_lookup (ht, &keyval->depth); if (!drawable) { - drawable = g_new (GtkGCDrawable, 1); + drawable = g_slice_new (GtkGCDrawable); drawable->depth = keyval->depth; drawable->drawable = gdk_pixmap_new (gdk_screen_get_root_window (screen), 1, 1, drawable->depth); |