From: Kenichi Handa Date: Tue, 20 Aug 2002 11:23:38 +0000 (+0000) Subject: (set_canon, set_identity, shuffle): Simplified. X-Git-Tag: emacs-pretest-23.0.90~8295^2~1864^2~408 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=405b0b5ad1109e65b080ba0a5c4bc109d902070b;p=emacs.git (set_canon, set_identity, shuffle): Simplified. --- diff --git a/src/casetab.c b/src/casetab.c index 1660b57241b..6abb1e2b096 100644 --- a/src/casetab.c +++ b/src/casetab.c @@ -185,6 +185,20 @@ set_canon (case_table, range, elt) Lisp_Object canon = XCHAR_TABLE (case_table)->extras[1]; int from, to; + if (NATNUMP (elt)) + Fset_char_table_range (canon, range, Faref (case_table, Faref (up, elt))); +} + +/* Set elements of char-table TABLE for characters in RANGE to + themselves. This is done only when ELT is a character. This is + called in map_char_table. */ + +static void +set_identity (table, range, elt) + Lisp_Object table, range, elt; +{ + int from, to; + if (NATNUMP (elt)) { if (CONSP (range)) @@ -196,36 +210,10 @@ set_canon (case_table, range, elt) from = to = XINT (range); for (; from <= to; from++) - { - Lisp_Object val1, val2; - - val1 = Faref (up, elt); - if (EQ (val1, Qt)) - val1 = elt; - else if (! NATNUMP (val1)) - continue; - val2 = Faref (case_table, val1); - if (EQ (val2, Qt)) - val2 = val1; - else if (! NATNUMP (val2)) - continue; - Faset (canon, make_number (from), val2); - } + CHAR_TABLE_SET (table, from, make_number (from)); } } -/* Set elements of char-table TABLE for characters in RANGE to - themselves. This is done only when ELT is a character. This is - called in map_char_table. */ - -static void -set_identity (table, range, elt) - Lisp_Object table, range, elt; -{ - if (EQ (elt, Qt) || NATNUMP (elt)) - Fset_char_table_range (table, range, Qt); -} - /* Permute the elements of TABLE (which is initially an identity mapping) so that it has one cycle for each equivalence class induced by the translation table on which map_char_table is @@ -239,7 +227,7 @@ shuffle (table, range, elt) if (NATNUMP (elt)) { - Lisp_Object tem; + Lisp_Object tem = Faref (table, elt); if (CONSP (range)) { @@ -252,9 +240,6 @@ shuffle (table, range, elt) for (; from <= to; from++) if (from != XINT (elt)) { - tem = Faref (table, elt); - if (EQ (tem, Qt)) - tem = elt; Faset (table, elt, make_number (from)); Faset (table, make_number (from), tem); }