diff options
author | Kenichi Handa <handa@m17n.org> | 2008-08-29 07:53:11 +0000 |
---|---|---|
committer | Kenichi Handa <handa@m17n.org> | 2008-08-29 07:53:11 +0000 |
commit | c3b57f2354e9f7f4be46bda9e5111582d2aa324c (patch) | |
tree | 4f25e0ccffccac97bf13620d22f7fdd9a6a1de62 /src/chartab.c | |
parent | a48a6418e03785d021f169e1077a7bfde44d3542 (diff) | |
download | emacs-c3b57f2354e9f7f4be46bda9e5111582d2aa324c.tar.gz |
(optimize_sub_char_table): Perform more greedy optimization.
Diffstat (limited to 'src/chartab.c')
-rw-r--r-- | src/chartab.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/chartab.c b/src/chartab.c index 7e43aa4e315..fdce932993f 100644 --- a/src/chartab.c +++ b/src/chartab.c @@ -660,28 +660,27 @@ optimize_sub_char_table (table, test) struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table); int depth = XINT (tbl->depth); Lisp_Object elt, this; - int i; + int i, optimizable; elt = XSUB_CHAR_TABLE (table)->contents[0]; if (SUB_CHAR_TABLE_P (elt)) elt = XSUB_CHAR_TABLE (table)->contents[0] = optimize_sub_char_table (elt, test); - if (SUB_CHAR_TABLE_P (elt)) - return table; + optimizable = SUB_CHAR_TABLE_P (elt) ? 0 : 1; for (i = 1; i < chartab_size[depth]; i++) { this = XSUB_CHAR_TABLE (table)->contents[i]; if (SUB_CHAR_TABLE_P (this)) this = XSUB_CHAR_TABLE (table)->contents[i] = optimize_sub_char_table (this, test); - if (SUB_CHAR_TABLE_P (this) - || (NILP (test) ? NILP (Fequal (this, elt)) /* defaults to `equal'. */ + if (optimizable + && (NILP (test) ? NILP (Fequal (this, elt)) /* defaults to `equal'. */ : EQ (test, Qeq) ? !EQ (this, elt) /* Optimize `eq' case. */ : NILP (call2 (test, this, elt)))) - break; + optimizable = 0; } - return (i < chartab_size[depth] ? table : elt); + return (optimizable ? elt : table); } DEFUN ("optimize-char-table", Foptimize_char_table, Soptimize_char_table, |