# HG changeset patch # User Kenichi Handa # Date 857040319 0 # Node ID f03002ec34048247369ee2fb4f55b8924ee9dca0 # Parent 321ebfc346eb92b721257bbdc595dc7030220e3b (Faref, Faset): Handle a composite char correctly in char-table. diff -r 321ebfc346eb -r f03002ec3404 src/data.c --- a/src/data.c Thu Feb 27 10:44:19 1997 +0000 +++ b/src/data.c Thu Feb 27 10:45:19 1997 +0000 @@ -1567,8 +1567,8 @@ } else { - int idx[4]; /* For charset, code1, code2, and anchor. */ - int i; + int idx[3]; /* For charset, code1, and code2. */ + int i, len; Lisp_Object sub_array; /* There's no reason to treat a composite character @@ -1580,11 +1580,11 @@ idxval = cmpchar_component (idxval, 0); #endif SPLIT_NON_ASCII_CHAR (idxval, idx[0], idx[1], idx[2]); - idx[3] = 0; + len = (COMPOSITE_CHAR_P (idxval) || idx[2]) ? 3 : (idx[1] ? 2 : 1); try_parent_char_table: sub_array = array; - for (i = 0; idx[i]; i++) + for (i = 0; i < len; i++) { val = XCHAR_TABLE (sub_array)->contents[idx[i]]; if (NILP (val)) @@ -1677,14 +1677,14 @@ XCHAR_TABLE (array)->contents[idxval] = newelt; else { - int idx[4]; /* For charset, code1, code2, and anchor. */ - int i; + int idx[3]; /* For charset, code1, and code2. */ + int i, len; Lisp_Object val; SPLIT_NON_ASCII_CHAR (idxval, idx[0], idx[1], idx[2]); - idx[3] = 0; + len = (COMPOSITE_CHAR_P (idxval) || idx[2]) ? 2 : (idx[1] ? 1 : 0); - for (i = 0; idx[i + 1]; i++) + for (i = 0; i < len; i++) { val = XCHAR_TABLE (array)->contents[idx[i]]; if (CHAR_TABLE_P (val))