aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYAMAMOTO Mitsuharu <[email protected]>2009-06-19 08:39:44 +0000
committerYAMAMOTO Mitsuharu <[email protected]>2009-06-19 08:39:44 +0000
commit0e727afa9d1ecb76c8faa96bbfe264aaf4856ffa (patch)
treeedae48e2baf2b93efed13834ee5b95cc2b536e77
parent00b9254ce3afe5d8f4a2f5f8e5de138c9a150e89 (diff)
(Ffind_coding_systems_region_internal): Cache checked characters.
-rw-r--r--src/ChangeLog5
-rw-r--r--src/coding.c7
2 files changed, 11 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index d1e80ab238..b5bfa511fe 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2009-06-19 YAMAMOTO Mitsuharu <[email protected]>
+
+ * coding.c (Ffind_coding_systems_region_internal):
+ Cache checked characters.
+
2009-06-18 Kenichi Handa <[email protected]>
* coding.c (decode_coding_iso_2022): Check MSB of bytes more
diff --git a/src/coding.c b/src/coding.c
index e2a328fd90..3fc43df636 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -8640,7 +8640,7 @@ DEFUN ("find-coding-systems-region-internal",
EMACS_INT start_byte, end_byte;
const unsigned char *p, *pbeg, *pend;
int c;
- Lisp_Object tail, elt;
+ Lisp_Object tail, elt, work_table;
if (STRINGP (start))
{
@@ -8698,6 +8698,7 @@ DEFUN ("find-coding-systems-region-internal",
while (p < pend && ASCII_BYTE_P (*p)) p++;
while (p < pend && ASCII_BYTE_P (*(pend - 1))) pend--;
+ work_table = Fmake_char_table (Qnil, Qnil);
while (p < pend)
{
if (ASCII_BYTE_P (*p))
@@ -8705,6 +8706,9 @@ DEFUN ("find-coding-systems-region-internal",
else
{
c = STRING_CHAR_ADVANCE (p);
+ if (!NILP (char_table_ref (work_table, c)))
+ /* This character was already checked. Ignore it. */
+ continue;
charset_map_loaded = 0;
for (tail = coding_attrs_list; CONSP (tail);)
@@ -8736,6 +8740,7 @@ DEFUN ("find-coding-systems-region-internal",
p = pbeg + p_offset;
pend = pbeg + pend_offset;
}
+ char_table_set (work_table, c, Qt);
}
}