diff options
| author | Kenichi Handa | 2008-08-29 07:53:11 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2008-08-29 07:53:11 +0000 |
| commit | c3b57f2354e9f7f4be46bda9e5111582d2aa324c (patch) | |
| tree | 4f25e0ccffccac97bf13620d22f7fdd9a6a1de62 /src/chartab.c | |
| parent | a48a6418e03785d021f169e1077a7bfde44d3542 (diff) | |
| download | emacs-c3b57f2354e9f7f4be46bda9e5111582d2aa324c.tar.gz emacs-c3b57f2354e9f7f4be46bda9e5111582d2aa324c.zip | |
(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) | |||
| 660 | struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table); | 660 | struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table); |
| 661 | int depth = XINT (tbl->depth); | 661 | int depth = XINT (tbl->depth); |
| 662 | Lisp_Object elt, this; | 662 | Lisp_Object elt, this; |
| 663 | int i; | 663 | int i, optimizable; |
| 664 | 664 | ||
| 665 | elt = XSUB_CHAR_TABLE (table)->contents[0]; | 665 | elt = XSUB_CHAR_TABLE (table)->contents[0]; |
| 666 | if (SUB_CHAR_TABLE_P (elt)) | 666 | if (SUB_CHAR_TABLE_P (elt)) |
| 667 | elt = XSUB_CHAR_TABLE (table)->contents[0] | 667 | elt = XSUB_CHAR_TABLE (table)->contents[0] |
| 668 | = optimize_sub_char_table (elt, test); | 668 | = optimize_sub_char_table (elt, test); |
| 669 | if (SUB_CHAR_TABLE_P (elt)) | 669 | optimizable = SUB_CHAR_TABLE_P (elt) ? 0 : 1; |
| 670 | return table; | ||
| 671 | for (i = 1; i < chartab_size[depth]; i++) | 670 | for (i = 1; i < chartab_size[depth]; i++) |
| 672 | { | 671 | { |
| 673 | this = XSUB_CHAR_TABLE (table)->contents[i]; | 672 | this = XSUB_CHAR_TABLE (table)->contents[i]; |
| 674 | if (SUB_CHAR_TABLE_P (this)) | 673 | if (SUB_CHAR_TABLE_P (this)) |
| 675 | this = XSUB_CHAR_TABLE (table)->contents[i] | 674 | this = XSUB_CHAR_TABLE (table)->contents[i] |
| 676 | = optimize_sub_char_table (this, test); | 675 | = optimize_sub_char_table (this, test); |
| 677 | if (SUB_CHAR_TABLE_P (this) | 676 | if (optimizable |
| 678 | || (NILP (test) ? NILP (Fequal (this, elt)) /* defaults to `equal'. */ | 677 | && (NILP (test) ? NILP (Fequal (this, elt)) /* defaults to `equal'. */ |
| 679 | : EQ (test, Qeq) ? !EQ (this, elt) /* Optimize `eq' case. */ | 678 | : EQ (test, Qeq) ? !EQ (this, elt) /* Optimize `eq' case. */ |
| 680 | : NILP (call2 (test, this, elt)))) | 679 | : NILP (call2 (test, this, elt)))) |
| 681 | break; | 680 | optimizable = 0; |
| 682 | } | 681 | } |
| 683 | 682 | ||
| 684 | return (i < chartab_size[depth] ? table : elt); | 683 | return (optimizable ? elt : table); |
| 685 | } | 684 | } |
| 686 | 685 | ||
| 687 | DEFUN ("optimize-char-table", Foptimize_char_table, Soptimize_char_table, | 686 | DEFUN ("optimize-char-table", Foptimize_char_table, Soptimize_char_table, |