emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/coding.c


From: Kenichi Handa
Subject: [Emacs-diffs] Changes to emacs/src/coding.c
Date: Sun, 06 Jun 2004 20:00:34 -0400

Index: emacs/src/coding.c
diff -c emacs/src/coding.c:1.302 emacs/src/coding.c:1.303
*** emacs/src/coding.c:1.302    Sun May 23 23:54:14 2004
--- emacs/src/coding.c  Sun Jun  6 23:59:19 2004
***************
*** 6570,6577 ****
      possible coding systems.  If it is nil, it means that we have not
      yet found any coding systems.
  
!     WORK_TABLE is a copy of the char-table Vchar_coding_system_table.  An
!     element of WORK_TABLE is set to t once the element is looked up.
  
      If a non-ASCII single byte char is found, set
      *single_byte_char_found to 1.  */
--- 6570,6577 ----
      possible coding systems.  If it is nil, it means that we have not
      yet found any coding systems.
  
!     WORK_TABLE a char-table of which element is set to t once the
!     element is looked up.
  
      If a non-ASCII single byte char is found, set
      *single_byte_char_found to 1.  */
***************
*** 6586,6591 ****
--- 6586,6593 ----
    Lisp_Object val, ch;
    Lisp_Object prev, tail;
  
+   if (NILP (safe_codings))
+     goto done_safe_codings;
    while (p < pend)
      {
        c = STRING_CHAR_AND_LENGTH (p, pend - p, len);
***************
*** 6595,6605 ****
        continue;
        if (SINGLE_BYTE_CHAR_P (c))
        *single_byte_char_found = 1;
-       if (NILP (safe_codings))
-       /* Already all coding systems are excluded.  But, we can't
-          terminate the loop here because non-ASCII single-byte char
-          must be found.  */
-       continue;
        /* Check the safe coding systems for C.  */
        ch = make_number (c);
        val = Faref (work_table, ch);
--- 6597,6602 ----
***************
*** 6677,6688 ****
            {
              /* Exclude this coding system from SAFE_CODINGS.  */
              if (EQ (tail, safe_codings))
!               safe_codings = XCDR (safe_codings);
              else
                XSETCDR (prev, XCDR (tail));
            }
        }
      }
    return safe_codings;
  }
  
--- 6674,6706 ----
            {
              /* Exclude this coding system from SAFE_CODINGS.  */
              if (EQ (tail, safe_codings))
!               {
!                 safe_codings = XCDR (safe_codings);
!                 if (NILP (safe_codings))
!                   goto done_safe_codings;
!               }
              else
                XSETCDR (prev, XCDR (tail));
            }
        }
      }
+ 
+  done_safe_codings:
+   /* If the above loop was terminated before P reaches PEND, it means
+      SAFE_CODINGS was set to nil.  If we have not yet found an
+      non-ASCII single-byte char, check it now.  */
+   if (! *single_byte_char_found)
+     while (p < pend)
+       {
+       c = STRING_CHAR_AND_LENGTH (p, pend - p, len);
+       p += len;
+       if (! ASCII_BYTE_P (c)
+           && SINGLE_BYTE_CHAR_P (c))
+         {
+           *single_byte_char_found = 1;
+           break;
+         }
+       }
    return safe_codings;
  }
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]