* coding.c (MAX_CHARBUF_SIZE): Renamed from CHARBUF_SIZE.
(MIN_CHARBUF_SIZE): New macro. (ALLOC_CONVERSION_WORK_AREA): New arg SIZE. Callers changed.
This commit is contained in:
parent
f036e167fe
commit
fda6144e04
2 changed files with 17 additions and 8 deletions
|
@ -1,3 +1,9 @@
|
|||
2014-06-28 K. Handa <handa@gnu.org>
|
||||
|
||||
* coding.c (MAX_CHARBUF_SIZE): Renamed from CHARBUF_SIZE.
|
||||
(MIN_CHARBUF_SIZE): New macro.
|
||||
(ALLOC_CONVERSION_WORK_AREA): New arg SIZE. Callers changed.
|
||||
|
||||
2014-06-27 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* Makefile.in: Replace BOOTSTRAPEMACS sleight-of-hand
|
||||
|
|
19
src/coding.c
19
src/coding.c
|
@ -7265,13 +7265,16 @@ produce_charset (struct coding_system *coding, int *charbuf, ptrdiff_t pos)
|
|||
coding->dst_object);
|
||||
}
|
||||
|
||||
#define MAX_CHARBUF_SIZE 0x4000
|
||||
#define MIN_CHARBUF_SIZE 0x10
|
||||
|
||||
#define CHARBUF_SIZE 0x4000
|
||||
|
||||
#define ALLOC_CONVERSION_WORK_AREA(coding) \
|
||||
do { \
|
||||
coding->charbuf = SAFE_ALLOCA (CHARBUF_SIZE * sizeof (int)); \
|
||||
coding->charbuf_size = CHARBUF_SIZE; \
|
||||
#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); \
|
||||
coding->charbuf = SAFE_ALLOCA ((units) * sizeof (int)); \
|
||||
coding->charbuf_size = (units); \
|
||||
} while (0)
|
||||
|
||||
|
||||
|
@ -7373,7 +7376,7 @@ decode_coding (struct coding_system *coding)
|
|||
record_conversion_result (coding, CODING_RESULT_SUCCESS);
|
||||
coding->errors = 0;
|
||||
|
||||
ALLOC_CONVERSION_WORK_AREA (coding);
|
||||
ALLOC_CONVERSION_WORK_AREA (coding, coding->src_bytes);
|
||||
|
||||
attrs = CODING_ID_ATTRS (coding->id);
|
||||
translation_table = get_translation_table (attrs, 0, NULL);
|
||||
|
@ -7769,7 +7772,7 @@ encode_coding (struct coding_system *coding)
|
|||
record_conversion_result (coding, CODING_RESULT_SUCCESS);
|
||||
coding->errors = 0;
|
||||
|
||||
ALLOC_CONVERSION_WORK_AREA (coding);
|
||||
ALLOC_CONVERSION_WORK_AREA (coding, coding->src_chars);
|
||||
|
||||
if (coding->encoder == encode_coding_ccl)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue