mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-28 16:36:14 +01:00
gkeyfile: Eliminate strcmp()s when looking up a group node
Rather than looking for the group node by comparing each name in the linked list of `GKeyFileGroup` instances, look up the `GKeyFileGroup` in the hash table, then look up its `GList` node by pointer. Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
parent
cba8d59737
commit
c29601818f
@ -4080,17 +4080,12 @@ g_key_file_lookup_group_node (GKeyFile *key_file,
|
||||
const gchar *group_name)
|
||||
{
|
||||
GKeyFileGroup *group;
|
||||
GList *tmp;
|
||||
|
||||
for (tmp = key_file->groups; tmp != NULL; tmp = tmp->next)
|
||||
{
|
||||
group = (GKeyFileGroup *) tmp->data;
|
||||
group = g_key_file_lookup_group (key_file, group_name);
|
||||
if (group == NULL)
|
||||
return NULL;
|
||||
|
||||
if (group && group->name && strcmp (group->name, group_name) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
return tmp;
|
||||
return g_list_find (key_file->groups, group);
|
||||
}
|
||||
|
||||
static GKeyFileGroup *
|
||||
|
Loading…
Reference in New Issue
Block a user