summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorEdward O'Callaghan <[email protected]>2015-12-04 21:26:50 +1100
committerMarek Olšák <[email protected]>2015-12-06 17:10:23 +0100
commit150c289f6067cb1ba4572f9124948a94ef94c839 (patch)
treedd36e1c1546da77b4f539a2256b1f01b8c97936c /src/gallium
parent147fd00bb36917f8463aacd49a26e95ca0926255 (diff)
gallium/auxiliary: 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')
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_cache.c2
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.c4
-rw-r--r--src/gallium/auxiliary/draw/draw_context.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_gs.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_llvm.c4
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_aaline.c18
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_aapoint.c6
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_clip.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_cull.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_flatshade.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_offset.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_pstipple.c4
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_stipple.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_twoside.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_unfilled.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_util.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_validate.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_vbuf.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_wide_line.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_wide_point.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch_emit.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_vs.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_exec.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_llvm.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_variant.c2
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_const.c2
-rw-r--r--src/gallium/auxiliary/postprocess/pp_init.c2
-rw-r--r--src/gallium/auxiliary/postprocess/pp_mlaa.c2
-rw-r--r--src/gallium/auxiliary/postprocess/pp_run.c2
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_sanity.c2
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_ureg.c2
-rw-r--r--src/gallium/auxiliary/translate/translate_cache.c2
-rw-r--r--src/gallium/auxiliary/translate/translate_generic.c2
-rw-r--r--src/gallium/auxiliary/translate/translate_sse.c2
-rw-r--r--src/gallium/auxiliary/util/u_draw_quad.c2
-rw-r--r--src/gallium/auxiliary/util/u_inlines.h2
-rw-r--r--src/gallium/auxiliary/util/u_ringbuffer.c2
-rw-r--r--src/gallium/auxiliary/util/u_simple_shaders.c16
-rw-r--r--src/gallium/auxiliary/util/u_transfer.c2
-rw-r--r--src/gallium/auxiliary/util/u_upload_mgr.c2
-rw-r--r--src/gallium/auxiliary/vl/vl_mpeg12_decoder.c2
41 files changed, 61 insertions, 61 deletions
diff --git a/src/gallium/auxiliary/cso_cache/cso_cache.c b/src/gallium/auxiliary/cso_cache/cso_cache.c
index d36f1fbd717..b240c938dcc 100644
--- a/src/gallium/auxiliary/cso_cache/cso_cache.c
+++ b/src/gallium/auxiliary/cso_cache/cso_cache.c
@@ -247,7 +247,7 @@ struct cso_cache *cso_cache_create(void)
{
struct cso_cache *sc = MALLOC_STRUCT(cso_cache);
int i;
- if (sc == NULL)
+ if (!sc)
return NULL;
sc->max_size = 4096;
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c
index 00686d2af41..6b29b20c53e 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.c
+++ b/src/gallium/auxiliary/cso_cache/cso_context.c
@@ -244,7 +244,7 @@ static void cso_init_vbuf(struct cso_context *cso)
struct cso_context *cso_create_context( struct pipe_context *pipe )
{
struct cso_context *ctx = CALLOC_STRUCT(cso_context);
- if (ctx == NULL)
+ if (!ctx)
goto out;
ctx->cache = cso_cache_create();
@@ -1075,7 +1075,7 @@ cso_single_sampler(struct cso_context *ctx, unsigned shader_stage,
{
void *handle = NULL;
- if (templ != NULL) {
+ if (templ) {
unsigned key_size = sizeof(struct pipe_sampler_state);
unsigned hash_key = cso_construct_key((void*)templ, key_size);
struct cso_hash_iter iter =
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index ee009c1fb71..16a261c14cf 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -72,7 +72,7 @@ draw_create_context(struct pipe_context *pipe, void *context,
boolean try_llvm)
{
struct draw_context *draw = CALLOC_STRUCT( draw_context );
- if (draw == NULL)
+ if (!draw)
goto err_out;
/* we need correct cpu caps for disabling denorms in draw_vbo() */
diff --git a/src/gallium/auxiliary/draw/draw_gs.c b/src/gallium/auxiliary/draw/draw_gs.c
index c827a68ea0a..6b33341ce6c 100644
--- a/src/gallium/auxiliary/draw/draw_gs.c
+++ b/src/gallium/auxiliary/draw/draw_gs.c
@@ -734,7 +734,7 @@ draw_create_geometry_shader(struct draw_context *draw,
if (use_llvm) {
llvm_gs = CALLOC_STRUCT(llvm_geometry_shader);
- if (llvm_gs == NULL)
+ if (!llvm_gs)
return NULL;
gs = &llvm_gs->base;
diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
index 8435991fb6b..ee974243b3e 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -551,7 +551,7 @@ draw_llvm_create_variant(struct draw_llvm *llvm,
variant = MALLOC(sizeof *variant +
shader->variant_key_size -
sizeof variant->key);
- if (variant == NULL)
+ if (!variant)
return NULL;
variant->llvm = llvm;
@@ -2224,7 +2224,7 @@ draw_gs_llvm_create_variant(struct draw_llvm *llvm,
variant = MALLOC(sizeof *variant +
shader->variant_key_size -
sizeof variant->key);
- if (variant == NULL)
+ if (!variant)
return NULL;
variant->llvm = llvm;
diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
index 85d24b7a6a1..337fb0fadda 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
@@ -429,7 +429,7 @@ aaline_create_texture(struct aaline_stage *aaline)
PIPE_TRANSFER_WRITE,
&box, &transfer);
- if (data == NULL)
+ if (!data)
return FALSE;
for (i = 0; i < size; i++) {
@@ -774,7 +774,7 @@ static struct aaline_stage *
draw_aaline_stage(struct draw_context *draw)
{
struct aaline_stage *aaline = CALLOC_STRUCT(aaline_stage);
- if (aaline == NULL)
+ if (!aaline)
return NULL;
aaline->stage.draw = draw;
@@ -824,12 +824,12 @@ aaline_create_fs_state(struct pipe_context *pipe,
struct aaline_stage *aaline = aaline_stage_from_pipe(pipe);
struct aaline_fragment_shader *aafs = NULL;
- if (aaline == NULL)
+ if (!aaline)
return NULL;
aafs = CALLOC_STRUCT(aaline_fragment_shader);
- if (aafs == NULL)
+ if (!aafs)
return NULL;
aafs->state.tokens = tgsi_dup_tokens(fs->tokens);
@@ -847,7 +847,7 @@ aaline_bind_fs_state(struct pipe_context *pipe, void *fs)
struct aaline_stage *aaline = aaline_stage_from_pipe(pipe);
struct aaline_fragment_shader *aafs = (struct aaline_fragment_shader *) fs;
- if (aaline == NULL) {
+ if (!aaline) {
return;
}
@@ -864,11 +864,11 @@ aaline_delete_fs_state(struct pipe_context *pipe, void *fs)
struct aaline_stage *aaline = aaline_stage_from_pipe(pipe);
struct aaline_fragment_shader *aafs = (struct aaline_fragment_shader *) fs;
- if (aafs == NULL) {
+ if (!aafs) {
return;
}
- if (aaline != NULL) {
+ if (aaline) {
/* pass-through */
aaline->driver_delete_fs_state(pipe, aafs->driver_fs);
@@ -889,7 +889,7 @@ aaline_bind_sampler_states(struct pipe_context *pipe, unsigned shader,
assert(start == 0);
- if (aaline == NULL) {
+ if (!aaline) {
return;
}
@@ -912,7 +912,7 @@ aaline_set_sampler_views(struct pipe_context *pipe, unsigned shader,
struct aaline_stage *aaline = aaline_stage_from_pipe(pipe);
uint i;
- if (aaline == NULL) {
+ if (!aaline) {
return;
}
diff --git a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c
index 063e36828d7..33ef8ec1702 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c
@@ -662,7 +662,7 @@ static struct aapoint_stage *
draw_aapoint_stage(struct draw_context *draw)
{
struct aapoint_stage *aapoint = CALLOC_STRUCT(aapoint_stage);
- if (aapoint == NULL)
+ if (!aapoint)
goto fail;
aapoint->stage.draw = draw;
@@ -707,7 +707,7 @@ aapoint_create_fs_state(struct pipe_context *pipe,
{
struct aapoint_stage *aapoint = aapoint_stage_from_pipe(pipe);
struct aapoint_fragment_shader *aafs = CALLOC_STRUCT(aapoint_fragment_shader);
- if (aafs == NULL)
+ if (!aafs)
return NULL;
aafs->state.tokens = tgsi_dup_tokens(fs->tokens);
@@ -767,7 +767,7 @@ draw_install_aapoint_stage(struct draw_context *draw,
* Create / install AA point drawing / prim stage
*/
aapoint = draw_aapoint_stage( draw );
- if (aapoint == NULL)
+ if (!aapoint)
return FALSE;
/* save original driver functions */
diff --git a/src/gallium/auxiliary/draw/draw_pipe_clip.c b/src/gallium/auxiliary/draw/draw_pipe_clip.c
index f2b56b017dd..35e54f4a8be 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_clip.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_clip.c
@@ -915,7 +915,7 @@ static void clip_destroy(struct draw_stage *stage)
struct draw_stage *draw_clip_stage(struct draw_context *draw)
{
struct clip_stage *clipper = CALLOC_STRUCT(clip_stage);
- if (clipper == NULL)
+ if (!clipper)
goto fail;
clipper->stage.draw = draw;
diff --git a/src/gallium/auxiliary/draw/draw_pipe_cull.c b/src/gallium/auxiliary/draw/draw_pipe_cull.c
index fc8293bd128..240f55190f5 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_cull.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_cull.c
@@ -251,7 +251,7 @@ static void cull_destroy( struct draw_stage *stage )
struct draw_stage *draw_cull_stage( struct draw_context *draw )
{
struct cull_stage *cull = CALLOC_STRUCT(cull_stage);
- if (cull == NULL)
+ if (!cull)
goto fail;
cull->stage.draw = draw;
diff --git a/src/gallium/auxiliary/draw/draw_pipe_flatshade.c b/src/gallium/auxiliary/draw/draw_pipe_flatshade.c
index 0ea740861d6..cd285e6f97c 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_flatshade.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_flatshade.c
@@ -309,7 +309,7 @@ static void flatshade_destroy( struct draw_stage *stage )
struct draw_stage *draw_flatshade_stage( struct draw_context *draw )
{
struct flat_stage *flatshade = CALLOC_STRUCT(flat_stage);
- if (flatshade == NULL)
+ if (!flatshade)
goto fail;
flatshade->stage.draw = draw;
diff --git a/src/gallium/auxiliary/draw/draw_pipe_offset.c b/src/gallium/auxiliary/draw/draw_pipe_offset.c
index 5e0d8ce793d..f58e32b98a4 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_offset.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_offset.c
@@ -231,7 +231,7 @@ static void offset_destroy( struct draw_stage *stage )
struct draw_stage *draw_offset_stage( struct draw_context *draw )
{
struct offset_stage *offset = CALLOC_STRUCT(offset_stage);
- if (offset == NULL)
+ if (!offset)
goto fail;
offset->stage.draw = draw;
diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
index a51e91fe931..b58d7530783 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
@@ -577,7 +577,7 @@ static struct pstip_stage *
draw_pstip_stage(struct draw_context *draw, struct pipe_context *pipe)
{
struct pstip_stage *pstip = CALLOC_STRUCT(pstip_stage);
- if (pstip == NULL)
+ if (!pstip)
goto fail;
pstip->pipe = pipe;
@@ -742,7 +742,7 @@ draw_install_pstipple_stage(struct draw_context *draw,
* Create / install pgon stipple drawing / prim stage
*/
pstip = draw_pstip_stage( draw, pipe );
- if (pstip == NULL)
+ if (!pstip)
goto fail;
draw->pipeline.pstipple = &pstip->stage;
diff --git a/src/gallium/auxiliary/draw/draw_pipe_stipple.c b/src/gallium/auxiliary/draw/draw_pipe_stipple.c
index 381aa41530b..dcf05aac1d9 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_stipple.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_stipple.c
@@ -235,7 +235,7 @@ stipple_destroy( struct draw_stage *stage )
struct draw_stage *draw_stipple_stage( struct draw_context *draw )
{
struct stipple_stage *stipple = CALLOC_STRUCT(stipple_stage);
- if (stipple == NULL)
+ if (!stipple)
goto fail;
stipple->stage.draw = draw;
diff --git a/src/gallium/auxiliary/draw/draw_pipe_twoside.c b/src/gallium/auxiliary/draw/draw_pipe_twoside.c
index 7f958d9b985..52d87c6b291 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_twoside.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_twoside.c
@@ -165,7 +165,7 @@ static void twoside_destroy( struct draw_stage *stage )
struct draw_stage *draw_twoside_stage( struct draw_context *draw )
{
struct twoside_stage *twoside = CALLOC_STRUCT(twoside_stage);
- if (twoside == NULL)
+ if (!twoside)
goto fail;
twoside->stage.draw = draw;
diff --git a/src/gallium/auxiliary/draw/draw_pipe_unfilled.c b/src/gallium/auxiliary/draw/draw_pipe_unfilled.c
index 8e6435cdbb4..2517d610e71 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_unfilled.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_unfilled.c
@@ -255,7 +255,7 @@ draw_unfilled_prepare_outputs( struct draw_context *draw,
struct draw_stage *draw_unfilled_stage( struct draw_context *draw )
{
struct unfilled_stage *unfilled = CALLOC_STRUCT(unfilled_stage);
- if (unfilled == NULL)
+ if (!unfilled)
goto fail;
unfilled->stage.draw = draw;
diff --git a/src/gallium/auxiliary/draw/draw_pipe_util.c b/src/gallium/auxiliary/draw/draw_pipe_util.c
index cb8c732afe8..53a42a6a0e4 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_util.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_util.c
@@ -78,7 +78,7 @@ boolean draw_alloc_temp_verts( struct draw_stage *stage, unsigned nr )
unsigned i;
ubyte *store = (ubyte *) MALLOC( MAX_VERTEX_SIZE * nr );
- if (store == NULL)
+ if (!store)
return FALSE;
stage->tmp = (struct vertex_header **) MALLOC( sizeof(struct vertex_header *) * nr );
diff --git a/src/gallium/auxiliary/draw/draw_pipe_validate.c b/src/gallium/auxiliary/draw/draw_pipe_validate.c
index e69d84a37cd..01d07593d5c 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_validate.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_validate.c
@@ -326,7 +326,7 @@ static void validate_destroy( struct draw_stage *stage )
struct draw_stage *draw_validate_stage( struct draw_context *draw )
{
struct draw_stage *stage = CALLOC_STRUCT(draw_stage);
- if (stage == NULL)
+ if (!stage)
return NULL;
stage->draw = draw;
diff --git a/src/gallium/auxiliary/draw/draw_pipe_vbuf.c b/src/gallium/auxiliary/draw/draw_pipe_vbuf.c
index 5cc866d7eee..f36706cee01 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_vbuf.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_vbuf.c
@@ -426,7 +426,7 @@ struct draw_stage *draw_vbuf_stage( struct draw_context *draw,
struct vbuf_render *render )
{
struct vbuf_stage *vbuf = CALLOC_STRUCT(vbuf_stage);
- if (vbuf == NULL)
+ if (!vbuf)
goto fail;
vbuf->stage.draw = draw;
diff --git a/src/gallium/auxiliary/draw/draw_pipe_wide_line.c b/src/gallium/auxiliary/draw/draw_pipe_wide_line.c
index 38ac11a9adf..ae4a00eb630 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_wide_line.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_wide_line.c
@@ -202,7 +202,7 @@ static void wideline_destroy( struct draw_stage *stage )
struct draw_stage *draw_wide_line_stage( struct draw_context *draw )
{
struct wideline_stage *wide = CALLOC_STRUCT(wideline_stage);
- if (wide == NULL)
+ if (!wide)
goto fail;
wide->stage.draw = draw;
diff --git a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c
index 348b0e93bbc..adb6120d834 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c
@@ -315,7 +315,7 @@ static void widepoint_destroy( struct draw_stage *stage )
struct draw_stage *draw_wide_point_stage( struct draw_context *draw )
{
struct widepoint_stage *wide = CALLOC_STRUCT(widepoint_stage);
- if (wide == NULL)
+ if (!wide)
goto fail;
wide->stage.draw = draw;
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c b/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
index b6966a52ea4..c7b224a88f7 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
@@ -376,7 +376,7 @@ static void fetch_emit_destroy( struct draw_pt_middle_end *middle )
struct draw_pt_middle_end *draw_pt_fetch_emit( struct draw_context *draw )
{
struct fetch_emit_middle_end *fetch_emit = CALLOC_STRUCT( fetch_emit_middle_end );
- if (fetch_emit == NULL)
+ if (!fetch_emit)
return NULL;
fetch_emit->cache = translate_cache_create();
diff --git a/src/gallium/auxiliary/draw/draw_vs.c b/src/gallium/auxiliary/draw/draw_vs.c
index 1501942eb44..438c9a6b9c4 100644
--- a/src/gallium/auxiliary/draw/draw_vs.c
+++ b/src/gallium/auxiliary/draw/draw_vs.c
@@ -200,7 +200,7 @@ draw_vs_lookup_variant( struct draw_vertex_shader *vs,
/* Else have to create a new one:
*/
variant = vs->create_variant( vs, key );
- if (variant == NULL)
+ if (!variant)
return NULL;
/* Add it to our list, could be smarter:
diff --git a/src/gallium/auxiliary/draw/draw_vs_exec.c b/src/gallium/auxiliary/draw/draw_vs_exec.c
index 17b54b6fe74..abd64f5acd2 100644
--- a/src/gallium/auxiliary/draw/draw_vs_exec.c
+++ b/src/gallium/auxiliary/draw/draw_vs_exec.c
@@ -225,7 +225,7 @@ draw_create_vs_exec(struct draw_context *draw,
{
struct exec_vertex_shader *vs = CALLOC_STRUCT( exec_vertex_shader );
- if (vs == NULL)
+ if (!vs)
return NULL;
/* we make a private copy of the tokens */
diff --git a/src/gallium/auxiliary/draw/draw_vs_llvm.c b/src/gallium/auxiliary/draw/draw_vs_llvm.c
index ac3999efc68..c92e4317216 100644
--- a/src/gallium/auxiliary/draw/draw_vs_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_vs_llvm.c
@@ -86,7 +86,7 @@ draw_create_vs_llvm(struct draw_context *draw,
{
struct llvm_vertex_shader *vs = CALLOC_STRUCT( llvm_vertex_shader );
- if (vs == NULL)
+ if (!vs)
return NULL;
/* we make a private copy of the tokens */
diff --git a/src/gallium/auxiliary/draw/draw_vs_variant.c b/src/gallium/auxiliary/draw/draw_vs_variant.c
index ce3a608c1d1..af36a86674d 100644
--- a/src/gallium/auxiliary/draw/draw_vs_variant.c
+++ b/src/gallium/auxiliary/draw/draw_vs_variant.c
@@ -302,7 +302,7 @@ draw_vs_create_variant_generic( struct draw_vertex_shader *vs,
struct translate_key fetch, emit;
struct draw_vs_variant_generic *vsvg = CALLOC_STRUCT( draw_vs_variant_generic );
- if (vsvg == NULL)
+ if (!vsvg)
return NULL;
vsvg->base.key = *key;
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_const.c b/src/gallium/auxiliary/gallivm/lp_bld_const.c
index 9cd7c5553cf..58fdcc94437 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_const.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_const.c
@@ -373,7 +373,7 @@ lp_build_const_aos(struct gallivm_state *gallivm,
lp_build_elem_type(gallivm, type);
- if(swizzle == NULL)
+ if (!swizzle)
swizzle = default_swizzle;
elems[swizzle[0]] = lp_build_const_elem(gallivm, type, r);
diff --git a/src/gallium/auxiliary/postprocess/pp_init.c b/src/gallium/auxiliary/postprocess/pp_init.c
index bdf66e6d63a..b9eff78bf4f 100644
--- a/src/gallium/auxiliary/postprocess/pp_init.c
+++ b/src/gallium/auxiliary/postprocess/pp_init.c
@@ -58,7 +58,7 @@ pp_init(struct pipe_context *pipe, const unsigned int *enabled,
ppq = CALLOC(1, sizeof(struct pp_queue_t));
- if (ppq == NULL) {
+ if (!ppq) {
pp_debug("Unable to allocate memory for ppq.\n");
goto error;
}
diff --git a/src/gallium/auxiliary/postprocess/pp_mlaa.c b/src/gallium/auxiliary/postprocess/pp_mlaa.c
index 024a24895c8..a3f58b52f48 100644
--- a/src/gallium/auxiliary/postprocess/pp_mlaa.c
+++ b/src/gallium/auxiliary/postprocess/pp_mlaa.c
@@ -238,7 +238,7 @@ pp_jimenezmlaa_init_run(struct pp_queue_t *ppq, unsigned int n,
tmp_text = CALLOC(sizeof(blend2fs_1) + sizeof(blend2fs_2) +
IMM_SPACE, sizeof(char));
- if (tmp_text == NULL) {
+ if (!tmp_text) {
pp_debug("Failed to allocate shader space\n");
return FALSE;
}
diff --git a/src/gallium/auxiliary/postprocess/pp_run.c b/src/gallium/auxiliary/postprocess/pp_run.c
index caa2062f4cf..c6c7b88eea3 100644
--- a/src/gallium/auxiliary/postprocess/pp_run.c
+++ b/src/gallium/auxiliary/postprocess/pp_run.c
@@ -262,7 +262,7 @@ pp_tgsi_to_state(struct pipe_context *pipe, const char *text, bool isvs,
*/
tokens = tgsi_alloc_tokens(PP_MAX_TOKENS);
- if (tokens == NULL) {
+ if (!tokens) {
pp_debug("Failed to allocate temporary token storage.\n");
return NULL;
}
diff --git a/src/gallium/auxiliary/tgsi/tgsi_sanity.c b/src/gallium/auxiliary/tgsi/tgsi_sanity.c
index d14372feb30..88ecb2a31cb 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_sanity.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_sanity.c
@@ -321,7 +321,7 @@ iter_instruction(
}
info = tgsi_get_opcode_info( inst->Instruction.Opcode );
- if (info == NULL) {
+ if (!info) {
report_error( ctx, "(%u): Invalid instruction opcode", inst->Instruction.Opcode );
return TRUE;
}
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
index 4730472f40f..4aaf8dfe6d8 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
@@ -1843,7 +1843,7 @@ ureg_create_with_screen(unsigned processor, struct pipe_screen *screen)
{
int i;
struct ureg_program *ureg = CALLOC_STRUCT( ureg_program );
- if (ureg == NULL)
+ if (!ureg)
goto no_ureg;
ureg->processor = processor;
diff --git a/src/gallium/auxiliary/translate/translate_cache.c b/src/gallium/auxiliary/translate/translate_cache.c
index 2bed02a454b..8aad7cdfb2b 100644
--- a/src/gallium/auxiliary/translate/translate_cache.c
+++ b/src/gallium/auxiliary/translate/translate_cache.c
@@ -40,7 +40,7 @@ struct translate_cache {
struct translate_cache * translate_cache_create( void )
{
struct translate_cache *cache = MALLOC_STRUCT(translate_cache);
- if (cache == NULL) {
+ if (!cache) {
return NULL;
}
diff --git a/src/gallium/auxiliary/translate/translate_generic.c b/src/gallium/auxiliary/translate/translate_generic.c
index 45eb63231e3..3b460e11c34 100644
--- a/src/gallium/auxiliary/translate/translate_generic.c
+++ b/src/gallium/auxiliary/translate/translate_generic.c
@@ -772,7 +772,7 @@ struct translate *translate_generic_create( const struct translate_key *key )
struct translate_generic *tg = CALLOC_STRUCT(translate_generic);
unsigned i;
- if (tg == NULL)
+ if (!tg)
return NULL;
assert(key->nr_elements <= TRANSLATE_MAX_ATTRIBS);
diff --git a/src/gallium/auxiliary/translate/translate_sse.c b/src/gallium/auxiliary/translate/translate_sse.c
index c7b6c36fcfa..b3c3b305962 100644
--- a/src/gallium/auxiliary/translate/translate_sse.c
+++ b/src/gallium/auxiliary/translate/translate_sse.c
@@ -1486,7 +1486,7 @@ translate_sse2_create(const struct translate_key *key)
goto fail;
p = os_malloc_aligned(sizeof(struct translate_sse), 16);
- if (p == NULL)
+ if (!p)
goto fail;
memset(p, 0, sizeof(*p));
diff --git a/src/gallium/auxiliary/util/u_draw_quad.c b/src/gallium/auxiliary/util/u_draw_quad.c
index 03784bf2ccf..fa442aff38f 100644
--- a/src/gallium/auxiliary/util/u_draw_quad.c
+++ b/src/gallium/auxiliary/util/u_draw_quad.c
@@ -107,7 +107,7 @@ util_draw_texquad(struct pipe_context *pipe, struct cso_context *cso,
float *v = NULL;
v = MALLOC(vertexBytes);
- if (v == NULL)
+ if (!v)
goto out;
/*
diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h
index 384e267b593..57a3b0b6082 100644
--- a/src/gallium/auxiliary/util/u_inlines.h
+++ b/src/gallium/auxiliary/util/u_inlines.h
@@ -289,7 +289,7 @@ pipe_buffer_map_range(struct pipe_context *pipe,
u_box_1d(offset, length, &box);
map = pipe->transfer_map(pipe, buffer, 0, access, &box, transfer);
- if (map == NULL) {
+ if (!map) {
return NULL;
}
diff --git a/src/gallium/auxiliary/util/u_ringbuffer.c b/src/gallium/auxiliary/util/u_ringbuffer.c
index 5816b781660..19830a904e6 100644
--- a/src/gallium/auxiliary/util/u_ringbuffer.c
+++ b/src/gallium/auxiliary/util/u_ringbuffer.c
@@ -24,7 +24,7 @@ struct util_ringbuffer
struct util_ringbuffer *util_ringbuffer_create( unsigned dwords )
{
struct util_ringbuffer *ring = CALLOC_STRUCT(util_ringbuffer);
- if (ring == NULL)
+ if (!ring)
return NULL;
assert(util_is_power_of_two(dwords));
diff --git a/src/gallium/auxiliary/util/u_simple_shaders.c b/src/gallium/auxiliary/util/u_simple_shaders.c
index 6eed33769dd..7ffb2712472 100644
--- a/src/gallium/auxiliary/util/u_simple_shaders.c
+++ b/src/gallium/auxiliary/util/u_simple_shaders.c
@@ -80,7 +80,7 @@ util_make_vertex_passthrough_shader_with_so(struct pipe_context *pipe,
uint i;
ureg = ureg_create( TGSI_PROCESSOR_VERTEX );
- if (ureg == NULL)
+ if (!ureg)
return NULL;
if (window_space)
@@ -228,7 +228,7 @@ util_make_fragment_tex_shader_writemask(struct pipe_context *pipe,
interp_mode == TGSI_INTERPOLATE_PERSPECTIVE);
ureg = ureg_create( TGSI_PROCESSOR_FRAGMENT );
- if (ureg == NULL)
+ if (!ureg)
return NULL;
sampler = ureg_DECL_sampler( ureg, 0 );
@@ -298,7 +298,7 @@ util_make_fragment_tex_shader_writedepth(struct pipe_context *pipe,
struct ureg_src imm;
ureg = ureg_create( TGSI_PROCESSOR_FRAGMENT );
- if (ureg == NULL)
+ if (!ureg)
return NULL;
sampler = ureg_DECL_sampler( ureg, 0 );
@@ -350,7 +350,7 @@ util_make_fragment_tex_shader_writedepthstencil(struct pipe_context *pipe,
struct ureg_src imm;
ureg = ureg_create( TGSI_PROCESSOR_FRAGMENT );
- if (ureg == NULL)
+ if (!ureg)
return NULL;
depth_sampler = ureg_DECL_sampler( ureg, 0 );
@@ -414,7 +414,7 @@ util_make_fragment_tex_shader_writestencil(struct pipe_context *pipe,
struct ureg_src imm;
ureg = ureg_create( TGSI_PROCESSOR_FRAGMENT );
- if (ureg == NULL)
+ if (!ureg)
return NULL;
stencil_sampler = ureg_DECL_sampler( ureg, 0 );
@@ -494,7 +494,7 @@ void *
util_make_empty_fragment_shader(struct pipe_context *pipe)
{
struct ureg_program *ureg = ureg_create(TGSI_PROCESSOR_FRAGMENT);
- if (ureg == NULL)
+ if (!ureg)
return NULL;
ureg_END(ureg);
@@ -518,7 +518,7 @@ util_make_fragment_cloneinput_shader(struct pipe_context *pipe, int num_cbufs,
assert(num_cbufs <= PIPE_MAX_COLOR_BUFS);
ureg = ureg_create( TGSI_PROCESSOR_FRAGMENT );
- if (ureg == NULL)
+ if (!ureg)
return NULL;
src = ureg_DECL_fs_input( ureg, input_semantic, 0,
@@ -848,7 +848,7 @@ util_make_geometry_passthrough_shader(struct pipe_context *pipe,
unsigned i;
ureg = ureg_create(TGSI_PROCESSOR_GEOMETRY);
- if (ureg == NULL)
+ if (!ureg)
return NULL;
ureg_property(ureg, TGSI_PROPERTY_GS_INPUT_PRIM, PIPE_PRIM_POINTS);
diff --git a/src/gallium/auxiliary/util/u_transfer.c b/src/gallium/auxiliary/util/u_transfer.c
index 4cb524d5cb1..adae84bbfab 100644
--- a/src/gallium/auxiliary/util/u_transfer.c
+++ b/src/gallium/auxiliary/util/u_transfer.c
@@ -37,7 +37,7 @@ void u_default_transfer_inline_write( struct pipe_context *pipe,
level,
usage,
box, &transfer);
- if (map == NULL)
+ if (!map)
return;
if (resource->target == PIPE_BUFFER) {
diff --git a/src/gallium/auxiliary/util/u_upload_mgr.c b/src/gallium/auxiliary/util/u_upload_mgr.c
index 59207a1969b..b672fad6bf0 100644
--- a/src/gallium/auxiliary/util/u_upload_mgr.c
+++ b/src/gallium/auxiliary/util/u_upload_mgr.c
@@ -270,7 +270,7 @@ void u_upload_buffer(struct u_upload_mgr *upload,
PIPE_TRANSFER_READ,
&transfer);
- if (map == NULL) {
+ if (!map) {
pipe_resource_reference(outbuf, NULL);
return;
}
diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
index 9d0e4a1eae0..f5bb3a0106f 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
@@ -542,7 +542,7 @@ vl_mpeg12_get_decode_buffer(struct vl_mpeg12_decoder *dec, struct pipe_video_buf
return buffer;
buffer = CALLOC_STRUCT(vl_mpeg12_buffer);
- if (buffer == NULL)
+ if (!buffer)
return NULL;
if (!vl_vb_init(&buffer->vertex_stream, dec->context,