[glib: 12/17] gkeyfile: Clarify behaviour of locales and checked_locales
- From: Sebastian Dröge <sdroege src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 12/17] gkeyfile: Clarify behaviour of locales and checked_locales
- Date: Tue, 2 Nov 2021 11:08:17 +0000 (UTC)
commit f471afb646dbb141b5ab5231fce795d4fbaa30bc
Author: Philip Withnall <pwithnall endlessos org>
Date: Sun Mar 14 16:51:02 2021 +0000
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>
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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]