]> git.eshelyaron.com Git - emacs.git/commitdiff
* coding.c (MIN_CHARBUF_SIZE): Delete it.
authorKenichi Handa <handa@gnu.org>
Tue, 1 Jul 2014 15:31:59 +0000 (00:31 +0900)
committerKenichi Handa <handa@gnu.org>
Tue, 1 Jul 2014 15:31:59 +0000 (00:31 +0900)
(MAX_CHARBUF_EXTRA_SIZE): New macro.
(ALLOC_CONVERSION_WORK_AREA): Use MAX_CHARBUF_EXTRA_SIZE.

src/ChangeLog
src/coding.c

index 2f611365fcd483d17fbfea802e96c8510673e4cb..ec9c0ce42fdfcd9735d2f0096403953d3b969e9d 100644 (file)
@@ -1,3 +1,9 @@
+2014-07-01  K. Handa  <handa@gnu.org>
+
+       * coding.c (MIN_CHARBUF_SIZE): Delete it.
+       (MAX_CHARBUF_EXTRA_SIZE): New macro.
+       (ALLOC_CONVERSION_WORK_AREA): Use MAX_CHARBUF_EXTRA_SIZE.
+
 2014-06-28  K. Handa  <handa@gnu.org>
 
        * coding.c (MAX_CHARBUF_SIZE): Renamed from CHARBUF_SIZE.
index 64bad7ccbe859849a369c9ddf713d3d38c419e4e..e68700c099d65150f1b78ea70af2c0617b719197 100644 (file)
@@ -7266,13 +7266,17 @@ produce_charset (struct coding_system *coding, int *charbuf, ptrdiff_t pos)
 }
 
 #define MAX_CHARBUF_SIZE 0x4000
-#define MIN_CHARBUF_SIZE 0x10
+/* How many units decoding functions expect in coding->charbuf at
+   most.  Currently, decode_coding_emacs_mule expects the following
+   size, and that is the largest value.  */
+#define MAX_CHARBUF_EXTRA_SIZE ((MAX_ANNOTATION_LENGTH * 3) + 1)
 
 #define ALLOC_CONVERSION_WORK_AREA(coding, size)               \
   do {                                                         \
-    int units = ((size) > MAX_CHARBUF_SIZE ? MAX_CHARBUF_SIZE  \
-                : (size) < MIN_CHARBUF_SIZE ? MIN_CHARBUF_SIZE \
-                : size);                                       \
+    int units = (size) + MAX_CHARBUF_EXTRA_SIZE;               \
+                                                               \
+    if (units > MAX_CHARBUF_SIZE)                              \
+      units = MAX_CHARBUF_SIZE;                                        \
     coding->charbuf = SAFE_ALLOCA ((units) * sizeof (int));    \
     coding->charbuf_size = (units);                            \
   } while (0)