svga: rewrite svga_buffer() cast wrapper
authorBrian Paul <brianp@vmware.com>
Thu, 25 Aug 2016 21:05:27 +0000 (15:05 -0600)
committerBrian Paul <brianp@vmware.com>
Fri, 26 Aug 2016 20:20:18 +0000 (14:20 -0600)
To make it symmetric with the svga_texture() cast wrapper.

Reviewed-by: Neha Bhende <bhenden@vmware.com>
src/gallium/drivers/svga/svga_resource_buffer.h

index 0591f8960b9d720f227b436cdd206873f646c695..daf9c18a95a2629b6756386736b4776547d30807 100644 (file)
@@ -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;
 }