From f471afb646dbb141b5ab5231fce795d4fbaa30bc Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Sun, 14 Mar 2021 16:51:02 +0000 Subject: [PATCH] gkeyfile: Clarify behaviour of locales and checked_locales MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- glib/gkeyfile.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/glib/gkeyfile.c b/glib/gkeyfile.c index fa99da8d9..0f8d18e44 100644 --- a/glib/gkeyfile.c +++ b/glib/gkeyfile.c @@ -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; }