[uim-commit] r697 - trunk/uim
ekato at freedesktop.org
ekato at freedesktop.org
Tue Feb 22 09:39:45 PST 2005
Author: ekato
Date: 2005-02-22 09:39:42 -0800 (Tue, 22 Feb 2005)
New Revision: 697
Modified:
trunk/uim/skk-dic.c
Log:
* uim/skk-dic.c : Fix slow personal dictionary parse.
(reverse_cache) : New function.
(parse_dic_line) : Don't use slow add_line_to_cache_last each
time.
(skk_read_personal_dictionary) : Reverse cache after parsing all
lines.
Modified: trunk/uim/skk-dic.c
===================================================================
--- trunk/uim/skk-dic.c 2005-02-22 12:39:37 UTC (rev 696)
+++ trunk/uim/skk-dic.c 2005-02-22 17:39:42 UTC (rev 697)
@@ -568,6 +568,7 @@
di->cache_modified = 1;
}
+#if 0
static void
add_line_to_cache_last(struct dic_info *di, struct skk_line *sl)
{
@@ -587,6 +588,7 @@
di->cache_len++;
di->cache_modified = 1;
}
+#endif
static struct skk_line *
skk_search_line_from_file(struct dic_info *di, const char *s, char okuri_head)
@@ -1671,6 +1673,22 @@
}
static void
+reverse_cache(struct dic_info *di)
+{
+ struct skk_line *sl, *prev, *next;
+
+ prev= NULL;
+ sl = di->head.next;
+ while (sl) {
+ next = sl->next;
+ sl->next = prev;
+ prev = sl;
+ sl = next;
+ }
+ di->head.next = prev;
+}
+
+static void
parse_dic_line(struct dic_info *di, char *line)
{
char *buf, *sep;
@@ -1700,7 +1718,7 @@
sl->cands[i].nr_real_cands = sl->cands[i].nr_cands;
}
/**/
- add_line_to_cache_last(di, sl);
+ add_line_to_cache_head(di, sl);
}
static void
@@ -1829,6 +1847,7 @@
}
fclose(fp);
close_lock(lock_fd);
+ reverse_cache(di);
return uim_scm_t();
}
More information about the Uim-commit
mailing list