diff options
Diffstat (limited to 'src/coding.c')
| -rw-r--r-- | src/coding.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/coding.c b/src/coding.c index 1257771d3ed..58fc587570a 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -5646,8 +5646,11 @@ code_convert_region (from, from_byte, to, to_byte, coding, encodep, replace) | |||
| 5646 | coding_allocate_composition_data (coding, from); | 5646 | coding_allocate_composition_data (coding, from); |
| 5647 | } | 5647 | } |
| 5648 | 5648 | ||
| 5649 | /* Try to skip the heading and tailing ASCIIs. */ | 5649 | /* Try to skip the heading and tailing ASCIIs. We can't skip them |
| 5650 | if (coding->type != coding_type_ccl) | 5650 | if we must run CCL program or there are compositions to |
| 5651 | encode. */ | ||
| 5652 | if (coding->type != coding_type_ccl | ||
| 5653 | && (! coding->cmp_data || coding->cmp_data->used == 0)) | ||
| 5651 | { | 5654 | { |
| 5652 | int from_byte_orig = from_byte, to_byte_orig = to_byte; | 5655 | int from_byte_orig = from_byte, to_byte_orig = to_byte; |
| 5653 | 5656 | ||
| @@ -5663,6 +5666,7 @@ code_convert_region (from, from_byte, to, to_byte, coding, encodep, replace) | |||
| 5663 | if (!replace) | 5666 | if (!replace) |
| 5664 | /* We must record and adjust for this new text now. */ | 5667 | /* We must record and adjust for this new text now. */ |
| 5665 | adjust_after_insert (from, from_byte_orig, to, to_byte_orig, len); | 5668 | adjust_after_insert (from, from_byte_orig, to, to_byte_orig, len); |
| 5669 | coding_free_composition_data (coding); | ||
| 5666 | return 0; | 5670 | return 0; |
| 5667 | } | 5671 | } |
| 5668 | 5672 | ||
| @@ -6293,13 +6297,19 @@ encode_coding_string (str, coding, nocopy) | |||
| 6293 | if (coding->composing != COMPOSITION_DISABLED) | 6297 | if (coding->composing != COMPOSITION_DISABLED) |
| 6294 | coding_save_composition (coding, from, to, str); | 6298 | coding_save_composition (coding, from, to, str); |
| 6295 | 6299 | ||
| 6296 | /* Try to skip the heading and tailing ASCIIs. */ | 6300 | /* Try to skip the heading and tailing ASCIIs. We can't skip them |
| 6297 | if (coding->type != coding_type_ccl) | 6301 | if we must run CCL program or there are compositions to |
| 6302 | encode. */ | ||
| 6303 | if (coding->type != coding_type_ccl | ||
| 6304 | && (! coding->cmp_data || coding->cmp_data->used == 0)) | ||
| 6298 | { | 6305 | { |
| 6299 | SHRINK_CONVERSION_REGION (&from, &to_byte, coding, SDATA (str), | 6306 | SHRINK_CONVERSION_REGION (&from, &to_byte, coding, SDATA (str), |
| 6300 | 1); | 6307 | 1); |
| 6301 | if (from == to_byte) | 6308 | if (from == to_byte) |
| 6302 | return (nocopy ? str : Fcopy_sequence (str)); | 6309 | { |
| 6310 | coding_free_composition_data (coding); | ||
| 6311 | return (nocopy ? str : Fcopy_sequence (str)); | ||
| 6312 | } | ||
| 6303 | shrinked_bytes = from + (SBYTES (str) - to_byte); | 6313 | shrinked_bytes = from + (SBYTES (str) - to_byte); |
| 6304 | } | 6314 | } |
| 6305 | 6315 | ||