summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-09-17 20:02:12 -0400
committerMatthias Clasen <mclasen@redhat.com>2021-09-17 20:02:12 -0400
commitc4e558da46e089c2c5b952482803a6f1637cfb53 (patch)
treee21803df6c2a0cf2f2e9f32d733dc8675c67c9ac /gtk
parentbe1a60d5d00d060ddf93fd4d3f44509d17411150 (diff)
downloadgtk+-c4e558da46e089c2c5b952482803a6f1637cfb53.tar.gz
imcontextsimple: Rewrite a function slightly
This hopefully avoids upsetting static analyis.
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtkimcontextsimple.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/gtk/gtkimcontextsimple.c b/gtk/gtkimcontextsimple.c
index 4da14cbb9d..cb14e44e0f 100644
--- a/gtk/gtkimcontextsimple.c
+++ b/gtk/gtkimcontextsimple.c
@@ -270,7 +270,6 @@ gtk_im_context_simple_init_compose_table (void)
const char *locale;
char **langs = NULL;
char **lang = NULL;
- gboolean added;
const char * const sys_langs[] = { "el_gr", "fi_fi", "pt_br", NULL };
const char * const *sys_lang = NULL;
char *x11_compose_file_dir = get_x11_compose_file_dir ();
@@ -278,10 +277,11 @@ gtk_im_context_simple_init_compose_table (void)
path = g_build_filename (g_get_user_config_dir (), "gtk-4.0", "Compose", NULL);
if (g_file_test (path, G_FILE_TEST_EXISTS))
{
- added = add_compose_table_from_file (path);
- g_free (path);
- if (added)
- return;
+ if (add_compose_table_from_file (path))
+ {
+ g_free (path);
+ return;
+ }
}
g_clear_pointer (&path, g_free);
@@ -292,10 +292,11 @@ gtk_im_context_simple_init_compose_table (void)
path = g_build_filename (home, ".XCompose", NULL);
if (g_file_test (path, G_FILE_TEST_EXISTS))
{
- added = add_compose_table_from_file (path);
- g_free (path);
- if (added)
- return;
+ if (add_compose_table_from_file (path))
+ {
+ g_free (path);
+ return;
+ }
}
g_clear_pointer (&path, g_free);
@@ -336,13 +337,13 @@ gtk_im_context_simple_init_compose_table (void)
g_free (x11_compose_file_dir);
g_strfreev (langs);
- if (path != NULL)
+ if (path != NULL &&
+ add_compose_table_from_file (path))
{
- added = add_compose_table_from_file (path);
g_free (path);
+ return;
}
- if (added)
- return;
+ g_clear_pointer (&path, g_free);
add_builtin_compose_table ();
}