emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r117506: * coding.h (struct coding_system): Remove '


From: Dmitry Antipov
Subject: [Emacs-diffs] trunk r117506: * coding.h (struct coding_system): Remove 'error_positions' (unused)
Date: Thu, 10 Jul 2014 04:38:48 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117506
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Thu 2014-07-10 08:35:55 +0400
message:
  * coding.h (struct coding_system): Remove 'error_positions' (unused)
  and 'errors' (set but unused) fields.  Use bitfields for 'eol_seen',
  'mode', 'common_flags' and 'result' fields, adjust layout to avoid
  extra padding and shrink struct coding_system by 56 bytes (x86_64).
  * coding.c (decode_coding_utf_8, decode_coding_utf_16)
  (decode_coding_emacs_mule, decode_coding_iso_2022, decode_coding_sjis)
  (decode_coding_big5, decode_coding_charset, decode_coding)
  (encode_coding): Adjust users.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/coding.c                   coding.c-20091113204419-o5vbwnq5f7feedwu-1077
  src/coding.h                   coding.h-20091113204419-o5vbwnq5f7feedwu-1078
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-07-09 23:39:58 +0000
+++ b/src/ChangeLog     2014-07-10 04:35:55 +0000
@@ -1,3 +1,14 @@
+2014-07-10  Dmitry Antipov  <address@hidden>
+
+       * coding.h (struct coding_system): Remove 'error_positions' (unused)
+       and 'errors' (set but unused) fields.  Use bitfields for 'eol_seen',
+       'mode', 'common_flags' and 'result' fields, adjust layout to avoid
+       extra padding and shrink struct coding_system by 56 bytes (x86_64).
+       * coding.c (decode_coding_utf_8, decode_coding_utf_16)
+       (decode_coding_emacs_mule, decode_coding_iso_2022, decode_coding_sjis)
+       (decode_coding_big5, decode_coding_charset, decode_coding)
+       (encode_coding): Adjust users.
+
 2014-07-09  Paul Eggert  <address@hidden>
 
        * syntax.c (back_comment): Use more-natural location for label.

=== modified file 'src/coding.c'
--- a/src/coding.c      2014-07-09 10:36:35 +0000
+++ b/src/coding.c      2014-07-10 04:35:55 +0000
@@ -1486,7 +1486,6 @@
       consumed_chars = consumed_chars_base;
       ONE_MORE_BYTE (c);
       *charbuf++ = ASCII_CHAR_P (c) ? c : BYTE8_TO_CHAR (c);
-      coding->errors++;
     }
 
  no_more_source:
@@ -1685,7 +1684,6 @@
          /* The first two bytes are not BOM.  Treat them as bytes
             for a normal character.  */
          src = src_base;
-         coding->errors++;
        }
       CODING_UTF_16_BOM (coding) = utf_without_bom;
     }
@@ -1742,7 +1740,6 @@
                c1 = surrogate & 0xFF, c2 = surrogate >> 8;
              *charbuf++ = c1;
              *charbuf++ = c2;
-             coding->errors++;
              if (UTF_16_HIGH_SURROGATE_P (c))
                CODING_UTF_16_SURROGATE (coding) = surrogate = c;
              else
@@ -2598,7 +2595,6 @@
       ONE_MORE_BYTE (c);
       *charbuf++ = ASCII_CHAR_P (c) ? c : BYTE8_TO_CHAR (c);
       char_offset++;
-      coding->errors++;
     }
 
  no_more_source:
@@ -4006,7 +4002,6 @@
       ONE_MORE_BYTE (c);
       *charbuf++ = c < 0 ? -c : ASCII_CHAR_P (c) ? c : BYTE8_TO_CHAR (c);
       char_offset++;
