mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 21:21:21 +00:00
Use g_slice instead of mem chunks.
2005-12-05 Matthias Clasen <mclasen@redhat.com> * gtk/gtkwidget.c: * gtk/gtkuimanager.c: * gtk/gtktreedatalist.c: * gtk/gtktext.c: * gtk/gtkmain.c: * gtk/gtkitemfactory.c: * gtk/gtkseparator.[hc]: * gtk/gtkclist.[hc]: * gtk/gtkctree.c: * gtk/gtkgc.c: Use g_slice instead of mem chunks.
This commit is contained in:
parent
40894e9a49
commit
7dc70fba99
13
ChangeLog
13
ChangeLog
@ -1,3 +1,16 @@
|
|||||||
|
2005-12-05 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtkwidget.c:
|
||||||
|
* gtk/gtkuimanager.c:
|
||||||
|
* gtk/gtktreedatalist.c:
|
||||||
|
* gtk/gtktext.c:
|
||||||
|
* gtk/gtkmain.c:
|
||||||
|
* gtk/gtkitemfactory.c:
|
||||||
|
* gtk/gtkseparator.[hc]:
|
||||||
|
* gtk/gtkclist.[hc]:
|
||||||
|
* gtk/gtkctree.c:
|
||||||
|
* gtk/gtkgc.c: Use g_slice instead of mem chunks.
|
||||||
|
|
||||||
2005-12-05 Michael Natterer <mitch@imendio.com>
|
2005-12-05 Michael Natterer <mitch@imendio.com>
|
||||||
|
|
||||||
* gdk/x11/gdkevents-x11.c: map the new GtkSettings properties
|
* gdk/x11/gdkevents-x11.c: map the new GtkSettings properties
|
||||||
|
@ -1,3 +1,16 @@
|
|||||||
|
2005-12-05 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtkwidget.c:
|
||||||
|
* gtk/gtkuimanager.c:
|
||||||
|
* gtk/gtktreedatalist.c:
|
||||||
|
* gtk/gtktext.c:
|
||||||
|
* gtk/gtkmain.c:
|
||||||
|
* gtk/gtkitemfactory.c:
|
||||||
|
* gtk/gtkseparator.[hc]:
|
||||||
|
* gtk/gtkclist.[hc]:
|
||||||
|
* gtk/gtkctree.c:
|
||||||
|
* gtk/gtkgc.c: Use g_slice instead of mem chunks.
|
||||||
|
|
||||||
2005-12-05 Michael Natterer <mitch@imendio.com>
|
2005-12-05 Michael Natterer <mitch@imendio.com>
|
||||||
|
|
||||||
* gdk/x11/gdkevents-x11.c: map the new GtkSettings properties
|
* gdk/x11/gdkevents-x11.c: map the new GtkSettings properties
|
||||||
|
@ -46,9 +46,6 @@
|
|||||||
/* length of button_actions array */
|
/* length of button_actions array */
|
||||||
#define MAX_BUTTON 5
|
#define MAX_BUTTON 5
|
||||||
|
|
||||||
/* the number rows memchunk expands at a time */
|
|
||||||
#define CLIST_OPTIMUM_SIZE 64
|
|
||||||
|
|
||||||
/* the width of the column resize windows */
|
/* the width of the column resize windows */
|
||||||
#define DRAG_WIDTH 6
|
#define DRAG_WIDTH 6
|
||||||
|
|
||||||
@ -1014,9 +1011,6 @@ gtk_clist_init (GtkCList *clist)
|
|||||||
GTK_CLIST_SET_FLAG (clist, CLIST_DRAW_DRAG_LINE);
|
GTK_CLIST_SET_FLAG (clist, CLIST_DRAW_DRAG_LINE);
|
||||||
GTK_CLIST_SET_FLAG (clist, CLIST_USE_DRAG_ICONS);
|
GTK_CLIST_SET_FLAG (clist, CLIST_USE_DRAG_ICONS);
|
||||||
|
|
||||||
clist->row_mem_chunk = NULL;
|
|
||||||
clist->cell_mem_chunk = NULL;
|
|
||||||
|
|
||||||
clist->freeze_count = 0;
|
clist->freeze_count = 0;
|
||||||
|
|
||||||
clist->rows = 0;
|
clist->rows = 0;
|
||||||
@ -1092,23 +1086,6 @@ gtk_clist_constructor (GType type,
|
|||||||
construct_properties);
|
construct_properties);
|
||||||
GtkCList *clist = GTK_CLIST (object);
|
GtkCList *clist = GTK_CLIST (object);
|
||||||
|
|
||||||
/* initalize memory chunks, if this has not been done by any
|
|
||||||
* possibly derived widget
|
|
||||||
*/
|
|
||||||
if (!clist->row_mem_chunk)
|
|
||||||
clist->row_mem_chunk = g_mem_chunk_new ("clist row mem chunk",
|
|
||||||
sizeof (GtkCListRow),
|
|
||||||
sizeof (GtkCListRow) *
|
|
||||||
CLIST_OPTIMUM_SIZE,
|
|
||||||
G_ALLOC_AND_FREE);
|
|
||||||
|
|
||||||
if (!clist->cell_mem_chunk)
|
|
||||||
clist->cell_mem_chunk = g_mem_chunk_new ("clist cell mem chunk",
|
|
||||||
sizeof (GtkCell) * clist->columns,
|
|
||||||
sizeof (GtkCell) * clist->columns *
|
|
||||||
CLIST_OPTIMUM_SIZE,
|
|
||||||
G_ALLOC_AND_FREE);
|
|
||||||
|
|
||||||
/* allocate memory for columns */
|
/* allocate memory for columns */
|
||||||
clist->column = columns_new (clist);
|
clist->column = columns_new (clist);
|
||||||
|
|
||||||
@ -4438,9 +4415,6 @@ gtk_clist_finalize (GObject *object)
|
|||||||
|
|
||||||
columns_delete (clist);
|
columns_delete (clist);
|
||||||
|
|
||||||
g_mem_chunk_destroy (clist->cell_mem_chunk);
|
|
||||||
g_mem_chunk_destroy (clist->row_mem_chunk);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6374,8 +6348,8 @@ row_new (GtkCList *clist)
|
|||||||
int i;
|
int i;
|
||||||
GtkCListRow *clist_row;
|
GtkCListRow *clist_row;
|
||||||
|
|
||||||
clist_row = g_chunk_new (GtkCListRow, clist->row_mem_chunk);
|
clist_row = g_slice_new (GtkCListRow);
|
||||||
clist_row->cell = g_chunk_new (GtkCell, clist->cell_mem_chunk);
|
clist_row->cell = g_slice_new (GtkCell);
|
||||||
|
|
||||||
for (i = 0; i < clist->columns; i++)
|
for (i = 0; i < clist->columns; i++)
|
||||||
{
|
{
|
||||||
@ -6424,8 +6398,8 @@ row_delete (GtkCList *clist,
|
|||||||
if (clist_row->destroy)
|
if (clist_row->destroy)
|
||||||
clist_row->destroy (clist_row->data);
|
clist_row->destroy (clist_row->data);
|
||||||
|
|
||||||
g_mem_chunk_free (clist->cell_mem_chunk, clist_row->cell);
|
g_slice_free (GtkCell, clist_row->cell);
|
||||||
g_mem_chunk_free (clist->row_mem_chunk, clist_row);
|
g_slice_free (GtkCListRow, clist_row);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FOCUS FUNCTIONS
|
/* FOCUS FUNCTIONS
|
||||||
|
@ -151,9 +151,8 @@ struct _GtkCList
|
|||||||
|
|
||||||
guint16 flags;
|
guint16 flags;
|
||||||
|
|
||||||
/* mem chunks */
|
gpointer reserved1;
|
||||||
GMemChunk *row_mem_chunk;
|
gpointer reserved2;
|
||||||
GMemChunk *cell_mem_chunk;
|
|
||||||
|
|
||||||
guint freeze_count;
|
guint freeze_count;
|
||||||
|
|
||||||
|
@ -567,24 +567,12 @@ gtk_ctree_set_arg (GtkObject *object,
|
|||||||
switch (arg_id)
|
switch (arg_id)
|
||||||
{
|
{
|
||||||
case ARG_N_COLUMNS: /* construct-only arg, only set at construction time */
|
case ARG_N_COLUMNS: /* construct-only arg, only set at construction time */
|
||||||
g_return_if_fail (clist->row_mem_chunk == NULL);
|
|
||||||
clist->columns = MAX (1, GTK_VALUE_UINT (*arg));
|
clist->columns = MAX (1, GTK_VALUE_UINT (*arg));
|
||||||
clist->row_mem_chunk = g_mem_chunk_new ("ctree row mem chunk",
|
|
||||||
sizeof (GtkCTreeRow),
|
|
||||||
sizeof (GtkCTreeRow)
|
|
||||||
* CLIST_OPTIMUM_SIZE,
|
|
||||||
G_ALLOC_AND_FREE);
|
|
||||||
clist->cell_mem_chunk = g_mem_chunk_new ("ctree cell mem chunk",
|
|
||||||
sizeof (GtkCell) * clist->columns,
|
|
||||||
sizeof (GtkCell) * clist->columns
|
|
||||||
* CLIST_OPTIMUM_SIZE,
|
|
||||||
G_ALLOC_AND_FREE);
|
|
||||||
ctree->tree_column = CLAMP (ctree->tree_column, 0, clist->columns);
|
ctree->tree_column = CLAMP (ctree->tree_column, 0, clist->columns);
|
||||||
break;
|
break;
|
||||||
case ARG_TREE_COLUMN: /* construct-only arg, only set at construction time */
|
case ARG_TREE_COLUMN: /* construct-only arg, only set at construction time */
|
||||||
ctree->tree_column = GTK_VALUE_UINT (*arg);
|
ctree->tree_column = GTK_VALUE_UINT (*arg);
|
||||||
if (clist->row_mem_chunk)
|
ctree->tree_column = CLAMP (ctree->tree_column, 0, clist->columns);
|
||||||
ctree->tree_column = CLAMP (ctree->tree_column, 0, clist->columns);
|
|
||||||
break;
|
break;
|
||||||
case ARG_INDENT:
|
case ARG_INDENT:
|
||||||
gtk_ctree_set_indent (ctree, GTK_VALUE_UINT (*arg));
|
gtk_ctree_set_indent (ctree, GTK_VALUE_UINT (*arg));
|
||||||
@ -3207,8 +3195,8 @@ row_new (GtkCTree *ctree)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
clist = GTK_CLIST (ctree);
|
clist = GTK_CLIST (ctree);
|
||||||
ctree_row = g_chunk_new (GtkCTreeRow, clist->row_mem_chunk);
|
ctree_row = g_slice_new (GtkCTreeRow);
|
||||||
ctree_row->row.cell = g_chunk_new (GtkCell, clist->cell_mem_chunk);
|
ctree_row->row.cell = g_slice_new (GtkCell);
|
||||||
|
|
||||||
for (i = 0; i < clist->columns; i++)
|
for (i = 0; i < clist->columns; i++)
|
||||||
{
|
{
|
||||||
@ -3294,8 +3282,8 @@ row_delete (GtkCTree *ctree,
|
|||||||
dnotify (ddata);
|
dnotify (ddata);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_mem_chunk_free (clist->cell_mem_chunk, ctree_row->row.cell);
|
g_slice_free (GtkCell, ctree_row->row.cell);
|
||||||
g_mem_chunk_free (clist->row_mem_chunk, ctree_row);
|
g_slice_free (GtkCListRow, ctree_row);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
10
gtk/gtkgc.c
10
gtk/gtkgc.c
@ -65,8 +65,6 @@ static gint gtk_gc_drawable_equal (GtkGCDrawable *a,
|
|||||||
static gint initialize = TRUE;
|
static gint initialize = TRUE;
|
||||||
static GCache *gc_cache = NULL;
|
static GCache *gc_cache = NULL;
|
||||||
|
|
||||||
static GMemChunk *key_mem_chunk = NULL;
|
|
||||||
|
|
||||||
|
|
||||||
GdkGC*
|
GdkGC*
|
||||||
gtk_gc_get (gint depth,
|
gtk_gc_get (gint depth,
|
||||||
@ -143,11 +141,7 @@ gtk_gc_key_dup (GtkGCKey *key)
|
|||||||
{
|
{
|
||||||
GtkGCKey *new_key;
|
GtkGCKey *new_key;
|
||||||
|
|
||||||
if (!key_mem_chunk)
|
new_key = g_slice_new (GtkGCKey);
|
||||||
key_mem_chunk = g_mem_chunk_new ("key mem chunk", sizeof (GtkGCKey),
|
|
||||||
1024, G_ALLOC_AND_FREE);
|
|
||||||
|
|
||||||
new_key = g_chunk_new (GtkGCKey, key_mem_chunk);
|
|
||||||
|
|
||||||
*new_key = *key;
|
*new_key = *key;
|
||||||
|
|
||||||
@ -157,7 +151,7 @@ gtk_gc_key_dup (GtkGCKey *key)
|
|||||||
static void
|
static void
|
||||||
gtk_gc_key_destroy (GtkGCKey *key)
|
gtk_gc_key_destroy (GtkGCKey *key)
|
||||||
{
|
{
|
||||||
g_mem_chunk_free (key_mem_chunk, key);
|
g_slice_free (GtkGCKey, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gpointer
|
static gpointer
|
||||||
|
@ -84,8 +84,6 @@ static void gtk_item_factory_finalize (GObject *object);
|
|||||||
static GtkItemFactoryClass *gtk_item_factory_class = NULL;
|
static GtkItemFactoryClass *gtk_item_factory_class = NULL;
|
||||||
static gpointer parent_class = NULL;
|
static gpointer parent_class = NULL;
|
||||||
static const gchar item_factory_string[] = "Gtk-<ItemFactory>";
|
static const gchar item_factory_string[] = "Gtk-<ItemFactory>";
|
||||||
static GMemChunk *ifactory_item_chunks = NULL;
|
|
||||||
static GMemChunk *ifactory_cb_data_chunks = NULL;
|
|
||||||
static GQuark quark_popup_data = 0;
|
static GQuark quark_popup_data = 0;
|
||||||
static GQuark quark_if_menu_pos = 0;
|
static GQuark quark_if_menu_pos = 0;
|
||||||
static GQuark quark_item_factory = 0;
|
static GQuark quark_item_factory = 0;
|
||||||
@ -148,16 +146,6 @@ gtk_item_factory_class_init (GtkItemFactoryClass *class)
|
|||||||
object_class->destroy = gtk_item_factory_destroy;
|
object_class->destroy = gtk_item_factory_destroy;
|
||||||
|
|
||||||
class->item_ht = g_hash_table_new (g_str_hash, g_str_equal);
|
class->item_ht = g_hash_table_new (g_str_hash, g_str_equal);
|
||||||
ifactory_item_chunks =
|
|
||||||
g_mem_chunk_new ("GtkItemFactoryItem",
|
|
||||||
sizeof (GtkItemFactoryItem),
|
|
||||||
sizeof (GtkItemFactoryItem) * ITEM_BLOCK_SIZE,
|
|
||||||
G_ALLOC_ONLY);
|
|
||||||
ifactory_cb_data_chunks =
|
|
||||||
g_mem_chunk_new ("GtkIFCBData",
|
|
||||||
sizeof (GtkIFCBData),
|
|
||||||
sizeof (GtkIFCBData) * ITEM_BLOCK_SIZE,
|
|
||||||
G_ALLOC_AND_FREE);
|
|
||||||
|
|
||||||
quark_popup_data = g_quark_from_static_string ("GtkItemFactory-popup-data");
|
quark_popup_data = g_quark_from_static_string ("GtkItemFactory-popup-data");
|
||||||
quark_if_menu_pos = g_quark_from_static_string ("GtkItemFactory-menu-position");
|
quark_if_menu_pos = g_quark_from_static_string ("GtkItemFactory-menu-position");
|
||||||
@ -289,7 +277,7 @@ gtk_item_factory_add_foreign (GtkWidget *accel_widget,
|
|||||||
item = g_hash_table_lookup (class->item_ht, full_path);
|
item = g_hash_table_lookup (class->item_ht, full_path);
|
||||||
if (!item)
|
if (!item)
|
||||||
{
|
{
|
||||||
item = g_chunk_new (GtkItemFactoryItem, ifactory_item_chunks);
|
item = g_slice_new (GtkItemFactoryItem);
|
||||||
|
|
||||||
item->path = g_strdup (full_path);
|
item->path = g_strdup (full_path);
|
||||||
item->widgets = NULL;
|
item->widgets = NULL;
|
||||||
@ -333,7 +321,7 @@ gtk_item_factory_add_foreign (GtkWidget *accel_widget,
|
|||||||
static void
|
static void
|
||||||
ifactory_cb_data_free (gpointer mem)
|
ifactory_cb_data_free (gpointer mem)
|
||||||
{
|
{
|
||||||
g_mem_chunk_free (ifactory_cb_data_chunks, mem);
|
g_slice_free (GtkIFCBData, mem);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -369,7 +357,7 @@ gtk_item_factory_add_item (GtkItemFactory *ifactory,
|
|||||||
{
|
{
|
||||||
GtkIFCBData *data;
|
GtkIFCBData *data;
|
||||||
|
|
||||||
data = g_chunk_new (GtkIFCBData, ifactory_cb_data_chunks);
|
data = g_slice_new (GtkIFCBData);
|
||||||
data->func = callback;
|
data->func = callback;
|
||||||
data->callback_type = callback_type;
|
data->callback_type = callback_type;
|
||||||
data->func_data = callback_data;
|
data->func_data = callback_data;
|
||||||
|
@ -144,8 +144,6 @@ static GList *init_functions = NULL; /* A list of init functions.
|
|||||||
*/
|
*/
|
||||||
static GList *quit_functions = NULL; /* A list of quit functions.
|
static GList *quit_functions = NULL; /* A list of quit functions.
|
||||||
*/
|
*/
|
||||||
static GMemChunk *quit_mem_chunk = NULL;
|
|
||||||
|
|
||||||
static GSList *key_snoopers = NULL;
|
static GSList *key_snoopers = NULL;
|
||||||
|
|
||||||
guint gtk_debug_flags = 0; /* Global GTK debug flag */
|
guint gtk_debug_flags = 0; /* Global GTK debug flag */
|
||||||
@ -1693,11 +1691,7 @@ gtk_quit_add_full (guint main_level,
|
|||||||
|
|
||||||
g_return_val_if_fail ((function != NULL) || (marshal != NULL), 0);
|
g_return_val_if_fail ((function != NULL) || (marshal != NULL), 0);
|
||||||
|
|
||||||
if (!quit_mem_chunk)
|
quitf = g_slice_new (GtkQuitFunction);
|
||||||
quit_mem_chunk = g_mem_chunk_new ("quit mem chunk", sizeof (GtkQuitFunction),
|
|
||||||
512, G_ALLOC_AND_FREE);
|
|
||||||
|
|
||||||
quitf = g_chunk_new (GtkQuitFunction, quit_mem_chunk);
|
|
||||||
|
|
||||||
quitf->id = quit_id++;
|
quitf->id = quit_id++;
|
||||||
quitf->main_level = main_level;
|
quitf->main_level = main_level;
|
||||||
@ -1716,7 +1710,7 @@ gtk_quit_destroy (GtkQuitFunction *quitf)
|
|||||||
{
|
{
|
||||||
if (quitf->destroy)
|
if (quitf->destroy)
|
||||||
quitf->destroy (quitf->data);
|
quitf->destroy (quitf->data);
|
||||||
g_mem_chunk_free (quit_mem_chunk, quitf);
|
g_slice_free (GtkQuitFunction, quitf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
|
@ -442,10 +442,6 @@ static void gtk_text_show_props (GtkText* test,
|
|||||||
#define TEXT_SHOW_ADJ(text,adj,msg)
|
#define TEXT_SHOW_ADJ(text,adj,msg)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Memory Management. */
|
|
||||||
static GMemChunk *params_mem_chunk = NULL;
|
|
||||||
static GMemChunk *text_property_chunk = NULL;
|
|
||||||
|
|
||||||
static GtkWidgetClass *parent_class = NULL;
|
static GtkWidgetClass *parent_class = NULL;
|
||||||
|
|
||||||
|
|
||||||
@ -735,12 +731,6 @@ gtk_text_init (GtkText *text)
|
|||||||
|
|
||||||
text->freeze_count = 0;
|
text->freeze_count = 0;
|
||||||
|
|
||||||
if (!params_mem_chunk)
|
|
||||||
params_mem_chunk = g_mem_chunk_new ("LineParams",
|
|
||||||
sizeof (LineParams),
|
|
||||||
256 * sizeof (LineParams),
|
|
||||||
G_ALLOC_AND_FREE);
|
|
||||||
|
|
||||||
text->default_tab_width = 4;
|
text->default_tab_width = 4;
|
||||||
text->tab_stops = NULL;
|
text->tab_stops = NULL;
|
||||||
|
|
||||||
@ -2293,7 +2283,7 @@ line_params_iterate (GtkText* text,
|
|||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
if (alloc)
|
if (alloc)
|
||||||
lp = g_chunk_new (LineParams, params_mem_chunk);
|
lp = g_slice_new (LineParams);
|
||||||
else
|
else
|
||||||
lp = &lpbuf;
|
lp = &lpbuf;
|
||||||
|
|
||||||
@ -2977,15 +2967,7 @@ new_text_property (GtkText *text, GdkFont *font, const GdkColor* fore,
|
|||||||
{
|
{
|
||||||
TextProperty *prop;
|
TextProperty *prop;
|
||||||
|
|
||||||
if (text_property_chunk == NULL)
|
prop = g_slice_new (TextProperty);
|
||||||
{
|
|
||||||
text_property_chunk = g_mem_chunk_new ("text property mem chunk",
|
|
||||||
sizeof(TextProperty),
|
|
||||||
1024*sizeof(TextProperty),
|
|
||||||
G_ALLOC_AND_FREE);
|
|
||||||
}
|
|
||||||
|
|
||||||
prop = g_chunk_new(TextProperty, text_property_chunk);
|
|
||||||
|
|
||||||
prop->flags = 0;
|
prop->flags = 0;
|
||||||
if (font)
|
if (font)
|
||||||
@ -3022,7 +3004,7 @@ destroy_text_property (TextProperty *prop)
|
|||||||
if (prop->font)
|
if (prop->font)
|
||||||
text_font_unref (prop->font);
|
text_font_unref (prop->font);
|
||||||
|
|
||||||
g_mem_chunk_free (text_property_chunk, prop);
|
g_slice_free (TextProperty, prop);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Flop the memory between the point and the gap around like a
|
/* Flop the memory between the point and the gap around like a
|
||||||
@ -3778,7 +3760,7 @@ free_cache (GtkText* text)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (; cache; cache = cache->next)
|
for (; cache; cache = cache->next)
|
||||||
g_mem_chunk_free (params_mem_chunk, cache->data);
|
g_slice_free (LineParams, cache->data);
|
||||||
|
|
||||||
g_list_free (text->line_start_cache);
|
g_list_free (text->line_start_cache);
|
||||||
|
|
||||||
@ -3804,7 +3786,7 @@ remove_cache_line (GtkText* text, GList* member)
|
|||||||
|
|
||||||
list = member->next;
|
list = member->next;
|
||||||
|
|
||||||
g_mem_chunk_free (params_mem_chunk, member->data);
|
g_slice_free (LineParams, member->data);
|
||||||
g_list_free_1 (member);
|
g_list_free_1 (member);
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
@ -24,8 +24,6 @@
|
|||||||
#include "gtktreedatalist.h"
|
#include "gtktreedatalist.h"
|
||||||
#include "gtkalias.h"
|
#include "gtkalias.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
static GMemChunk *tree_chunk = NULL;
|
|
||||||
#define TREE_CHUNK_PREALLOCS 64
|
|
||||||
|
|
||||||
/* node allocation
|
/* node allocation
|
||||||
*/
|
*/
|
||||||
@ -34,14 +32,7 @@ _gtk_tree_data_list_alloc (void)
|
|||||||
{
|
{
|
||||||
GtkTreeDataList *list;
|
GtkTreeDataList *list;
|
||||||
|
|
||||||
if (tree_chunk == NULL)
|
list = g_slice_new0 (GtkTreeDataList);
|
||||||
tree_chunk = g_mem_chunk_new ("treedatalist mem chunk",
|
|
||||||
sizeof (GtkTreeDataList),
|
|
||||||
sizeof (GtkTreeDataList) * TREE_CHUNK_PREALLOCS,
|
|
||||||
G_ALLOC_AND_FREE);
|
|
||||||
|
|
||||||
list = g_chunk_new (GtkTreeDataList, tree_chunk);
|
|
||||||
memset (list, 0, sizeof (GtkTreeDataList));
|
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
@ -65,7 +56,7 @@ _gtk_tree_data_list_free (GtkTreeDataList *list,
|
|||||||
else if (g_type_is_a (column_headers [i], G_TYPE_BOXED) && tmp->data.v_pointer != NULL)
|
else if (g_type_is_a (column_headers [i], G_TYPE_BOXED) && tmp->data.v_pointer != NULL)
|
||||||
g_boxed_free (column_headers [i], (gpointer) tmp->data.v_pointer);
|
g_boxed_free (column_headers [i], (gpointer) tmp->data.v_pointer);
|
||||||
|
|
||||||
g_mem_chunk_free (tree_chunk, tmp);
|
g_slice_free (GtkTreeDataList, tmp);
|
||||||
i++;
|
i++;
|
||||||
tmp = next;
|
tmp = next;
|
||||||
}
|
}
|
||||||
|
@ -166,8 +166,6 @@ enum
|
|||||||
static GObjectClass *parent_class = NULL;
|
static GObjectClass *parent_class = NULL;
|
||||||
static guint ui_manager_signals[LAST_SIGNAL] = { 0 };
|
static guint ui_manager_signals[LAST_SIGNAL] = { 0 };
|
||||||
|
|
||||||
static GMemChunk *merge_node_chunk = NULL;
|
|
||||||
|
|
||||||
GType
|
GType
|
||||||
gtk_ui_manager_get_type (void)
|
gtk_ui_manager_get_type (void)
|
||||||
{
|
{
|
||||||
@ -205,10 +203,6 @@ gtk_ui_manager_class_init (GtkUIManagerClass *klass)
|
|||||||
|
|
||||||
gobject_class = G_OBJECT_CLASS (klass);
|
gobject_class = G_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
if (!merge_node_chunk)
|
|
||||||
merge_node_chunk = g_mem_chunk_create (Node, 64,
|
|
||||||
G_ALLOC_AND_FREE);
|
|
||||||
|
|
||||||
gobject_class->finalize = gtk_ui_manager_finalize;
|
gobject_class->finalize = gtk_ui_manager_finalize;
|
||||||
gobject_class->set_property = gtk_ui_manager_set_property;
|
gobject_class->set_property = gtk_ui_manager_set_property;
|
||||||
gobject_class->get_property = gtk_ui_manager_get_property;
|
gobject_class->get_property = gtk_ui_manager_get_property;
|
||||||
@ -893,7 +887,7 @@ get_child_node (GtkUIManager *self,
|
|||||||
{
|
{
|
||||||
Node *mnode;
|
Node *mnode;
|
||||||
|
|
||||||
mnode = g_chunk_new0 (Node, merge_node_chunk);
|
mnode = g_slice_new0 (Node);
|
||||||
mnode->type = node_type;
|
mnode->type = node_type;
|
||||||
mnode->name = g_strndup (childname, childname_length);
|
mnode->name = g_strndup (childname, childname_length);
|
||||||
|
|
||||||
@ -933,7 +927,7 @@ get_child_node (GtkUIManager *self,
|
|||||||
{
|
{
|
||||||
Node *mnode;
|
Node *mnode;
|
||||||
|
|
||||||
mnode = g_chunk_new0 (Node, merge_node_chunk);
|
mnode = g_slice_new0 (Node);
|
||||||
mnode->type = node_type;
|
mnode->type = node_type;
|
||||||
mnode->name = g_strndup (childname, childname_length);
|
mnode->name = g_strndup (childname, childname_length);
|
||||||
mnode->dirty = TRUE;
|
mnode->dirty = TRUE;
|
||||||
@ -1001,7 +995,7 @@ free_node (GNode *node)
|
|||||||
if (info->extra)
|
if (info->extra)
|
||||||
g_object_unref (info->extra);
|
g_object_unref (info->extra);
|
||||||
g_free (info->name);
|
g_free (info->name);
|
||||||
g_chunk_free (info, merge_node_chunk);
|
g_slice_free (Node, info);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -236,7 +236,6 @@ static void gtk_widget_get_draw_rectangle (GtkWidget *widget,
|
|||||||
/* --- variables --- */
|
/* --- variables --- */
|
||||||
static gpointer parent_class = NULL;
|
static gpointer parent_class = NULL;
|
||||||
static guint widget_signals[LAST_SIGNAL] = { 0 };
|
static guint widget_signals[LAST_SIGNAL] = { 0 };
|
||||||
static GMemChunk *aux_info_mem_chunk = NULL;
|
|
||||||
static GtkStyle *gtk_default_style = NULL;
|
static GtkStyle *gtk_default_style = NULL;
|
||||||
static GSList *colormap_stack = NULL;
|
static GSList *colormap_stack = NULL;
|
||||||
static guint composite_child_stack = 0;
|
static guint composite_child_stack = 0;
|
||||||
@ -6942,11 +6941,7 @@ _gtk_widget_get_aux_info (GtkWidget *widget,
|
|||||||
aux_info = g_object_get_qdata (G_OBJECT (widget), quark_aux_info);
|
aux_info = g_object_get_qdata (G_OBJECT (widget), quark_aux_info);
|
||||||
if (!aux_info && create)
|
if (!aux_info && create)
|
||||||
{
|
{
|
||||||
if (!aux_info_mem_chunk)
|
aux_info = g_slice_new (GtkWidgetAuxInfo);
|
||||||
aux_info_mem_chunk = g_mem_chunk_new ("widget aux info mem chunk",
|
|
||||||
sizeof (GtkWidgetAuxInfo),
|
|
||||||
1024, G_ALLOC_AND_FREE);
|
|
||||||
aux_info = g_chunk_new (GtkWidgetAuxInfo, aux_info_mem_chunk);
|
|
||||||
|
|
||||||
aux_info->width = -1;
|
aux_info->width = -1;
|
||||||
aux_info->height = -1;
|
aux_info->height = -1;
|
||||||
@ -6971,7 +6966,7 @@ _gtk_widget_get_aux_info (GtkWidget *widget,
|
|||||||
static void
|
static void
|
||||||
gtk_widget_aux_info_destroy (GtkWidgetAuxInfo *aux_info)
|
gtk_widget_aux_info_destroy (GtkWidgetAuxInfo *aux_info)
|
||||||
{
|
{
|
||||||
g_mem_chunk_free (aux_info_mem_chunk, aux_info);
|
g_slice_free (GtkWidgetAuxInfo, aux_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user