diff packages/language/c/libc/stdio/current/src/common/stream.cxx @ 2356:52c6a8ead2a6

Speed-up [v]s[n]printf() functions by a factor of about 2+. In particular, sprintf(s, "%s", "") becomes faster 2.8 times, printing of every character -- 1.7 times, and, as a result, e.g., printing of a string of length 50 -- 2.2 times. * include/stream.hxx (class Cyg_OutputStream): New ABC. (class Cyg_StdioStream): inherit from Cyg_OutputStream; make the destructor, write(), and get_error() virtual. * src/output/vfnprintf.cxx (vfnprintf): Use ABC Cyg_OutputStream instead of Cyg_StdioStream. * src/common/vsnprintf.cxx (class Cyg_VsnprintfStream): New class that specializes Cyg_OutputStream for output to a string. (vsnprintf): Use Cyg_VsnprintfStream for printing to a string.
author asl
date Sat, 27 Jan 2007 13:53:37 +0000
parents 543067294b88
children 74dbf4c3f2e1
line wrap: on
line diff
--- a/packages/language/c/libc/stdio/current/src/common/stream.cxx
+++ b/packages/language/c/libc/stdio/current/src/common/stream.cxx
@@ -720,4 +720,25 @@ Cyg_StdioStream::write( const cyg_uint8 
     return write_err;
 } // write()
 
+//
+// class Cyg_OutputStream
+//
+
+Cyg_ErrNo
+Cyg_OutputStream::write( const cyg_uint8 *buffer, cyg_ucount32 buffer_length,
+    cyg_ucount32 *bytes_written )
+{
+    CYG_FAIL("Cyg_OutputStream::write(): pure virtual called");
+    return ENOSYS;
+}
+
+Cyg_ErrNo
+Cyg_OutputStream::get_error( void )
+{
+    CYG_FAIL("Cyg_OutputStream::get_error(): pure virtual called");
+    return ENOSYS;
+}
+
+
+
 // EOF stream.cxx