summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDon Scorgie <dscorgie@git.gnome.org>2009-04-29 20:15:16 +0100
committerDon Scorgie <dscorgie@git.gnome.org>2009-04-29 20:15:16 +0100
commit8130453be3722d9799908a0b1409b5616cb1f6b3 (patch)
tree6ef141cac5e2bae809539ae054c7d108ecc85432
parent5b3356984a7a3b63928032a9a82175d9d73fee33 (diff)
downloadyelp-8130453be3722d9799908a0b1409b5616cb1f6b3.tar.gz
g_free is NULL-safe, so cleanup previous checkins
-rw-r--r--ChangeLog5
-rw-r--r--src/yelp-bookmarks.c15
-rw-r--r--src/yelp-window.c61
3 files changed, 22 insertions, 59 deletions
diff --git a/ChangeLog b/ChangeLog
index 7850312d..efcc44b5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,7 +5,10 @@
Convert gnome-config useage to GKeyFile
Bug #570731 based on the patch from
Filipp Ivanov
-
+ * src/yelp-window.c:
+ g_free is NULL-safe, so remove checks added in
+ previous checkin (and cleanup a little)
+
2009-04-29 Don Scorgie <dscorgie@svn.gnome.org>
* src/yelp-utils.c:
diff --git a/src/yelp-bookmarks.c b/src/yelp-bookmarks.c
index da63df70..4448c2e2 100644
--- a/src/yelp-bookmarks.c
+++ b/src/yelp-bookmarks.c
@@ -724,17 +724,10 @@ bookmarks_configure_cb (GtkWidget *widget, GdkEventConfigure *event,
keyfile = g_key_file_new ();
config_path = g_strconcat (g_get_home_dir (), BK_CONFIG_PATH, NULL);
- if( !g_key_file_load_from_file (keyfile, config_path,
- G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS,
- &config_error) ) {
- g_warning ("Failed to load config file: %s\n", config_error->message);
- g_error_free (config_error);
- } else {
- g_key_file_set_integer (keyfile, BK_CONFIG_BK_GROUP,
- BK_CONFIG_WIDTH, width);
- g_key_file_set_integer (keyfile, BK_CONFIG_BK_GROUP,
- BK_CONFIG_HEIGHT, height);
- }
+ g_key_file_set_integer (keyfile, BK_CONFIG_BK_GROUP,
+ BK_CONFIG_WIDTH, width);
+ g_key_file_set_integer (keyfile, BK_CONFIG_BK_GROUP,
+ BK_CONFIG_HEIGHT, height);
sdata = g_key_file_to_data (keyfile, &config_size, NULL);
diff --git a/src/yelp-window.c b/src/yelp-window.c
index 8e07076a..462c4fdc 100644
--- a/src/yelp-window.c
+++ b/src/yelp-window.c
@@ -724,10 +724,8 @@ history_step_back (YelpWindow *window)
priv = window->priv;
entry = history_pop_back (window);
- if (priv->current_frag) {
- g_free (priv->current_frag);
- priv->current_frag = NULL;
- }
+ g_free (priv->current_frag);
+ priv->current_frag = NULL;
if (entry) {
priv->current_frag = g_strdup (entry->frag_id);
@@ -924,8 +922,7 @@ page_request_cb (YelpDocument *document,
yelp_page_free ((YelpPage *) func_data);
gdk_window_set_cursor (GTK_WIDGET (window)->window, NULL);
- if (data)
- g_free (data);
+ g_free (data);
break;
case YELP_DOCUMENT_SIGNAL_TITLE:
/* We don't need to actually handle title signals as gecko
@@ -980,12 +977,9 @@ window_setup_window (YelpWindow *window, YelpRrnType type,
priv->current_type = type;
g_free (priv->uri);
priv->uri = g_strdup (loading_uri);
- if (priv->current_frag) {
- g_free (priv->current_frag);
- }
+ g_free (priv->current_frag);
priv->current_frag = g_strdup (frag);
- if (priv->req_uri)
- g_free (priv->req_uri);
+ g_free (priv->req_uri);
priv->req_uri = g_strdup (req_uri);
switch (priv->current_type) {
@@ -1048,16 +1042,8 @@ yelp_window_load (YelpWindow *window, const gchar *uri)
if (type == YELP_RRN_TYPE_ERROR) {
gchar *message = g_strdup_printf (_("The requested URI \"%s\" is invalid"), trace_uri);
window_error (window, _("Unable to load page"), message, FALSE);
- g_free (message);
- if (frag_id)
- g_free (frag_id);
- if (real_uri)
- g_free(real_uri);
- if (trace_uri)
- g_free(trace_uri);
- if (current_base)
- g_free(current_base);
- return;
+
+ goto Exit;
}
if (priv->uri && g_str_equal (real_uri, priv->uri)) {
@@ -1111,15 +1097,7 @@ yelp_window_load (YelpWindow *window, const gchar *uri)
window_error (window, _("Unable to load page"), message, FALSE);
g_free (message);
- if (frag_id)
- g_free (frag_id);
- if (real_uri)
- g_free(real_uri);
- if (trace_uri)
- g_free(trace_uri);
- if (current_base)
- g_free(current_base);
- return;
+ goto Exit;
}
if (!gtk_show_uri (NULL, trace_uri, gtk_get_current_event_time (), &error)) {
@@ -1127,15 +1105,7 @@ yelp_window_load (YelpWindow *window, const gchar *uri)
window_error (window, _("Unable to load page"), message, FALSE);
g_free (error);
error = NULL;
- if (frag_id)
- g_free (frag_id);
- if (real_uri)
- g_free(real_uri);
- if (trace_uri)
- g_free(trace_uri);
- if (current_base)
- g_free(current_base);
- return;
+ goto Exit;
}
}
break;
@@ -1166,14 +1136,11 @@ yelp_window_load (YelpWindow *window, const gchar *uri)
priv->current_document = doc;
}
- if (frag_id)
- g_free (frag_id);
- if (real_uri)
- g_free(real_uri);
- if (trace_uri)
- g_free(trace_uri);
- if (current_base)
- g_free(current_base);
+ Exit:
+ g_free (frag_id);
+ g_free(real_uri);
+ g_free(trace_uri);
+ g_free(current_base);
}
GtkUIManager *