diff options
author | Edward O'Callaghan <eocallaghan@alterapraxis.com> | 2015-12-04 22:08:22 +1100 |
---|---|---|
committer | Marek Olšák <marek.olsak@amd.com> | 2015-12-06 17:10:23 +0100 |
commit | 13eb5f596bc8ece3d1805b388aa53917e6158d7b (patch) | |
tree | da4ab5c8fd897b317d7f66004fdd22cd02ebe84c /src/gallium/drivers/llvmpipe | |
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 <eocallaghan@alterapraxis.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
Diffstat (limited to 'src/gallium/drivers/llvmpipe')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_scene.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_scene_queue.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_setup_tri.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_state_gs.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_state_rasterizer.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_state_setup.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_state_vs.c | 2 |
7 files changed, 7 insertions, 7 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_scene.c b/src/gallium/drivers/llvmpipe/lp_scene.c index 2441b3c0d8..223be931e0 100644 --- a/src/gallium/drivers/llvmpipe/lp_scene.c +++ b/src/gallium/drivers/llvmpipe/lp_scene.c @@ -337,7 +337,7 @@ lp_scene_new_data_block( struct lp_scene *scene ) } else { struct data_block *block = MALLOC_STRUCT(data_block); - if (block == NULL) + if (!block) return NULL; scene->scene_size += sizeof *block; diff --git a/src/gallium/drivers/llvmpipe/lp_scene_queue.c b/src/gallium/drivers/llvmpipe/lp_scene_queue.c index 975db43c4e..debc7a6fe1 100644 --- a/src/gallium/drivers/llvmpipe/lp_scene_queue.c +++ b/src/gallium/drivers/llvmpipe/lp_scene_queue.c @@ -60,7 +60,7 @@ struct lp_scene_queue * lp_scene_queue_create(void) { struct lp_scene_queue *queue = CALLOC_STRUCT(lp_scene_queue); - if (queue == NULL) + if (!queue) return NULL; queue->ring = util_ringbuffer_create( MAX_SCENE_QUEUE * diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c index 2c9d43fb04..b1671dd0ae 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c @@ -96,7 +96,7 @@ lp_setup_alloc_triangle(struct lp_scene *scene, plane_sz); tri = lp_scene_alloc_aligned( scene, *tri_size, 16 ); - if (tri == NULL) + if (!tri) return NULL; tri->inputs.stride = input_array_sz; diff --git a/src/gallium/drivers/llvmpipe/lp_state_gs.c b/src/gallium/drivers/llvmpipe/lp_state_gs.c index 7ea7a39066..405a415624 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_gs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_gs.c @@ -47,7 +47,7 @@ llvmpipe_create_gs_state(struct pipe_context *pipe, struct lp_geometry_shader *state; state = CALLOC_STRUCT(lp_geometry_shader); - if (state == NULL ) + if (!state) goto no_state; /* debug */ diff --git a/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c b/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c index 94ebf8ffff..ef6958d99f 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c +++ b/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c @@ -64,7 +64,7 @@ llvmpipe_create_rasterizer_state(struct pipe_context *pipe, * handle, and what we'll look after ourselves. */ struct lp_rast_state *state = MALLOC_STRUCT(lp_rast_state); - if (state == NULL) + if (!state) return NULL; memcpy(&state->draw_state, rast, sizeof *rast); diff --git a/src/gallium/drivers/llvmpipe/lp_state_setup.c b/src/gallium/drivers/llvmpipe/lp_state_setup.c index 6397b5196d..64215be91a 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_state_setup.c @@ -723,7 +723,7 @@ generate_setup_variant(struct lp_setup_variant_key *key, goto fail; variant = CALLOC_STRUCT(lp_setup_variant); - if (variant == NULL) + if (!variant) goto fail; variant->no = setup_no++; diff --git a/src/gallium/drivers/llvmpipe/lp_state_vs.c b/src/gallium/drivers/llvmpipe/lp_state_vs.c index 826ee5b72b..96a00189b5 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_vs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_vs.c @@ -46,7 +46,7 @@ llvmpipe_create_vs_state(struct pipe_context *pipe, struct draw_vertex_shader *vs; vs = draw_create_vertex_shader(llvmpipe->draw, templ); - if (vs == NULL) { + if (!vs) { return NULL; } |