From 13eb5f596bc8ece3d1805b388aa53917e6158d7b Mon Sep 17 00:00:00 2001 From: Edward O'Callaghan Date: Fri, 4 Dec 2015 22:08:22 +1100 Subject: gallium/drivers: Sanitize NULL checks into canonical form MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use NULL tests of the form `if (ptr)' or `if (!ptr)'. They do not depend on the definition of the symbol NULL. Further, they provide the opportunity for the accidental assignment, are clear and succinct. Signed-off-by: Edward O'Callaghan Signed-off-by: Marek Olšák --- src/gallium/drivers/svga/svga_draw.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/gallium/drivers/svga/svga_draw.c') diff --git a/src/gallium/drivers/svga/svga_draw.c b/src/gallium/drivers/svga/svga_draw.c index 9b6451da2f9..cca499a65c7 100644 --- a/src/gallium/drivers/svga/svga_draw.c +++ b/src/gallium/drivers/svga/svga_draw.c @@ -48,7 +48,7 @@ struct svga_hwtnl * svga_hwtnl_create(struct svga_context *svga) { struct svga_hwtnl *hwtnl = CALLOC_STRUCT(svga_hwtnl); - if (hwtnl == NULL) + if (!hwtnl) goto fail; hwtnl->svga = svga; @@ -189,7 +189,7 @@ draw_vgpu9(struct svga_hwtnl *hwtnl) for (i = 0; i < hwtnl->cmd.vdecl_count; i++) { unsigned j = hwtnl->cmd.vdecl_buffer_index[i]; handle = svga_buffer_handle(svga, hwtnl->cmd.vbufs[j].buffer); - if (handle == NULL) + if (!handle) return PIPE_ERROR_OUT_OF_MEMORY; vb_handle[i] = handle; @@ -198,7 +198,7 @@ draw_vgpu9(struct svga_hwtnl *hwtnl) for (i = 0; i < hwtnl->cmd.prim_count; i++) { if (hwtnl->cmd.prim_ib[i]) { handle = svga_buffer_handle(svga, hwtnl->cmd.prim_ib[i]); - if (handle == NULL) + if (!handle) return PIPE_ERROR_OUT_OF_MEMORY; } else @@ -491,7 +491,7 @@ draw_vgpu10(struct svga_hwtnl *hwtnl, (void) sbuf; /* silence unused var warning */ ib_handle = svga_buffer_handle(svga, ib); - if (ib_handle == NULL) + if (!ib_handle) return PIPE_ERROR_OUT_OF_MEMORY; } else { -- cgit v1.2.3