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/radeonsi/si_state.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/radeonsi/si_state.c')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index 5b71389c6aa..9f9f3d6610b 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -356,7 +356,7 @@ static void *si_create_blend_state_mode(struct pipe_context *ctx, uint32_t color_control = 0; - if (blend == NULL) + if (!blend) return NULL; blend->alpha_to_one = state->alpha_to_one; @@ -681,7 +681,7 @@ static void *si_create_rs_state(struct pipe_context *ctx, unsigned tmp, i; float psize_min, psize_max; - if (rs == NULL) { + if (!rs) { return NULL; } @@ -803,7 +803,7 @@ static void si_bind_rs_state(struct pipe_context *ctx, void *state) (struct si_state_rasterizer*)sctx->queued.named.rasterizer; struct si_state_rasterizer *rs = (struct si_state_rasterizer *)state; - if (state == NULL) + if (!state) return; if (sctx->framebuffer.nr_samples > 1 && @@ -897,7 +897,7 @@ static void *si_create_dsa_state(struct pipe_context *ctx, unsigned db_depth_control; uint32_t db_stencil_control = 0; - if (dsa == NULL) { + if (!dsa) { return NULL; } @@ -953,7 +953,7 @@ static void si_bind_dsa_state(struct pipe_context *ctx, void *state) struct si_context *sctx = (struct si_context *)ctx; struct si_state_dsa *dsa = state; - if (state == NULL) + if (!state) return; si_pm4_bind_state(sctx, dsa, dsa); @@ -2419,7 +2419,7 @@ si_create_sampler_view_custom(struct pipe_context *ctx, uint64_t va; unsigned last_layer = state->u.tex.last_layer; - if (view == NULL) + if (!view) return NULL; /* initialize base object */ @@ -2762,7 +2762,7 @@ static void *si_create_sampler_state(struct pipe_context *ctx, unsigned aniso_flag_offset = state->max_anisotropy > 1 ? 2 : 0; unsigned border_color_type, border_color_index = 0; - if (rstate == NULL) { + if (!rstate) { return NULL; } @@ -3291,7 +3291,7 @@ static void si_init_config(struct si_context *sctx) struct si_pm4_state *pm4 = CALLOC_STRUCT(si_pm4_state); int i; - if (pm4 == NULL) + if (!pm4) return; si_pm4_cmd_begin(pm4, PKT3_CONTEXT_CONTROL); |