Mesa (master): svga: rewrite svga_buffer() cast wrapper

Brian Paul brianp at kemper.freedesktop.org
Fri Aug 26 20:32:33 UTC 2016


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

Author: Brian Paul <brianp at vmware.com>
Date:   Thu Aug 25 15:05:27 2016 -0600

svga: rewrite svga_buffer() cast wrapper

To make it symmetric with the svga_texture() cast wrapper.

Reviewed-by: Neha Bhende <bhenden at vmware.com>

---

 src/gallium/drivers/svga/svga_resource_buffer.h | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_resource_buffer.h b/src/gallium/drivers/svga/svga_resource_buffer.h
index 0591f89..daf9c18 100644
--- a/src/gallium/drivers/svga/svga_resource_buffer.h
+++ b/src/gallium/drivers/svga/svga_resource_buffer.h
@@ -196,13 +196,11 @@ struct svga_buffer
 
 
 static inline struct svga_buffer *
-svga_buffer(struct pipe_resource *buffer)
+svga_buffer(struct pipe_resource *resource)
 {
-   if (buffer) {
-      assert(((struct svga_buffer *)buffer)->b.vtbl == &svga_buffer_vtbl);
-      return (struct svga_buffer *)buffer;
-   }
-   return NULL;
+   struct svga_buffer *buf = (struct svga_buffer *) resource;
+   assert(buf == NULL || buf->b.vtbl == &svga_buffer_vtbl);
+   return buf;
 }
 
 




More information about the mesa-commit mailing list