diff options
author | Matthias Clasen <mclasen@redhat.com> | 2005-12-05 20:51:18 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2005-12-05 20:51:18 +0000 |
commit | 3353d528b453f8987d042beb2cf2ac7c59a7ba3f (patch) | |
tree | 94768d396cccc9f00c8b66b1ece6e5664660a684 /gdk | |
parent | eb79da2f53089d6b8addecbef6730f8442fc120b (diff) | |
download | gtk+-3353d528b453f8987d042beb2cf2ac7c59a7ba3f.tar.gz |
Use g_slice instead of mem chunks.
2005-12-05 Matthias Clasen <mclasen@redhat.com>
* gdk/gdkevents.c:
* gdk/gdkcolor.c: Use g_slice instead of mem chunks.
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/gdkcolor.c | 13 | ||||
-rw-r--r-- | gdk/gdkevents.c | 17 |
2 files changed, 4 insertions, 26 deletions
diff --git a/gdk/gdkcolor.c b/gdk/gdkcolor.c index 404dd3dc8c..83da2cddef 100644 --- a/gdk/gdkcolor.c +++ b/gdk/gdkcolor.c @@ -103,8 +103,6 @@ gdk_colors_store (GdkColormap *colormap, gdk_colormap_change (colormap, ncolors); } -static GMemChunk *color_chunk; - /** * gdk_color_copy: * @color: a #GdkColor. @@ -121,13 +119,7 @@ gdk_color_copy (const GdkColor *color) g_return_val_if_fail (color != NULL, NULL); - if (color_chunk == NULL) - color_chunk = g_mem_chunk_new ("colors", - sizeof (GdkColor), - 4096, - G_ALLOC_AND_FREE); - - new_color = g_chunk_new (GdkColor, color_chunk); + new_color = g_slice_new (GdkColor); *new_color = *color; return new_color; } @@ -142,10 +134,9 @@ gdk_color_copy (const GdkColor *color) void gdk_color_free (GdkColor *color) { - g_assert (color_chunk != NULL); g_return_if_fail (color != NULL); - g_mem_chunk_free (color_chunk, color); + g_slice_free (GdkColor, color); } /** diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c index 040ebc292f..dc85f9eb9f 100644 --- a/gdk/gdkevents.c +++ b/gdk/gdkevents.c @@ -255,7 +255,6 @@ gdk_event_put (GdkEvent *event) gdk_display_put_event (display, event); } -static GMemChunk *event_chunk = NULL; static GHashTable *event_hash = NULL; /** @@ -275,17 +274,7 @@ gdk_event_new (GdkEventType type) GdkEventPrivate *new_private; GdkEvent *new_event; - if (event_chunk == NULL) - { - event_chunk = g_mem_chunk_new ("events", - sizeof (GdkEventPrivate), - 4096, - G_ALLOC_AND_FREE); - event_hash = g_hash_table_new (g_direct_hash, NULL); - } - - new_private = g_chunk_new (GdkEventPrivate, event_chunk); - memset (new_private, 0, sizeof (GdkEventPrivate)); + new_private = g_slice_new0 (GdkEventPrivate); new_private->flags = 0; new_private->screen = NULL; @@ -446,8 +435,6 @@ gdk_event_free (GdkEvent *event) { g_return_if_fail (event != NULL); - g_assert (event_chunk != NULL); /* paranoid */ - if (event->any.window) g_object_unref (event->any.window); @@ -498,7 +485,7 @@ gdk_event_free (GdkEvent *event) } g_hash_table_remove (event_hash, event); - g_mem_chunk_free (event_chunk, event); + g_slice_free (GdkEventPrivate, event); } /** |