diff options
author | Kenichi Handa <handa@m17n.org> | 2004-03-11 08:46:07 +0000 |
---|---|---|
committer | Kenichi Handa <handa@m17n.org> | 2004-03-11 08:46:07 +0000 |
commit | 2170c8f05b193ad12a61022f919f6cb56758e179 (patch) | |
tree | 9425f3b2fcef2009719282ed2dc41a098187497c /src | |
parent | 3e0a79b7445d3ffaabdc0fbdf4ddf85117f918d5 (diff) | |
download | emacs-2170c8f05b193ad12a61022f919f6cb56758e179.tar.gz |
(get_translation_table): Allow max_lookup to be NULL.
(decode_coding): Call get_translation_table with max_lookup NULL.
(Ffind_coding_systems_region_internal): Likewise.
(Funencodable_char_position, Fcheck_coding_systems_region):
Likewise.
Diffstat (limited to 'src')
-rw-r--r-- | src/coding.c | 50 |
1 files changed, 27 insertions, 23 deletions
diff --git a/src/coding.c b/src/coding.c index 2c12e6b0b5a..5b6955e77ce 100644 --- a/src/coding.c +++ b/src/coding.c @@ -5544,26 +5544,30 @@ get_translation_table (attrs, encodep, max_lookup) Fcons (standard, Qnil)); } } - *max_lookup = 1; - if (CHAR_TABLE_P (translation_table) - && CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (translation_table)) > 1) - { - val = XCHAR_TABLE (translation_table)->extras[1]; - if (NATNUMP (val) && *max_lookup < XFASTINT (val)) - *max_lookup = XFASTINT (val); - } - else if (CONSP (translation_table)) + + if (max_lookup) { - Lisp_Object tail, val; + *max_lookup = 1; + if (CHAR_TABLE_P (translation_table) + && CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (translation_table)) > 1) + { + val = XCHAR_TABLE (translation_table)->extras[1]; + if (NATNUMP (val) && *max_lookup < XFASTINT (val)) + *max_lookup = XFASTINT (val); + } + else if (CONSP (translation_table)) + { + Lisp_Object tail, val; - for (tail = translation_table; CONSP (tail); tail = XCDR (tail)) - if (CHAR_TABLE_P (XCAR (tail)) - && CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (XCAR (tail))) > 1) - { - val = XCHAR_TABLE (XCAR (tail))->extras[1]; - if (NATNUMP (val) && *max_lookup < XFASTINT (val)) - *max_lookup = XFASTINT (val); - } + for (tail = translation_table; CONSP (tail); tail = XCDR (tail)) + if (CHAR_TABLE_P (XCAR (tail)) + && CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (XCAR (tail))) > 1) + { + val = XCHAR_TABLE (XCAR (tail))->extras[1]; + if (NATNUMP (val) && *max_lookup < XFASTINT (val)) + *max_lookup = XFASTINT (val); + } + } } return translation_table; } @@ -6002,7 +6006,6 @@ decode_coding (coding) Lisp_Object undo_list; Lisp_Object translation_table; int carryover; - int max_lookup; int i; if (BUFFERP (coding->src_object) @@ -6031,7 +6034,7 @@ decode_coding (coding) ALLOC_CONVERSION_WORK_AREA (coding); attrs = CODING_ID_ATTRS (coding->id); - translation_table = get_translation_table (attrs, 0, &max_lookup); + translation_table = get_translation_table (attrs, 0, NULL); carryover = 0; do @@ -7354,7 +7357,7 @@ DEFUN ("find-coding-systems-region-internal", && ! EQ (CODING_ATTR_TYPE (attrs), Qundecided)) { ASET (attrs, coding_attr_trans_tbl, - get_translation_table (attrs, 1)); + get_translation_table (attrs, 1, NULL)); coding_attrs_list = Fcons (attrs, coding_attrs_list); } } @@ -7449,7 +7452,7 @@ to the string. */) return Qnil; ascii_compatible = ! NILP (CODING_ATTR_ASCII_COMPAT (attrs)); charset_list = CODING_ATTR_CHARSET_LIST (attrs); - translation_table = get_translation_table (attrs, 1); + translation_table = get_translation_table (attrs, 1, NULL); if (NILP (string)) { @@ -7592,7 +7595,8 @@ buffer positions. END is ignored. */) { elt = XCAR (tail); attrs = AREF (CODING_SYSTEM_SPEC (elt), 0); - ASET (attrs, coding_attr_trans_tbl, get_translation_table (attrs, 1)); + ASET (attrs, coding_attr_trans_tbl, + get_translation_table (attrs, 1, NULL)); list = Fcons (Fcons (elt, Fcons (attrs, Qnil)), list); } |