Mercurial > hg > xemacs-beta
diff src/file-coding.c @ 5774:7a538e1a4676
Use skip_ascii() in no_conversion_convert() when encoding.
src/ChangeLog addition:
2013-12-19 Aidan Kehoe <kehoea@parhasard.net>
* text.c:
* text.h:
* text.h (skip_ascii):
Move skip_ascii (), the very fast inline function from the
bytecount-to-charcount code, to text.h, to allow the coding
systems to use it too as needed.
* file-coding.c (no_conversion_convert):
Use skip_ascii() as appropriate here, halving the time taken to
write large files in my tests (again, relevant to VM buffers, but
not a panacea to our issues with them.)
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Thu, 19 Dec 2013 18:13:11 +0000 |
parents | dae33b5feffe |
children | 65d65b52d608 |
line wrap: on
line diff
--- a/src/file-coding.c Tue Dec 17 20:49:52 2013 +0200 +++ b/src/file-coding.c Thu Dec 19 18:13:11 2013 +0000 @@ -2851,18 +2851,29 @@ } else { - - while (n--) + const Ibyte *bend = (const Ibyte *)src + n; + + while (n > 0) { - c = *src++; - if (byte_ascii_p (c)) + if (byte_ascii_p (*src)) { - assert (ch == 0); - Dynarr_add (dst, c); + const Ibyte *nonascii = skip_ascii ((Ibyte *)src, bend); + + Dynarr_add_many (dst, src, nonascii - src); + n -= nonascii - src; + + src = nonascii; + if (n < 1) + { + break; + } } + + n--, c = *src++; + #ifdef MULE - else if (ibyte_leading_byte_p (c)) - { + if (ibyte_leading_byte_p (c)) + { assert (ch == 0); if (c == LEADING_BYTE_LATIN_ISO8859_1 || c == LEADING_BYTE_CONTROL_1)