-      coding->errors++;
       /* Reset the invocation and designation status to the safest
         one; i.e. designate ASCII to the graphic register 0, and
         invoke that register to the graphic plane 0.  This typically
@@ -4837,7 +4832,6 @@
       ONE_MORE_BYTE (c);
       *charbuf++ = c < 0 ? -c : BYTE8_TO_CHAR (c);
       char_offset++;
-      coding->errors++;
     }
 
  no_more_source:
@@ -4933,7 +4927,6 @@
       ONE_MORE_BYTE (c);
       *charbuf++ = c < 0 ? -c : BYTE8_TO_CHAR (c);
       char_offset++;
-      coding->errors++;
     }
 
  no_more_source:
@@ -5642,7 +5635,6 @@
       ONE_MORE_BYTE (c);
       *charbuf++ = c < 0 ? -c : ASCII_CHAR_P (c) ? c : BYTE8_TO_CHAR (c);
       char_offset++;
-      coding->errors++;
     }
 
  no_more_source:
@@ -7375,7 +7367,6 @@
   coding->produced = coding->produced_char = 0;
   coding->chars_at_source = 0;
   record_conversion_result (coding, CODING_RESULT_SUCCESS);
-  coding->errors = 0;
 
   ALLOC_CONVERSION_WORK_AREA (coding, coding->src_bytes);
 
@@ -7771,7 +7762,6 @@
   coding->consumed = coding->consumed_char = 0;
   coding->produced = coding->produced_char = 0;
   record_conversion_result (coding, CODING_RESULT_SUCCESS);
-  coding->errors = 0;
 
   ALLOC_CONVERSION_WORK_AREA (coding, coding->src_chars);
 

=== modified file 'src/coding.h'
--- a/src/coding.h      2014-04-05 19:30:36 +0000
+++ b/src/coding.h      2014-07-10 04:35:55 +0000
@@ -434,11 +434,37 @@
 
   /* Flag bits of the coding system.  The meaning of each bit is common
      to all types of coding systems.  */
-  int common_flags;
+  unsigned common_flags : 14;
 
   /* Mode bits of the coding system.  See the comments of the macros
      CODING_MODE_XXX.  */
-  unsigned int mode;
+  unsigned mode : 5;
+
+  /* The following two members specify how binary 8-bit code 128..255
+     are represented in source and destination text respectively.  True
+     means they are represented by 2-byte sequence, false means they are
+     represented by 1-byte as is (see the comment in character.h).  */
+  bool_bf src_multibyte : 1;
+  bool_bf dst_multibyte : 1;
+
+  /* True if the source of conversion is not in the member
+     `charbuf', but at `src_object'.  */
+  bool_bf chars_at_source : 1;
+
+  /* Nonzero if the result of conversion is in `destination'
+     buffer rather than in `dst_object'.  */
+  bool_bf raw_destination : 1;
+
+  /* Set to true if charbuf contains an annotation.  */
+  bool_bf annotated : 1;
+
+  /* Used internally in coding.c.  See the comment of detect_ascii.  */
+  unsigned eol_seen : 3;
+
+  /* Finish status of code conversion.  */
+  ENUM_BF (coding_result_code) result : 3;
+
+  int max_charset_id;
 
   /* Detailed information specific to each type of coding system.  */
   union
@@ -451,16 +477,8 @@
       struct undecided_spec undecided;
     } spec;
 
-  int max_charset_id;
   unsigned char *safe_charsets;
 
-  /* The following two members specify how binary 8-bit code 128..255
-     are represented in source and destination text respectively.  True
-     means they are represented by 2-byte sequence, false means they are
-     represented by 1-byte as is (see the comment in character.h).  */
-  bool_bf src_multibyte : 1;
-  bool_bf dst_multibyte : 1;
-
   /* How may heading bytes we can skip for decoding.  This is set to
      -1 in setup_coding_system, and updated by detect_coding.  So,
      when this is equal to the byte length of the text being
@@ -472,21 +490,9 @@
      sequence.  Set by detect_coding_utf_8.  */
   ptrdiff_t detected_utf8_bytes, detected_utf8_chars;
 
-  /* Used internally in coding.c.  See the comment of detect_ascii.  */
-  int eol_seen;
-
   /* The following members are set by encoding/decoding routine.  */
   ptrdiff_t produced, produced_char, consumed, consumed_char;
 
-  /* Number of error source data found in a decoding routine.  */
-  ptrdiff_t errors;
-
-  /* Store the positions of error source data.  */
-  ptrdiff_t *error_positions;
-
-  /* Finish status of code conversion.  */
-  enum coding_result_code result;
-
   ptrdiff_t src_pos, src_pos_byte, src_chars, src_bytes;
   Lisp_Object src_object;
   const unsigned char *source;
@@ -510,17 +516,6 @@
   int *charbuf;
   int charbuf_size, charbuf_used;
 
-  /* True if the source of conversion is not in the member
-     `charbuf', but at `src_object'.  */
-  bool_bf chars_at_source : 1;
-
-  /* Nonzero if the result of conversion is in `destination'
-     buffer rather than in `dst_object'.  */
-  bool_bf raw_destination : 1;
-
-  /* Set to true if charbuf contains an annotation.  */
-  bool_bf annotated : 1;
-
   unsigned char carryover[64];
   int carryover_bytes;
 


reply via email to

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