summaryrefslogtreecommitdiff
path: root/gtk/queryimmodules.c
diff options
context:
space:
mode:
authorNoah Levitt <nlevitt@columbia.edu>2003-08-20 22:05:24 +0000
committerNoah Levitt <nlevitt@src.gnome.org>2003-08-20 22:05:24 +0000
commit6f1a9d469cf94f80eca2aeee808b568f8cfabd84 (patch)
tree9e590730ae76bce8a6a3f7325a5c55caa4bd2871 /gtk/queryimmodules.c
parentc8a9d2839cd397598ca57deb6f8b73c3fbf02d3b (diff)
downloadgdk-pixbuf-6f1a9d469cf94f80eca2aeee808b568f8cfabd84.tar.gz
Don't look at the same directory twice (in simple cases). (#120342)
2003-08-20 Noah Levitt <nlevitt@columbia.edu> * gtk/queryimmodules.c: Don't look at the same directory twice (in simple cases). (#120342)
Diffstat (limited to 'gtk/queryimmodules.c')
-rw-r--r--gtk/queryimmodules.c37
1 files changed, 22 insertions, 15 deletions
diff --git a/gtk/queryimmodules.c b/gtk/queryimmodules.c
index ad99169ae..b6eadf058 100644
--- a/gtk/queryimmodules.c
+++ b/gtk/queryimmodules.c
@@ -158,29 +158,36 @@ int main (int argc, char **argv)
{
char **dirs;
int i;
+ GHashTable *dirs_done;
path = gtk_rc_get_im_module_path ();
g_printf ("# ModulesPath = %s\n#\n", path);
dirs = pango_split_file_list (path);
+ dirs_done = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, NULL);
for (i=0; dirs[i]; i++)
- {
- GDir *dir = g_dir_open (dirs[i], 0, NULL);
- if (dir)
- {
- const char *dent;
-
- while ((dent = g_dir_read_name (dir)))
- {
- if (g_str_has_suffix (dent, SOEXT))
- error |= query_module (dirs[i], dent);
- }
-
- g_dir_close (dir);
- }
- }
+ if (!g_hash_table_lookup (dirs_done, dirs[i]))
+ {
+ GDir *dir = g_dir_open (dirs[i], 0, NULL);
+ if (dir)
+ {
+ const char *dent;
+
+ while ((dent = g_dir_read_name (dir)))
+ {
+ if (g_str_has_suffix (dent, SOEXT))
+ error |= query_module (dirs[i], dent);
+ }
+
+ g_dir_close (dir);
+ }
+
+ g_hash_table_insert (dirs_done, dirs[i], GUINT_TO_POINTER (TRUE));
+ }
+
+ g_hash_table_destroy (dirs_done);
}
else
{