gkeyfile: Clarify behaviour of locales and checked_locales

This should introduce no functional changes, but will remove an
unreachable branch in `g_key_file_locale_is_interesting()`:
`checked_locales` indicates whether `locales` has been initialised (and
it can be initialised to `NULL`), so there’s no point in checking
`locales` itself if `checked_locales` is checked.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
Philip Withnall 2021-03-14 16:51:02 +00:00
parent f93f24e41c
commit f471afb646

View File

@ -511,8 +511,8 @@ struct _GKeyFile
GKeyFileFlags flags;
gboolean checked_locales;
gchar **locales;
gboolean checked_locales; /* TRUE if @locales has been initialised */
gchar **locales; /* (nullable) */
gint ref_count; /* (atomic) */
};
@ -1240,6 +1240,7 @@ g_key_file_locale_is_interesting (GKeyFile *key_file,
if (!key_file->checked_locales)
{
g_assert (key_file->locales == NULL);
key_file->locales = g_strdupv ((gchar **)g_get_language_names ());
key_file->checked_locales = TRUE;
}