From: tomo Date: Sun, 29 Aug 2004 17:58:55 +0000 (+0000) Subject: (simplify_char_spec): Don't allocate new character-object if specified X-Git-Tag: r21-4-15-chise-0_21-31^2~9 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=af8078da4052c269225881fbc5325725edf2ced0;p=chise%2Fxemacs-chise.git (simplify_char_spec): Don't allocate new character-object if specified char_spec does not have any CCS-features. --- diff --git a/src/fns.c b/src/fns.c index 29ef8fa..2455d35 100644 --- a/src/fns.c +++ b/src/fns.c @@ -3837,7 +3837,36 @@ simplify_char_spec (Lisp_Object char_spec) #if 0 Lisp_Object ret = Ffind_char (char_spec); #else - Lisp_Object ret = Fdefine_char (char_spec); + Lisp_Object ret; + Lisp_Object rest = char_spec; + int have_ccs = 0; + + while (CONSP (rest)) + { + Lisp_Object cell = Fcar (rest); + Lisp_Object ccs; + +#if 0 + if (!LISTP (cell)) + signal_simple_error ("Invalid argument", char_spec); +#endif + if (!NILP (ccs = Ffind_charset (Fcar (cell)))) + { + cell = Fcdr (cell); + if (CONSP (cell)) + ret = Fmake_char (ccs, Fcar (cell), Fcar (Fcdr (cell))); + else + ret = Fdecode_char (ccs, cell, Qt, Qt); + have_ccs = 1; + if (CHARP (ret)) + return ret; + } + rest = Fcdr (rest); + } + if (have_ccs) + ret = Fdefine_char (char_spec); + else + ret = Qnil; #endif if (CHARP (ret))