diff options
author | Luca Barbieri <[email protected]> | 2010-08-20 11:31:24 +0200 |
---|---|---|
committer | Luca Barbieri <[email protected]> | 2010-08-20 18:18:28 +0200 |
commit | b1fa352db8a69883f97dd579d892291f414a67f5 (patch) | |
tree | 1ed8c14cb941a867ace2912f9c780c488de2d54d /src/gallium/auxiliary/os/os_stream.h | |
parent | 40eef4c20cc0b4500a0d8c8538872ed4b473d737 (diff) |
os_stream: add printf facility
Diffstat (limited to 'src/gallium/auxiliary/os/os_stream.h')
-rw-r--r-- | src/gallium/auxiliary/os/os_stream.h | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/os/os_stream.h b/src/gallium/auxiliary/os/os_stream.h index 693a0621e2d..6c6050bb028 100644 --- a/src/gallium/auxiliary/os/os_stream.h +++ b/src/gallium/auxiliary/os/os_stream.h @@ -50,6 +50,9 @@ struct os_stream void (*flush)(struct os_stream *stream); + + int + (*vprintf)(struct os_stream *stream, const char* format, va_list ap); }; @@ -90,6 +93,27 @@ os_stream_flush(struct os_stream *stream) stream->flush(stream); } +int +os_default_stream_vprintf (struct os_stream* stream, const char *format, va_list ap); + +static INLINE int +os_stream_vprintf (struct os_stream* stream, const char *format, va_list ap) +{ + return stream->vprintf(stream, format, ap); +} + +static INLINE int +os_stream_printf (struct os_stream* stream, const char *format, ...) +{ + int retval; + va_list args; + + va_start (args, format); + retval = stream->vprintf(stream, format, args); + va_end (args); + + return retval; +} struct os_stream * os_file_stream_create(const char *filename); @@ -118,5 +142,4 @@ os_str_stream_get_and_close(struct os_stream *stream); #define os_file_stream_create(_filename) os_null_stream_create() #endif - #endif /* _OS_STREAM_H_ */ |