diff options
author | Edward O'Callaghan <[email protected]> | 2015-12-04 22:08:22 +1100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2015-12-06 17:10:23 +0100 |
commit | 13eb5f596bc8ece3d1805b388aa53917e6158d7b (patch) | |
tree | da4ab5c8fd897b317d7f66004fdd22cd02ebe84c /src/gallium/drivers/svga/svga_draw.c | |
parent | 150c289f6067cb1ba4572f9124948a94ef94c839 (diff) |
gallium/drivers: Sanitize NULL checks into canonical form
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 <[email protected]>
Signed-off-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/drivers/svga/svga_draw.c')
-rw-r--r-- | src/gallium/drivers/svga/svga_draw.c | 8 |
1 files changed, 4 insertions, 4 deletions
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 { |