Remove redundant NULL checks

svn path=/trunk/; revision=5264
This commit is contained in:
Matthias Clasen 2007-01-15 03:49:43 +00:00
parent a74d6b9582
commit 0b11148fa3
3 changed files with 17 additions and 26 deletions

View File

@ -1,3 +1,9 @@
2005-01-15 Matthias Clasen <mclasen@redhat.com>
* glib/giochannel.c:
* glib/gbookmarkfile.c: Remove redundant NULL-checks.
(#369668, Morten Welinder)
2005-01-15 Matthias Clasen <mclasen@redhat.com>
* glib/gthread.c:

View File

@ -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);

View File

@ -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;
}