gallium/auxiliary: Sanitize NULL checks into canonical form
authorEdward O'Callaghan <eocallaghan@alterapraxis.com>
Fri, 4 Dec 2015 10:26:50 +0000 (21:26 +1100)
committerMarek Olšák <marek.olsak@amd.com>
Sun, 6 Dec 2015 16:10:23 +0000 (17:10 +0100)
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>
41 files changed:
src/gallium/auxiliary/cso_cache/cso_cache.c
src/gallium/auxiliary/cso_cache/cso_context.c
src/gallium/auxiliary/draw/draw_context.c
src/gallium/auxiliary/draw/draw_gs.c
src/gallium/auxiliary/draw/draw_llvm.c
src/gallium/auxiliary/draw/draw_pipe_aaline.c
src/gallium/auxiliary/draw/draw_pipe_aapoint.c
src/gallium/auxiliary/draw/draw_pipe_clip.c
src/gallium/auxiliary/draw/draw_pipe_cull.c
src/gallium/auxiliary/draw/draw_pipe_flatshade.c
src/gallium/auxiliary/draw/draw_pipe_offset.c
src/gallium/auxiliary/draw/draw_pipe_pstipple.c
src/gallium/auxiliary/draw/draw_pipe_stipple.c
src/gallium/auxiliary/draw/draw_pipe_twoside.c
src/gallium/auxiliary/draw/draw_pipe_unfilled.c
src/gallium/auxiliary/draw/draw_pipe_util.c
src/gallium/auxiliary/draw/draw_pipe_validate.c
src/gallium/auxiliary/draw/draw_pipe_vbuf.c
src/gallium/auxiliary/draw/draw_pipe_wide_line.c
src/gallium/auxiliary/draw/draw_pipe_wide_point.c
src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
src/gallium/auxiliary/draw/draw_vs.c
src/gallium/auxiliary/draw/draw_vs_exec.c
src/gallium/auxiliary/draw/draw_vs_llvm.c
src/gallium/auxiliary/draw/draw_vs_variant.c
src/gallium/auxiliary/gallivm/lp_bld_const.c
src/gallium/auxiliary/postprocess/pp_init.c
src/gallium/auxiliary/postprocess/pp_mlaa.c
src/gallium/auxiliary/postprocess/pp_run.c
src/gallium/auxiliary/tgsi/tgsi_sanity.c
src/gallium/auxiliary/tgsi/tgsi_ureg.c
src/gallium/auxiliary/translate/translate_cache.c
src/gallium/auxiliary/translate/translate_generic.c
src/gallium/auxiliary/translate/translate_sse.c
src/gallium/auxiliary/util/u_draw_quad.c
src/gallium/auxiliary/util/u_inlines.h
src/gallium/auxiliary/util/u_ringbuffer.c
src/gallium/auxiliary/util/u_simple_shaders.c
src/gallium/auxiliary/util/u_transfer.c
src/gallium/auxiliary/util/u_upload_mgr.c
src/gallium/auxiliary/vl/vl_mpeg12_decoder.c

index d36f1fbd717f9958183f3fa173ed62c82c997f87..b240c938dcc7154abaf4365796e18d09eb8e7a73 100644 (file)
@@ -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;
index 00686d2af41d88c85e10490f7edfc00957ffe8e2..6b29b20c53ec7a8d2acb4e6b7d9512d900d444d5 100644 (file)
@@ -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 =
index ee009c1fb7191a9a161693d55715344724688bb8..16a261c14cf6ce3390c9bf81f2003ffc2c530fd1 100644 (file)
@@ -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() */
index c827a68ea0a3bd16eafd691409de52c36364922d..6b33341ce6c659ea431e4936dda5d21b0e0e60f8 100644 (file)
@@ -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;
index 8435991fb6b908c9028c90ab56dc1693cd13df1e..ee974243b3ecc0987cc8941567c00a649e2182e9 100644 (file)
@@ -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;
index 85d24b7a6a106b174f0fa9c9d04a9839c4df8f63..337fb0fadda267ccf240973b43b8650adef40a37 100644 (file)
@@ -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;
    }
 
