forked from AuroraMiddleware/gtk
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.
This commit is contained in:
parent
eb79da2f53
commit
3353d528b4
@ -1,5 +1,8 @@
|
||||
2005-12-05 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gdk/gdkevents.c:
|
||||
* gdk/gdkcolor.c: Use g_slice instead of mem chunks.
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_key_press): Free new_event
|
||||
after sending it to the search entry. (#323209, Crispin Flowerday)
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
2005-12-05 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gdk/gdkevents.c:
|
||||
* gdk/gdkcolor.c: Use g_slice instead of mem chunks.
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_key_press): Free new_event
|
||||
after sending it to the search entry. (#323209, Crispin Flowerday)
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user