Mercurial > emacs
comparison src/coding.c @ 103486:091a55d2d6f7
(Ffind_coding_systems_region_internal): Cache checked characters.
author | YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> |
---|---|
date | Fri, 19 Jun 2009 08:39:33 +0000 |
parents | 7ead50363544 |
children | e2d67c929da2 |
comparison
equal
deleted
inserted
replaced
103485:40b49259dd71 | 103486:091a55d2d6f7 |
---|---|
8638 { | 8638 { |
8639 Lisp_Object coding_attrs_list, safe_codings; | 8639 Lisp_Object coding_attrs_list, safe_codings; |
8640 EMACS_INT start_byte, end_byte; | 8640 EMACS_INT start_byte, end_byte; |
8641 const unsigned char *p, *pbeg, *pend; | 8641 const unsigned char *p, *pbeg, *pend; |
8642 int c; | 8642 int c; |
8643 Lisp_Object tail, elt; | 8643 Lisp_Object tail, elt, work_table; |
8644 | 8644 |
8645 if (STRINGP (start)) | 8645 if (STRINGP (start)) |
8646 { | 8646 { |
8647 if (!STRING_MULTIBYTE (start) | 8647 if (!STRING_MULTIBYTE (start) |
8648 || SCHARS (start) == SBYTES (start)) | 8648 || SCHARS (start) == SBYTES (start)) |
8696 pend = p + (end_byte - start_byte); | 8696 pend = p + (end_byte - start_byte); |
8697 | 8697 |
8698 while (p < pend && ASCII_BYTE_P (*p)) p++; | 8698 while (p < pend && ASCII_BYTE_P (*p)) p++; |
8699 while (p < pend && ASCII_BYTE_P (*(pend - 1))) pend--; | 8699 while (p < pend && ASCII_BYTE_P (*(pend - 1))) pend--; |
8700 | 8700 |
8701 work_table = Fmake_char_table (Qnil, Qnil); | |
8701 while (p < pend) | 8702 while (p < pend) |
8702 { | 8703 { |
8703 if (ASCII_BYTE_P (*p)) | 8704 if (ASCII_BYTE_P (*p)) |
8704 p++; | 8705 p++; |
8705 else | 8706 else |
8706 { | 8707 { |
8707 c = STRING_CHAR_ADVANCE (p); | 8708 c = STRING_CHAR_ADVANCE (p); |
8709 if (!NILP (char_table_ref (work_table, c))) | |
8710 /* This character was already checked. Ignore it. */ | |
8711 continue; | |
8708 | 8712 |
8709 charset_map_loaded = 0; | 8713 charset_map_loaded = 0; |
8710 for (tail = coding_attrs_list; CONSP (tail);) | 8714 for (tail = coding_attrs_list; CONSP (tail);) |
8711 { | 8715 { |
8712 elt = XCAR (tail); | 8716 elt = XCAR (tail); |
8734 else | 8738 else |
8735 pbeg = BYTE_POS_ADDR (start_byte); | 8739 pbeg = BYTE_POS_ADDR (start_byte); |
8736 p = pbeg + p_offset; | 8740 p = pbeg + p_offset; |
8737 pend = pbeg + pend_offset; | 8741 pend = pbeg + pend_offset; |
8738 } | 8742 } |
8743 char_table_set (work_table, c, Qt); | |
8739 } | 8744 } |
8740 } | 8745 } |
8741 | 8746 |
8742 safe_codings = list2 (Qraw_text, Qno_conversion); | 8747 safe_codings = list2 (Qraw_text, Qno_conversion); |
8743 for (tail = coding_attrs_list; CONSP (tail); tail = XCDR (tail)) | 8748 for (tail = coding_attrs_list; CONSP (tail); tail = XCDR (tail)) |