comparison 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
comparison
equal deleted inserted replaced
5773:94a6b8fbd56e 5774:7a538e1a4676
2849 if (str->eof) 2849 if (str->eof)
2850 DECODE_OUTPUT_PARTIAL_CHAR (ch, dst); 2850 DECODE_OUTPUT_PARTIAL_CHAR (ch, dst);
2851 } 2851 }
2852 else 2852 else
2853 { 2853 {
2854 2854 const Ibyte *bend = (const Ibyte *)src + n;
2855 while (n--) 2855
2856 while (n > 0)
2856 { 2857 {
2857 c = *src++; 2858 if (byte_ascii_p (*src))
2858 if (byte_ascii_p (c))
2859 { 2859 {
2860 assert (ch == 0); 2860 const Ibyte *nonascii = skip_ascii ((Ibyte *)src, bend);
2861 Dynarr_add (dst, c); 2861
2862 Dynarr_add_many (dst, src, nonascii - src);
2863 n -= nonascii - src;
2864
2865 src = nonascii;
2866 if (n < 1)
2867 {
2868 break;
2869 }
2862 } 2870 }
2871
2872 n--, c = *src++;
2873
2863 #ifdef MULE 2874 #ifdef MULE
2864 else if (ibyte_leading_byte_p (c)) 2875 if (ibyte_leading_byte_p (c))
2865 { 2876 {
2866 assert (ch == 0); 2877 assert (ch == 0);
2867 if (c == LEADING_BYTE_LATIN_ISO8859_1 || 2878 if (c == LEADING_BYTE_LATIN_ISO8859_1 ||
2868 c == LEADING_BYTE_CONTROL_1) 2879 c == LEADING_BYTE_CONTROL_1)
2869 ch = c; 2880 ch = c;
2870 else 2881 else