index 063e36828d7b70226cb7db56f37c4e788cba496b..33ef8ec1702bca8a5e44e094f40f97b16c3124b5 100644 (file)
@@ -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 */
index f2b56b017dded5b04b11382d5112ca67e9f99dd6..35e54f4a8beff4255406ee3bed766ff3f2c1d297 100644 (file)
@@ -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;
index fc8293bd1286ca272c58406ddc9d8c5522762462..240f55190f5f93553dba1339917fdfa448680e05 100644 (file)
@@ -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;
index 0ea740861d62461638cea641a5b2057a63dfbd6c..cd285e6f97c6cc564b33a0f7e0f2bc9040691816 100644 (file)
@@ -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;
index 5e0d8ce793db412fce9be0cb38ed64a309930382..f58e32b98a46e98fa5544d0b6848bd12b5c5dcda 100644 (file)
@@ -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;
index a51e91fe931522c480a647b3de392f4f5cdb35e3..b58d753078316e97fb0175daa69c325066156ea0 100644 (file)
@@ -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;
index 381aa41530b666723efb6cdbb03632a470c8527f..dcf05aac1d94b075d5261aa32f840131d3879e08 100644 (file)
@@ -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;
index 7f958d9b9850922d410491b19117976920adf55d..52d87c6b2917bc79ab14a460f188fd2f65098eda 100644 (file)
@@ -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;
index 8e6435cdbb4f28cacb74b5a7cea8492b07adc4bc..2517d610e713e22dac7fdfffaa8a6d012ceaa665 100644 (file)
@@ -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;
index cb8c732afe8dcc81940509e845067336429a8f3b..53a42a6a0e43c59bfc5ea7ee5e084bf09cea5372 100644 (file)
@@ -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 );
index e69d84a37cdfe0ef2035c30e9ece64c04cde5d68..01d07593d5c2caac6676474ba7b87cca47385868 100644 (file)
@@ -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;
index 5cc866d7eee565e067f6c45bc0048ddcfc17e41f..f36706cee0147ad09e3afbc1bce67866659f9454 100644 (file)
@@ -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;
index 38ac11a9adf3542ea7995998fcc16cce67bf9ee0..ae4a00eb630175ab055f425b7545b699d5061a52 100644 (file)
@@ -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;
index 348b0e93bbc3bfdf0f123d813cb4e6611d39baea..adb6120d834e2d9ed929b457df58789db88a0851 100644 (file)
@@ -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;
index b6966a52ea47430299168821585fc2efb1d6e335..c7b224a88f70257f704d9627dc98e4fec5447922 100644 (file)
@@ -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();
index 1501942eb443ab8a5123cc71b87e8a98ac60c074..438c9a6b9c4cb99c24810c86014c278f1d53a3a8 100644 (file)
@@ -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: 
index 17b54b6fe742c663d6d5cec28fea269f8620516b..abd64f5acd2ca20e65511ce9fd2beaad46813577 100644 (file)
@@ -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 */
index ac3999efc6826ffbaf7591387b91c30bcd70db38..c92e4317216c50ebedf5638e7aa7c2514d3988e1 100644 (file)
@@ -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 */
index ce3a608c1d1d379ef0e581478da40241a1b0782e..af36a86674d0df4328f263b552602c26385cda4a 100644 (file)
@@ -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;
index 9cd7c5553cf09f74c2a174f070537c72dde28d90..58fdcc94437bad160c1a72bdd974bb7c5d0b74f8 100644 (file)
@@ -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);
index bdf66e6d63a12e994feb52ae0f6c477bae99fb22..b9eff78bf4f5ccf839b8960b7fef029d8ae242db 100644 (file)
@@ -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;
    }
index 024a24895c8173a3e19a227c838118e0be642145..a3f58b52f4871183369aa0d3f72c291212adcb4a 100644 (file)
@@ -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;
    }
index caa2062f4cff65adabc17a73d7a3c1f92e5bc569..c6c7b88eea3f372f4c6605861f1f585450a05392 100644 (file)
@@ -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;
    }
index d14372feb30dc81998808f317394f432140dc4eb..88ecb2a31cbb80750c6a7ff11b0a067c0ab8675d 100644 (file)
@@ -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;
    }
index 4730472f40f6b2790bde6fa436425bdccab90111..4aaf8dfe6d8755f9d68c04eb1201234aa5c895ad 100644 (file)
@@ -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;
index 2bed02a454bb27317640de208675680da4c273b8..8aad7cdfb2b2c987445d4b47ee171bb5188f53b7 100644 (file)
@@ -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;
    }
 
index 45eb63231e3446ca4f49e8a48d9b3a7b31fba76c..3b460e11c3437428a94cd11c9940f81920ae2ad6 100644 (file)
@@ -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);
index c7b6c36fcfa29bf97770b497891bd4353a967854..b3c3b30596211196ca020d1affac9e0c4fd44ab9 100644 (file)
@@ -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));
index 03784bf2ccf79ff6a4a0865f5a45c776fa0cb03f..fa442aff38fbfb65fe777a02ebf25dec1089087f 100644 (file)
@@ -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;
 
    /*
index 384e267b593575e13c88eac6a931ca7de152e4f4..57a3b0b6082e6b0d7aa6c51ede66a521ac7e8ed8 100644 (file)
@@ -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;
    }
 
index 5816b781660a24550f01fe824577b722cc74922f..19830a904e684c9651e51079ac06e89e53258b26 100644 (file)
@@ -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));
index 6eed33769dd7ed84ae86a4ce88b30600b649e8fb..7ffb2712472760c55f4fe1d06b21170173a29e06 100644 (file)
@@ -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);
index 4cb524d5cb1b7a2fa1801cf42d2a8675dbe75506..adae84bbfab791a7f2d1825e7745956fbebef74f 100644 (file)
@@ -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) {
index 59207a1969b9b04e8a6dd973a7c1ab522fa41c29..b672fad6bf0aa5da87fdb4d0d57bd02ef15af67f 100644 (file)
@@ -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;
    }
index 9d0e4a1eae0f45ad2dd877d128aa807aed5b2c99..f5bb3a0106fe293bbd57957a096f2307a8533ea8 100644 (file)
@@ -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,