Mesa (master): os: Complement/improve stream inline helpers.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Sun Feb 14 23:30:11 UTC 2010


Module: Mesa
Branch: master
Commit: 78200989d353d979dfea584460c5338e35575aea
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=78200989d353d979dfea584460c5338e35575aea

Author: José Fonseca <jfonseca at vmware.com>
Date:   Sun Feb 14 23:04:04 2010 +0000

os: Complement/improve stream inline helpers.

---

 src/gallium/auxiliary/os/os_stream.h |   17 +++++++++++++++++
 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 8232b0f..2ce5b18 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)
 {




More information about the mesa-commit mailing list