summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2010-02-14 23:04:04 +0000
committerJosé Fonseca <jfonseca@vmware.com>2010-02-14 23:25:34 +0000
commit78200989d353d979dfea584460c5338e35575aea (patch)
tree3c2c18b7c9db6a532ab4548de494483e7faec0e1 /src/gallium/auxiliary
parent33682e551036abcef4fb6d55aab15a25a58c5457 (diff)
os: Complement/improve stream inline helpers.
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/os/os_stream.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/os/os_stream.h b/src/gallium/auxiliary/os/os_stream.h
index 8232b0f158..2ce5b1885e 100644
--- a/src/gallium/auxiliary/os/os_stream.h
+++ b/src/gallium/auxiliary/os/os_stream.h
@@ -56,6 +56,9 @@ struct os_stream
static INLINE void
os_stream_close(struct os_stream *stream)
{
+ if (!stream)
+ return;
+
stream->close(stream);
}
@@ -63,10 +66,24 @@ os_stream_close(struct os_stream *stream)
static INLINE boolean
os_stream_write(struct os_stream *stream, const void *data, size_t size)
{
+ if (!stream)
+ return FALSE;
return stream->write(stream, data, size);
}
+static INLINE boolean
+os_stream_write_str(struct os_stream *stream, const char *str)
+{
+ size_t size;
+ if (!stream)
+ return FALSE;
+ for(size = 0; str[size]; ++size)
+ ;
+ return stream->write(stream, str, size);
+}
+
+
static INLINE void
os_stream_flush(struct os_stream *stream)
{