Slice allocations in addons, net, scrolled, transferbar

This commit is contained in:
Christian Dywan 2010-10-21 21:05:36 +02:00
parent 45ebf4dcdb
commit 68c12e950e
6 changed files with 22 additions and 30 deletions

View file

@ -527,6 +527,7 @@ addons_free_elements (GSList* elements)
g_free (element->script_content);
g_slist_free (element->includes);
g_slist_free (element->excludes);
g_slice_free (struct AddonElement, element);
elements = g_slist_next (elements);
}
@ -998,7 +999,7 @@ addons_update_elements (MidoriExtension* extension,
gchar* tooltip;
fullpath = addon_files->data;
element = g_new (struct AddonElement, 1);
element = g_slice_new (struct AddonElement);
element->displayname = g_filename_display_basename (fullpath);
element->fullpath = fullpath;
element->enabled = TRUE;
@ -1065,9 +1066,8 @@ addons_update_elements (MidoriExtension* extension,
g_free (config_file);
g_key_file_free (keyfile);
if (addons_list)
g_free (addons_list);
addons_list = g_new (struct AddonsList, 1);
g_slice_free (struct AddonsList, addons_list);
addons_list = g_slice_new (struct AddonsList);
addons_list->elements = elements;
addons_list->liststore = liststore;

View file

@ -103,8 +103,7 @@ authentication_message_got_headers_cb (SoupMessage* msg,
if (!g_hash_table_lookup (save->http_auth->logins, opaque_info))
{
KatzeHttpAuthLogin* login;
login = g_new (KatzeHttpAuthLogin, 1);
KatzeHttpAuthLogin* login = g_slice_new (KatzeHttpAuthLogin);
login->username = save->username;
login->password = save->password;
g_hash_table_insert (save->http_auth->logins, opaque_info, login);
@ -130,7 +129,7 @@ authentication_message_got_headers_cb (SoupMessage* msg,
}
/* FIXME g_object_unref (save->auth); */
/* FIXME g_free (save); */
/* FIXME g_slice_free (KatzeHttpAuthSave, save); */
g_signal_handlers_disconnect_by_func (msg,
authentication_message_got_headers_cb, save);
}
@ -164,7 +163,7 @@ authentication_dialog_response_cb (GtkWidget* dialog,
else
{
g_object_unref (save->auth);
g_free (save);
g_slice_free (KatzeHttpAuthSave, save);
}
}
@ -280,7 +279,7 @@ katze_http_auth_session_authenticate_cb (SoupSession* session,
g_object_set_data (G_OBJECT (dialog), "session", session);
g_object_set_data (G_OBJECT (dialog), "msg", msg);
save = g_new (KatzeHttpAuthSave, 1);
save = g_slice_new0 (KatzeHttpAuthSave);
save->http_auth = http_auth;
save->auth = g_object_ref (auth);
g_signal_connect (dialog, "response",
@ -366,7 +365,7 @@ katze_http_auth_login_free (KatzeHttpAuthLogin* login)
{
g_free (login->username);
g_free (login->password);
g_free (login);
g_slice_free (KatzeHttpAuthLogin, login);
}
static void
@ -389,12 +388,9 @@ katze_http_auth_set_filename (KatzeHttpAuth* http_auth,
gchar** parts = g_strsplit (line, "\t", 3);
if (parts && parts[0] && parts[1] && parts[2])
{
KatzeHttpAuthLogin* login;
gint length;
login = g_new (KatzeHttpAuthLogin, 1);
gint length = strlen (parts[2]);
KatzeHttpAuthLogin* login = g_slice_new (KatzeHttpAuthLogin);
login->username = parts[1];
length = strlen (parts[2]);
if (parts[2][length - 1] == '\n')
length--;
login->password = g_strndup (parts[2], length);

View file

@ -95,16 +95,12 @@ typedef struct
static void
katze_net_priv_free (KatzeNetPriv* priv)
{
KatzeNetRequest* request;
request = priv->request;
KatzeNetRequest* request = priv->request;
g_free (request->uri);
g_free (request->mime_type);
g_free (request->data);
g_free (request);
g_free (priv);
g_slice_free (KatzeNetRequest, request);
g_slice_free (KatzeNetPriv, priv);
}
gchar*
@ -276,12 +272,12 @@ katze_net_load_uri (KatzeNet* net,
if (!status_cb && !transfer_cb)
return;
request = g_new0 (KatzeNetRequest, 1);
request = g_slice_new (KatzeNetRequest);
request->uri = g_strdup (uri);
request->mime_type = NULL;
request->data = NULL;
priv = g_new0 (KatzeNetPriv, 1);
priv = g_slice_new (KatzeNetPriv);
priv->status_cb = status_cb;
priv->transfer_cb = transfer_cb;
priv->user_data = user_data;

View file

@ -203,7 +203,7 @@ katze_scrolled_event_handler_func (GdkEvent* event,
EventHandlerData* data;
gboolean stop_propagating;
state = g_new0 (KatzeScrolledState, 1);
state = g_slice_new (KatzeScrolledState);
state->current_event_handler = g_list_first (event_handlers);
if (state->current_event_handler)
{
@ -216,7 +216,7 @@ katze_scrolled_event_handler_func (GdkEvent* event,
else
gtk_main_do_event (event);
g_free (state);
g_slice_free (KatzeScrolledState, state);
}
static GdkWindow* current_gdk_window;

View file

@ -764,7 +764,7 @@ katze_net_icon_priv_free (KatzeNetIconPriv* priv)
{
g_free (priv->icon_file);
g_free (priv->icon_uri);
g_free (priv);
g_slice_free (KatzeNetIconPriv, priv);
}
static gboolean
@ -896,7 +896,7 @@ _midori_web_view_load_icon (MidoriView* view)
}
else
{
priv = g_new0 (KatzeNetIconPriv, 1);
priv = g_slice_new (KatzeNetIconPriv);
priv->icon_file = icon_file;
priv->icon_uri = icon_uri;
priv->view = view;

View file

@ -55,7 +55,7 @@ midori_transferbar_info_free (gpointer data)
transferbar->infos = g_list_remove (transferbar->infos, info);
g_object_unref (info->download);
gtk_widget_destroy (info->toolitem);
g_free (info);
g_slice_free (TransferInfo, info);
if (!transferbar->infos || !g_list_nth_data (transferbar->infos, 0))
gtk_widget_hide (GTK_WIDGET (transferbar->clear));
@ -210,7 +210,7 @@ midori_transferbar_add_download_item (MidoriTransferbar* transferbar,
gtk_toolbar_insert (GTK_TOOLBAR (transferbar), toolitem, 0);
gtk_widget_show (GTK_WIDGET (transferbar->clear));
info = g_new (TransferInfo, 1);
info = g_slice_new (TransferInfo);
info->download = g_object_ref (download);
info->button = button;
info->toolitem = GTK_WIDGET (toolitem);