From 0b11148fa3a07fa1f582d74cb22fbb92bdd458e9 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 15 Jan 2007 03:49:43 +0000 Subject: [PATCH] Remove redundant NULL checks svn path=/trunk/; revision=5264 --- ChangeLog | 6 ++++++ glib/gbookmarkfile.c | 31 +++++++++---------------------- glib/giochannel.c | 6 ++---- 3 files changed, 17 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index b69daa63e..288f1845e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-01-15 Matthias Clasen + + * glib/giochannel.c: + * glib/gbookmarkfile.c: Remove redundant NULL-checks. + (#369668, Morten Welinder) + 2005-01-15 Matthias Clasen * glib/gthread.c: diff --git a/glib/gbookmarkfile.c b/glib/gbookmarkfile.c index c2982f13e..dd95fff16 100644 --- a/glib/gbookmarkfile.c +++ b/glib/gbookmarkfile.c @@ -237,11 +237,8 @@ bookmark_app_info_free (BookmarkAppInfo *app_info) if (!app_info) return; - if (app_info->name) - g_free (app_info->name); - - if (app_info->exec) - g_free (app_info->exec); + g_free (app_info->name); + g_free (app_info->exec); g_slice_free (BookmarkAppInfo, app_info); } @@ -311,8 +308,7 @@ bookmark_metadata_free (BookmarkMetadata *metadata) if (!metadata) return; - if (metadata->mime_type) - g_free (metadata->mime_type); + g_free (metadata->mime_type); if (metadata->groups) { @@ -332,11 +328,8 @@ bookmark_metadata_free (BookmarkMetadata *metadata) g_hash_table_destroy (metadata->apps_by_name); } - if (metadata->icon_href) - g_free (metadata->icon_href); - - if (metadata->icon_mime) - g_free (metadata->icon_mime); + g_free (metadata->icon_href); + g_free (metadata->icon_mime); g_slice_free (BookmarkMetadata, metadata); } @@ -491,14 +484,9 @@ bookmark_item_free (BookmarkItem *item) if (!item) return; - if (item->uri) - g_free (item->uri); - - if (item->title) - g_free (item->title); - - if (item->description) - g_free (item->description); + g_free (item->uri); + g_free (item->title); + g_free (item->description); if (item->metadata) bookmark_metadata_free (item->metadata); @@ -2319,8 +2307,7 @@ g_bookmark_file_set_mime_type (GBookmarkFile *bookmark, if (!item->metadata) item->metadata = bookmark_metadata_new (); - if (item->metadata->mime_type != NULL) - g_free (item->metadata->mime_type); + g_free (item->metadata->mime_type); item->metadata->mime_type = g_strdup (mime_type); item->modified = time (NULL); diff --git a/glib/giochannel.c b/glib/giochannel.c index 42fcec29c..2f36b5e09 100644 --- a/glib/giochannel.c +++ b/glib/giochannel.c @@ -122,8 +122,7 @@ g_io_channel_unref (GIOChannel *channel) g_iconv_close (channel->read_cd); if (channel->write_cd != (GIConv) -1) g_iconv_close (channel->write_cd); - if (channel->line_term) - g_free (channel->line_term); + g_free (channel->line_term); if (channel->read_buf) g_string_free (channel->read_buf, TRUE); if (channel->write_buf) @@ -691,8 +690,7 @@ g_io_channel_set_line_term (GIOChannel *channel, else if (length < 0) length = strlen (line_term); - if (channel->line_term) - g_free (channel->line_term); + g_free (channel->line_term); channel->line_term = line_term ? g_memdup (line_term, length) : NULL; channel->line_term_len = length; }