Remove redundant code. (g_key_file_get_group_comment): Don't dereference

2006-04-25  Matthias Clasen  <mclasen@redhat.com>

	* glib/gkeyfile.c (g_key_file_lookup_group_node): Remove
	redundant code.
	(g_key_file_get_group_comment): Don't dereference before
	checking for NULL.  (#338572, Coverity, Pascal Terjan)
This commit is contained in:
Matthias Clasen 2006-04-25 20:30:59 +00:00 committed by Matthias Clasen
parent 5dd378d2bd
commit 3916fe18d6
3 changed files with 16 additions and 5 deletions

View File

@ -1,3 +1,10 @@
2006-04-25 Matthias Clasen <mclasen@redhat.com>
* glib/gkeyfile.c (g_key_file_lookup_group_node): Remove
redundant code.
(g_key_file_get_group_comment): Don't dereference before
checking for NULL. (#338572, Coverity, Pascal Terjan)
2006-04-19 Matthias Clasen <mclasen@redhat.com>
* glib/gdataset.c: Add some missing Since: 2.8 tags.

View File

@ -1,3 +1,10 @@
2006-04-25 Matthias Clasen <mclasen@redhat.com>
* glib/gkeyfile.c (g_key_file_lookup_group_node): Remove
redundant code.
(g_key_file_get_group_comment): Don't dereference before
checking for NULL. (#338572, Coverity, Pascal Terjan)
2006-04-19 Matthias Clasen <mclasen@redhat.com>
* glib/gdataset.c: Add some missing Since: 2.8 tags.

View File

@ -2699,8 +2699,7 @@ g_key_file_get_group_comment (GKeyFile *key_file,
GKeyFileGroup *group;
group_node = g_key_file_lookup_group_node (key_file, group_name);
group = (GKeyFileGroup *)group_node->data;
if (!group)
if (!group_node)
{
g_set_error (error, G_KEY_FILE_ERROR,
G_KEY_FILE_ERROR_GROUP_NOT_FOUND,
@ -2710,6 +2709,7 @@ g_key_file_get_group_comment (GKeyFile *key_file,
return NULL;
}
group = (GKeyFileGroup *)group_node->data;
if (group->comment)
return g_strdup (group->comment->value);
@ -3119,15 +3119,12 @@ g_key_file_lookup_group_node (GKeyFile *key_file,
GKeyFileGroup *group;
GList *tmp;
group = NULL;
for (tmp = key_file->groups; tmp != NULL; tmp = tmp->next)
{
group = (GKeyFileGroup *) tmp->data;
if (group && group->name && strcmp (group->name, group_name) == 0)
break;
group = NULL;
}
return tmp;