mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-29 08:56:15 +01:00
gkeyfile: Avoid an unnecessary strcmp()
As the groups are disambiguated by name via the `groups` hash table, there is guaranteed to be at most one `GKeyFileGroup` instance per group name, which means they can be compared for equality by `GKeyFileGroup` pointer, rather than needing a `strcmp()`. This speeds up key file parsing in all cases. oss-fuzz#31796 Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
parent
960030712d
commit
f71db39284
@ -1404,8 +1404,7 @@ g_key_file_parse_key_value_pair (GKeyFile *key_file,
|
||||
|
||||
if (key_file->current_group
|
||||
&& key_file->current_group->name
|
||||
&& strcmp (key_file->start_group->name,
|
||||
key_file->current_group->name) == 0
|
||||
&& key_file->start_group == key_file->current_group
|
||||
&& strcmp (key, "Encoding") == 0)
|
||||
{
|
||||
if (g_ascii_strcasecmp (value, "UTF-8") != 0)
|
||||
|
Loading…
Reference in New Issue
Block a user