gtk+ r19533 - in trunk: . gtk
- From: matthiasc svn gnome org
- To: svn-commits-list gnome org
- Subject: gtk+ r19533 - in trunk: . gtk
- Date: Tue, 12 Feb 2008 16:10:40 +0000 (GMT)
Author: matthiasc
Date: Tue Feb 12 16:10:39 2008
New Revision: 19533
URL: http://svn.gnome.org/viewvc/gtk+?rev=19533&view=rev
Log:
2008-02-12 Matthias Clasen <mclasen redhat com>
* gtk/gtkclipboard-quartz.c:
* gtkquartz.c:
* gtkselection.c: Use GSlice for GtkSelectionData. (#515060,
Christian Persch)
Modified:
trunk/ChangeLog
trunk/gtk/gtkclipboard-quartz.c
trunk/gtk/gtkquartz.c
trunk/gtk/gtkselection.c
Modified: trunk/gtk/gtkclipboard-quartz.c
==============================================================================
--- trunk/gtk/gtkclipboard-quartz.c (original)
+++ trunk/gtk/gtkclipboard-quartz.c Tue Feb 12 16:10:39 2008
@@ -858,7 +858,7 @@
count = [types count];
atom_list = _gtk_quartz_pasteboard_types_to_atom_list (types);
- selection_data = g_new (GtkSelectionData, 1);
+ selection_data = g_slice_new (GtkSelectionData);
selection_data->selection = clipboard->selection;
selection_data->target = target;
selection_data->type = GDK_SELECTION_TYPE_ATOM;
Modified: trunk/gtk/gtkquartz.c
==============================================================================
--- trunk/gtk/gtkquartz.c (original)
+++ trunk/gtk/gtkquartz.c Tue Feb 12 16:10:39 2008
@@ -156,7 +156,7 @@
{
GtkSelectionData *selection_data = NULL;
- selection_data = g_new0 (GtkSelectionData, 1);
+ selection_data = g_slice_new0 (GtkSelectionData);
selection_data->selection = selection;
selection_data->target = target;
Modified: trunk/gtk/gtkselection.c
==============================================================================
--- trunk/gtk/gtkselection.c (original)
+++ trunk/gtk/gtkselection.c Tue Feb 12 16:10:39 2008
@@ -198,7 +198,7 @@
gtk_target_list_new (const GtkTargetEntry *targets,
guint ntargets)
{
- GtkTargetList *result = g_new (GtkTargetList, 1);
+ GtkTargetList *result = g_slice_new (GtkTargetList);
result->list = NULL;
result->ref_count = 1;
@@ -246,13 +246,13 @@
while (tmp_list)
{
GtkTargetPair *pair = tmp_list->data;
- g_free (pair);
+ g_slice_free (GtkTargetPair, pair);
tmp_list = tmp_list->next;
}
g_list_free (list->list);
- g_free (list);
+ g_slice_free (GtkTargetList, list);
}
}
@@ -275,7 +275,7 @@
g_return_if_fail (list != NULL);
- pair = g_new (GtkTargetPair, 1);
+ pair = g_slice_new (GtkTargetPair);
pair->target = target;
pair->flags = flags;
pair->info = info;
@@ -483,7 +483,7 @@
for (i=ntargets-1; i >= 0; i--)
{
- GtkTargetPair *pair = g_new (GtkTargetPair, 1);
+ GtkTargetPair *pair = g_slice_new (GtkTargetPair);
pair->target = gdk_atom_intern (targets[i].target, FALSE);
pair->flags = targets[i].flags;
pair->info = targets[i].info;
@@ -514,7 +514,7 @@
if (pair->target == target)
{
- g_free (pair);
+ g_slice_free (GtkTargetPair, pair);
list->list = g_list_remove_link (list->list, tmp_list);
g_list_free_1 (tmp_list);
@@ -690,14 +690,14 @@
current_selections = g_list_remove_link (current_selections,
tmp_list);
g_list_free (tmp_list);
- g_free (selection_info);
+ g_slice_free (GtkSelectionInfo, selection_info);
}
}
else
{
if (selection_info == NULL)
{
- selection_info = g_new (GtkSelectionInfo, 1);
+ selection_info = g_slice_new (GtkSelectionInfo);
selection_info->selection = selection;
selection_info->widget = widget;
selection_info->time = time;
@@ -795,7 +795,7 @@
tmp_list = tmp_list->next;
}
- sellist = g_new (GtkSelectionTargetList, 1);
+ sellist = g_slice_new (GtkSelectionTargetList);
sellist->selection = selection;
sellist->list = gtk_target_list_new (NULL, 0);
@@ -821,7 +821,7 @@
gtk_target_list_unref (sellist->list);
- g_free (sellist);
+ g_slice_free (GtkSelectionTargetList, sellist);
tmp_list = tmp_list->next;
}
@@ -858,7 +858,7 @@
{
lists = g_list_delete_link (lists, tmp_list);
gtk_target_list_unref (sellist->list);
- g_free (sellist);
+ g_slice_free (GtkSelectionTargetList, sellist);
break;
}
@@ -985,7 +985,7 @@
current_selections = g_list_remove_link (current_selections,
tmp_list);
g_list_free (tmp_list);
- g_free (selection_info);
+ g_slice_free (GtkSelectionInfo, selection_info);
}
tmp_list = next;
@@ -1046,7 +1046,7 @@
tmp_list = tmp_list->next;
}
- info = g_new (GtkRetrievalInfo, 1);
+ info = g_slice_new (GtkRetrievalInfo);
info->widget = widget;
info->selection = selection;
@@ -1088,8 +1088,10 @@
time_);
g_free (selection_data.data);
+ selection_data.data = NULL;
+ selection_data.length = -1;
- g_free (info);
+ g_slice_free (GtkRetrievalInfo, info);
return TRUE;
}
}
@@ -1142,7 +1144,7 @@
if (length < 0)
selection_data->data = NULL;
else
- selection_data->data = g_strdup("");
+ selection_data->data = (guchar *) g_strdup ("");
}
selection_data->length = length;
@@ -1161,7 +1163,7 @@
{
gtk_selection_data_set (selection_data,
GDK_SELECTION_TYPE_STRING,
- 8, latin1, strlen (latin1));
+ 8, (guchar *) latin1, strlen (latin1));
g_free (latin1);
return TRUE;
@@ -1292,13 +1294,13 @@
gtk_selection_data_set (selection_data,
selection_data->target,
- 8, result, strlen (result));
+ 8, (guchar *) result, strlen (result));
g_free (result);
return TRUE;
}
-static gchar *
+static guchar *
selection_get_text_plain (GtkSelectionData *selection_data)
{
const gchar *charset = NULL;
@@ -1306,7 +1308,7 @@
gsize len;
GError *error = NULL;
- str = g_strdup (selection_data->data);
+ str = g_strdup ((const gchar *) selection_data->data);
len = selection_data->length;
if (selection_data->type == text_plain_atom)
@@ -1343,7 +1345,7 @@
result = normalize_to_lf (str, len);
g_free (str);
- return result;
+ return (guchar *) result;
}
/**
@@ -1430,7 +1432,7 @@
selection_data->length,
&list);
if (count > 0)
- result = list[0];
+ result = (guchar *) list[0];
for (i = 1; i < count; i++)
g_free (list[i]);
@@ -2052,7 +2054,7 @@
{
current_selections = g_list_remove_link (current_selections, tmp_list);
g_list_free (tmp_list);
- g_free (selection_info);
+ g_slice_free (GtkSelectionInfo, selection_info);
}
return TRUE;
@@ -2100,7 +2102,7 @@
if (tmp_list == NULL)
return FALSE;
- info = g_new (GtkIncrInfo, 1);
+ info = g_slice_new (GtkIncrInfo);
g_object_ref (widget);
@@ -2138,7 +2140,7 @@
GDK_NONE,
event->time);
g_free (mult_atoms);
- g_free (info);
+ g_slice_free (GtkIncrInfo, info);
gdk_error_trap_pop ();
return TRUE;
}
@@ -2316,7 +2318,7 @@
if (info->num_incrs == 0)
{
g_free (info->conversions);
- g_free (info);
+ g_slice_free (GtkIncrInfo, info);
}
g_object_unref (widget);
@@ -2484,7 +2486,7 @@
/* FIXME: we should check if requestor window is still in use,
and if not, remove it? */
- g_free (info);
+ g_slice_free (GtkIncrInfo, info);
retval = FALSE; /* remove timeout */
}
@@ -2728,7 +2730,7 @@
}
g_free (info->buffer);
- g_free (info);
+ g_slice_free (GtkRetrievalInfo, info);
retval = FALSE; /* remove timeout */
}
@@ -2916,7 +2918,7 @@
g_return_val_if_fail (data != NULL, NULL);
- new_data = g_new (GtkSelectionData, 1);
+ new_data = g_slice_new (GtkSelectionData);
*new_data = *data;
if (data->data)
@@ -2942,7 +2944,7 @@
g_free (data->data);
- g_free (data);
+ g_slice_free (GtkSelectionData, data);
}
GType
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]