diff options
author | axel <axel@liljencrantz.se> | 2005-10-12 20:34:21 +1000 |
---|---|---|
committer | axel <axel@liljencrantz.se> | 2005-10-12 20:34:21 +1000 |
commit | 4636b783a047dbaa5d75c09cfa22fd219924d12c (patch) | |
tree | 830a98e0e0a2d214d6b496a1149dff7627210dc0 /util.c | |
parent | b90e670d6fcf6b8a6e3dfef3776194be00f09f14 (diff) |
Do automatic line breaking in debug
darcs-hash:20051012103421-ac50b-d3cba7cb40287fd97cccc246a19dcb2273bf8b82.gz
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -872,6 +872,13 @@ void sb_append2( string_buffer_t *b, ... ) int sb_printf( string_buffer_t *buffer, const wchar_t *format, ... ) { va_list va; + va_start( va, format ); + sb_vprintf( buffer, format, va ); + va_end( va ); +} + +int sb_vprintf( string_buffer_t *buffer, const wchar_t *format, va_list va_orig ) +{ int res; if( !buffer->length ) @@ -885,13 +892,16 @@ int sb_printf( string_buffer_t *buffer, const wchar_t *format, ... ) while( 1 ) { + va_list va; + va_copy( va, va_orig ); - va_start( va, format ); res = vswprintf( (wchar_t *)((char *)buffer->buff+buffer->used), (buffer->length-buffer->used)/sizeof(wchar_t), format, va ); + + va_end( va ); if( res >= 0 ) { buffer->used+= res*sizeof(wchar_t); @@ -919,7 +929,6 @@ int sb_printf( string_buffer_t *buffer, const wchar_t *format, ... ) die_mem(); buffer->length *= 2; } - va_end( va ); return res; } |