[epiphany/mcatanzaro/#618: 2/2] Improve set_default_application_title()
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/mcatanzaro/#618: 2/2] Improve set_default_application_title()
- Date: Tue, 8 Jan 2019 21:02:29 +0000 (UTC)
commit 7f8aac63e9ba87b185f45a3d4541f04f2b465bde
Author: Michael Catanzaro <mcatanzaro igalia com>
Date: Tue Jan 8 14:28:27 2019 -0600
Improve set_default_application_title()
Use g_autoptr. Also, the title parameter should not be freed here; it
should be freed by the caller.
src/window-commands.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/src/window-commands.c b/src/window-commands.c
index 0f479f1ef..acf9368a0 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -1168,10 +1168,10 @@ get_special_case_application_title_for_host (const char *host)
static void
set_default_application_title (EphyApplicationDialogData *data,
- char *title)
+ const char *title)
{
if (title == NULL || title[0] == '\0') {
- SoupURI *uri;
+ g_autoptr(SoupURI) uri = NULL;
const char *host;
uri = soup_uri_new (webkit_web_view_get_uri (WEBKIT_WEB_VIEW (data->view)));
@@ -1187,8 +1187,6 @@ set_default_application_title (EphyApplicationDialogData *data,
title = g_strdup (host);
}
}
-
- soup_uri_free (uri);
}
if (title == NULL || title[0] == '\0') {
@@ -1196,7 +1194,6 @@ set_default_application_title (EphyApplicationDialogData *data,
}
gtk_entry_set_text (GTK_ENTRY (data->entry), title);
- g_free (title);
}
static void
@@ -1205,7 +1202,7 @@ fill_default_application_title_cb (GObject *source,
gpointer user_data)
{
EphyApplicationDialogData *data = user_data;
- char *title;
+ g_autofree char *title = NULL;
title = ephy_web_view_get_web_app_title_finish (EPHY_WEB_VIEW (source), async_result, NULL);
set_default_application_title (data, title);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]