replace 0 with NULL for NULL pointers
authorThomas H.P. Andersen <phomes@gmail.com>
Mon, 2 Aug 2021 21:39:27 +0000 (23:39 +0200)
committerMarge Bot <emma+marge@anholt.net>
Mon, 10 Jan 2022 22:53:32 +0000 (22:53 +0000)
This updates many places where 0 is used as NULL pointer.

There are a few warnings left when I build the default
configuration but they either relate to code
outside of mesa or where "None" is used instead.

Found with static analysis (smatch)

Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12174>

39 files changed:
src/amd/common/ac_rtld.c
src/egl/main/eglapi.c
src/gallium/auxiliary/cso_cache/cso_hash.c
src/gallium/auxiliary/draw/draw_pipe_unfilled.c
src/gallium/auxiliary/pipebuffer/pb_buffer.h
src/gallium/auxiliary/rtasm/rtasm_execmem.c
src/gallium/auxiliary/tgsi/tgsi_ureg.c
src/gallium/auxiliary/util/u_blitter.c
src/gallium/drivers/nouveau/nouveau_screen.c
src/gallium/drivers/r300/compiler/r300_fragprog_swizzle.c
src/gallium/drivers/r300/compiler/r3xx_fragprog.c
src/gallium/drivers/r300/compiler/r3xx_vertprog.c
src/gallium/drivers/r300/compiler/radeon_dataflow_deadcode.c
src/gallium/drivers/r300/compiler/radeon_emulate_branches.c
src/gallium/drivers/r300/compiler/radeon_pair_schedule.c
src/gallium/drivers/r300/compiler/radeon_program_alu.c
src/gallium/drivers/r300/r300_state_derived.c
src/gallium/drivers/r300/r300_texture.c
src/gallium/drivers/svga/svga_pipe_flush.c
src/gallium/frontends/xa/xa_renderer.c
src/gallium/frontends/xa/xa_tgsi.c
src/gallium/winsys/sw/dri/dri_sw_winsys.c
src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c
src/gbm/backends/dri/gbm_driint.h
src/glx/dri2.c
src/glx/dri2_glx.c
src/glx/drisw_glx.c
src/glx/glxcurrent.c
src/glx/packrender.h
src/glx/packsingle.h
src/glx/query_renderer.c
src/glx/single2.c
src/mesa/main/bufferobj.c
src/mesa/main/extensions.c
src/mesa/main/glthread_draw.c
src/mesa/state_tracker/st_cb_texture.c
src/util/u_dynarray.h
src/util/u_mm.c
src/util/xmlconfig.c

index 790d417..dab2e25 100644 (file)
@@ -124,7 +124,7 @@ static const struct ac_rtld_symbol *find_symbol(const struct util_dynarray *symb
       if ((symbol->part_idx == ~0u || symbol->part_idx == part_idx) && !strcmp(name, symbol->name))
          return symbol;
    }
-   return 0;
+   return NULL;
 }
 
 static int compare_symbol_by_align(const void *lhsp, const void *rhsp)
index 437865d..76b296f 100644 (file)
@@ -1884,7 +1884,7 @@ static EGLSync EGLAPIENTRY
 eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *int_list)
 {
    _EGLDisplay *disp = _eglLockDisplay(dpy);
-   _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_FALSE);
+   _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, NULL);
 
    EGLSync sync;
    EGLAttrib *attrib_list;
@@ -1913,7 +1913,7 @@ static EGLSync EGLAPIENTRY
 eglCreateSync64KHR(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list)
 {
    _EGLDisplay *disp = _eglLockDisplay(dpy);
-   _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_FALSE);
+   _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, NULL);
    return _eglCreateSync(disp, type, attrib_list, EGL_TRUE,
                          EGL_BAD_ATTRIBUTE);
 }
@@ -1923,7 +1923,7 @@ EGLSync EGLAPIENTRY
 eglCreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list)
 {
    _EGLDisplay *disp = _eglLockDisplay(dpy);
-   _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_FALSE);
+   _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, NULL);
    return _eglCreateSync(disp, type, attrib_list, EGL_TRUE,
                          EGL_BAD_PARAMETER);
 }
@@ -2197,7 +2197,7 @@ eglCreateDRMImageMESA(EGLDisplay dpy, const EGLint *attr_list)
    _EGLImage *img;
    EGLImage ret;
 
-   _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_FALSE);
+   _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, NULL);
 
    _EGL_CHECK_DISPLAY(disp, EGL_NO_IMAGE_KHR);
    if (!disp->Extensions.MESA_drm_image)
@@ -2299,7 +2299,7 @@ eglCreateWaylandBufferFromImageWL(EGLDisplay dpy, EGLImage image)
    _EGLImage *img;
    struct wl_buffer *ret;
 
-   _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_FALSE);
+   _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, NULL);
 
    _EGL_CHECK_DISPLAY(disp, NULL);
    if (!disp->Extensions.WL_create_wayland_buffer_from_image)
index dae3a2d..0ae1bfd 100644 (file)
@@ -178,7 +178,7 @@ struct cso_hash_iter cso_hash_insert(struct cso_hash *hash,
    struct cso_node **nextNode = cso_hash_find_node(hash, key);
    struct cso_node *node = cso_hash_create_node(hash, key, data, nextNode);
    if (!node) {
-      struct cso_hash_iter null_iter = {hash, 0};
+      struct cso_hash_iter null_iter = {hash, NULL};
       return null_iter;
    }
 
@@ -188,8 +188,8 @@ struct cso_hash_iter cso_hash_insert(struct cso_hash *hash,
 
 void cso_hash_init(struct cso_hash *hash)
 {
-   hash->fakeNext = 0;
-   hash->buckets = 0;
+   hash->fakeNext = NULL;
+   hash->buckets = NULL;
    hash->size = 0;
    hash->userNumBits = (short)MinNumBits;
    hash->numBits = 0;
index f39db0e..5af2fdf 100644 (file)
@@ -253,11 +253,11 @@ draw_unfilled_prepare_outputs( struct draw_context *draw,
                                struct draw_stage *stage )
 {
    struct unfilled_stage *unfilled = unfilled_stage(stage);
-   const struct pipe_rasterizer_state *rast = draw ? draw->rasterizer : 0;
+   const struct pipe_rasterizer_state *rast = draw ? draw->rasterizer : NULL;
    boolean is_unfilled = (rast &&
                           (rast->fill_front != PIPE_POLYGON_MODE_FILL ||
                            rast->fill_back != PIPE_POLYGON_MODE_FILL));
-   const struct draw_fragment_shader *fs = draw ? draw->fs.fragment_shader : 0;
+   const struct draw_fragment_shader *fs = draw ? draw->fs.fragment_shader : NULL;
 
    if (is_unfilled && fs && fs->info.uses_frontface)  {
       unfilled->face_slot = draw_alloc_extra_vertex_attrib(
index 7e3e8a4..7d0d756 100644 (file)
@@ -215,7 +215,7 @@ pb_get_base_buffer(struct pb_buffer *buf,
    assert(buf);
    if (!buf) {
       base_buf = NULL;
-      offset = 0;
+      offset = NULL;
       return;
    }
    assert(pipe_is_referenced(&buf->reference));
index fcb67a6..58b1db3 100644 (file)
@@ -76,7 +76,7 @@ init_heap(void)
       exec_heap = u_mmInit( 0, EXEC_HEAP_SIZE );
    
    if (!exec_mem)
-      exec_mem = (unsigned char *) mmap(0, EXEC_HEAP_SIZE, 
+      exec_mem = (unsigned char *) mmap(NULL, EXEC_HEAP_SIZE,
                                        PROT_EXEC | PROT_READ | PROT_WRITE, 
                                        MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
 
index ceb93c4..66a2a26 100644 (file)
@@ -2192,7 +2192,7 @@ const struct tgsi_token *ureg_get_tokens( struct ureg_program *ureg,
    if (nr_tokens)
       *nr_tokens = ureg->domain[DOMAIN_DECL].count;
 
-   ureg->domain[DOMAIN_DECL].tokens = 0;
+   ureg->domain[DOMAIN_DECL].tokens = NULL;
    ureg->domain[DOMAIN_DECL].size = 0;
    ureg->domain[DOMAIN_DECL].order = 0;
    ureg->domain[DOMAIN_DECL].count = 0;
index 3eae80e..593f895 100644 (file)
@@ -2369,7 +2369,7 @@ void util_blitter_clear_render_target(struct blitter_context *blitter,
    fb_state.height = dstsurf->height;
    fb_state.nr_cbufs = 1;
    fb_state.cbufs[0] = dstsurf;
-   fb_state.zsbuf = 0;
+   fb_state.zsbuf = NULL;
    pipe->set_framebuffer_state(pipe, &fb_state);
    pipe->set_sample_mask(pipe, ~0);
    if (pipe->set_min_samples)
@@ -2453,7 +2453,7 @@ void util_blitter_clear_depth_stencil(struct blitter_context *blitter,
    fb_state.width = dstsurf->width;
    fb_state.height = dstsurf->height;
    fb_state.nr_cbufs = 0;
-   fb_state.cbufs[0] = 0;
+   fb_state.cbufs[0] = NULL;
    fb_state.zsbuf = dstsurf;
    pipe->set_framebuffer_state(pipe, &fb_state);
    pipe->set_sample_mask(pipe, ~0);
@@ -2780,7 +2780,7 @@ void util_blitter_custom_color(struct blitter_context *blitter,
    fb_state.height = dstsurf->height;
    fb_state.nr_cbufs = 1;
    fb_state.cbufs[0] = dstsurf;
-   fb_state.zsbuf = 0;
+   fb_state.zsbuf = NULL;
    pipe->set_framebuffer_state(pipe, &fb_state);
    pipe->set_sample_mask(pipe, ~0);
    if (pipe->set_min_samples)
index 192044c..2f6eb80 100644 (file)
@@ -99,7 +99,7 @@ nouveau_screen_bo_from_handle(struct pipe_screen *pscreen,
                               unsigned *out_stride)
 {
    struct nouveau_device *dev = nouveau_screen(pscreen)->device;
-   struct nouveau_bo *bo = 0;
+   struct nouveau_bo *bo = NULL;
    int ret;
 
    if (whandle->offset != 0) {
index da2a484..4e8fdf5 100644 (file)
@@ -86,7 +86,7 @@ static const struct swizzle_data* lookup_native_swizzle(unsigned int swizzle)
                        return sd;
        }
 
-       return 0;
+       return NULL;
 }
 
 /**
index 0a91585..8aa4ef9 100644 (file)
@@ -87,31 +87,31 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c)
        /* Lists of instruction transformations. */
        struct radeon_program_transformation force_alpha_to_one[] = {
                { &rc_force_output_alpha_to_one, c },
-               { 0, 0 }
+               { NULL, NULL }
        };
 
        struct radeon_program_transformation rewrite_tex[] = {
                { &radeonTransformTEX, c },
-               { 0, 0 }
+               { NULL, NULL }
        };
 
        struct radeon_program_transformation rewrite_if[] = {
-               { &r500_transform_IF, 0 },
-               {0, 0}
+               { &r500_transform_IF, NULL },
+               { NULL, NULL }
        };
 
        struct radeon_program_transformation native_rewrite_r500[] = {
-               { &radeonTransformALU, 0 },
-               { &radeonTransformDeriv, 0 },
-               { &radeonTransformTrigScale, 0 },
-               { 0, 0 }
+               { &radeonTransformALU, NULL },
+               { &radeonTransformDeriv, NULL },
+               { &radeonTransformTrigScale, NULL },
+               { NULL, NULL }
        };
 
        struct radeon_program_transformation native_rewrite_r300[] = {
-               { &radeonTransformALU, 0 },
-               { &radeonStubDeriv, 0 },
-               { &r300_transform_trig_simple, 0 },
-               { 0, 0 }
+               { &radeonTransformALU, NULL },
+               { &radeonStubDeriv, NULL },
+               { &r300_transform_trig_simple, NULL },
+               { NULL, NULL }
        };
 
        /* List of compiler passes. */
index 42d7af4..de0d982 100644 (file)
@@ -865,7 +865,7 @@ static void rc_emulate_negative_addressing(struct radeon_compiler *compiler, voi
 
 const struct rc_swizzle_caps r300_vertprog_swizzle_caps = {
        .IsNative = &swizzle_is_native,
-       .Split = 0 /* should never be called */
+       .Split = NULL /* should never be called */
 };
 
 void r3xx_compile_vertex_program(struct r300_vertex_program_compiler *c)
@@ -875,15 +875,15 @@ void r3xx_compile_vertex_program(struct r300_vertex_program_compiler *c)
 
        /* Lists of instruction transformations. */
        struct radeon_program_transformation alu_rewrite_r500[] = {
-               { &r300_transform_vertex_alu, 0 },
-               { &r300_transform_trig_scale_vertex, 0 },
-               { 0, 0 }
+               { &r300_transform_vertex_alu, NULL },
+               { &r300_transform_trig_scale_vertex, NULL },
+               { NULL, NULL }
        };
 
        struct radeon_program_transformation alu_rewrite_r300[] = {
-               { &r300_transform_vertex_alu, 0 },
-               { &r300_transform_trig_simple, 0 },
-               { 0, 0 }
+               { &r300_transform_vertex_alu, NULL },
+               { &r300_transform_trig_simple, NULL },
+               { NULL, NULL }
        };
 
        /* Note: These passes have to be done seperately from ALU rewrite,
@@ -891,13 +891,13 @@ void r3xx_compile_vertex_program(struct r300_vertex_program_compiler *c)
         * or non-native modifiers will not be treated properly.
         */
        struct radeon_program_transformation emulate_modifiers[] = {
-               { &transform_nonnative_modifiers, 0 },
-               { 0, 0 }
+               { &transform_nonnative_modifiers, NULL },
+               { NULL, NULL }
        };
 
        struct radeon_program_transformation resolve_src_conflicts[] = {
-               { &transform_source_conflicts, 0 },
-               { 0, 0 }
+               { &transform_source_conflicts, NULL },
+               { NULL, NULL }
        };
 
        /* List of compiler passes. */
index 708e3e9..44fc133 100644 (file)
@@ -121,7 +121,7 @@ static unsigned char * get_used_ptr(struct deadcode_state *s, rc_register_file f
        if (file == RC_FILE_OUTPUT || file == RC_FILE_TEMPORARY) {
                if (index >= RC_REGISTER_MAX_INDEX) {
                        rc_error(s->C, "%s: index %i is out of bounds for file %i\n", __FUNCTION__, index, file);
-                       return 0;
+                       return NULL;
                }
 
                if (file == RC_FILE_OUTPUT)
@@ -133,13 +133,13 @@ static unsigned char * get_used_ptr(struct deadcode_state *s, rc_register_file f
        } else if (file == RC_FILE_SPECIAL) {
                if (index >= RC_NUM_SPECIAL_REGISTERS) {
                        rc_error(s->C, "%s: special file index %i out of bounds\n", __FUNCTION__, index);
-                       return 0;
+                       return NULL;
                }
 
                return &s->R.Special[index];
        }
 
-       return 0;
+       return NULL;
 }
 
 static void mark_used(struct deadcode_state * s, rc_register_file file, unsigned int index, unsigned int mask)
index 7bede34..eab0d7e 100644 (file)
@@ -112,7 +112,7 @@ static struct proxy_info * get_proxy_info(struct state_and_proxies * sap,
        if (file == RC_FILE_TEMPORARY) {
                return &sap->Proxies->Temporary[index];
        } else {
-               return 0;
+               return NULL;
        }
 }
 
index 579bd30..9e00814 100644 (file)
@@ -161,11 +161,11 @@ static struct reg_value ** get_reg_valuep(struct schedule_state * s,
                rc_register_file file, unsigned int index, unsigned int chan)
 {
        if (file != RC_FILE_TEMPORARY)
-               return 0;
+               return NULL;
 
        if (index >= RC_REGISTER_MAX_INDEX) {
                rc_error(s->C, "%s: index %i out of bounds\n", __FUNCTION__, index);
-               return 0;
+               return NULL;
        }
 
        return &s->Temporary[index].Values[chan];
@@ -477,7 +477,7 @@ static void emit_all_tex(struct schedule_state * s, struct rc_instruction * befo
                readytex = readytex->NextReady;
        }
        readytex = s->ReadyTEX;
-       s->ReadyTEX = 0;
+       s->ReadyTEX = NULL;
        while(readytex){
                DBG("%i: commit TEX writes\n", readytex->Instruction->IP);
                commit_update_writes(s, readytex);
index a253d9b..04c662f 100644 (file)
@@ -240,7 +240,7 @@ static void transform_CEIL(struct radeon_compiler* c,
         */
 
        struct rc_dst_register dst = try_to_reuse_dst(c, inst);
-       emit1(c, inst->Prev, RC_OPCODE_FRC, 0, dst, negate(inst->U.I.SrcReg[0]));
+       emit1(c, inst->Prev, RC_OPCODE_FRC, NULL, dst, negate(inst->U.I.SrcReg[0]));
        emit2(c, inst->Prev, RC_OPCODE_ADD, &inst->U.I, inst->U.I.DstReg,
                inst->U.I.SrcReg[0], srcreg(RC_FILE_TEMPORARY, dst.Index));
        rc_remove_instruction(inst);
@@ -278,7 +278,7 @@ static void transform_FLR(struct radeon_compiler* c,
        struct rc_instruction* inst)
 {
        struct rc_dst_register dst = try_to_reuse_dst(c, inst);
-       emit1(c, inst->Prev, RC_OPCODE_FRC, 0, dst, inst->U.I.SrcReg[0]);
+       emit1(c, inst->Prev, RC_OPCODE_FRC, NULL, dst, inst->U.I.SrcReg[0]);
        emit2(c, inst->Prev, RC_OPCODE_ADD, &inst->U.I, inst->U.I.DstReg,
                inst->U.I.SrcReg[0], negate(srcreg(RC_FILE_TEMPORARY, dst.Index)));
        rc_remove_instruction(inst);
@@ -294,8 +294,8 @@ static void transform_TRUNC(struct radeon_compiler* c,
         *   y * sgn(x) = (x < 0 ? -y : y)
         */
        struct rc_dst_register dst = try_to_reuse_dst(c, inst);
-       emit1(c, inst->Prev, RC_OPCODE_FRC, 0, dst, absolute(inst->U.I.SrcReg[0]));
-       emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dst, absolute(inst->U.I.SrcReg[0]),
+       emit1(c, inst->Prev, RC_OPCODE_FRC, NULL, dst, absolute(inst->U.I.SrcReg[0]));
+       emit2(c, inst->Prev, RC_OPCODE_ADD, NULL, dst, absolute(inst->U.I.SrcReg[0]),
              negate(srcreg(RC_FILE_TEMPORARY, dst.Index)));
        emit3(c, inst->Prev, RC_OPCODE_CMP, &inst->U.I, inst->U.I.DstReg, inst->U.I.SrcReg[0],
              negate(srcreg(RC_FILE_TEMPORARY, dst.Index)), srcreg(RC_FILE_TEMPORARY, dst.Index));
@@ -334,7 +334,7 @@ static void transform_LIT(struct radeon_compiler* c,
                struct rc_instruction * inst_mov;
 
                inst_mov = emit1(c, inst,
-                       RC_OPCODE_MOV, 0, inst->U.I.DstReg,
+                       RC_OPCODE_MOV, NULL, inst->U.I.DstReg,
                        srcreg(RC_FILE_TEMPORARY, rc_find_free_temporary(c)));
 
                inst->U.I.DstReg.File = RC_FILE_TEMPORARY;
@@ -348,25 +348,25 @@ static void transform_LIT(struct radeon_compiler* c,
        /* tmp.x = max(0.0, Src.x); */
        /* tmp.y = max(0.0, Src.y); */
        /* tmp.w = clamp(Src.z, -128+eps, 128-eps); */
-       emit2(c, inst->Prev, RC_OPCODE_MAX, 0,
+       emit2(c, inst->Prev, RC_OPCODE_MAX, NULL,
                dstregtmpmask(temp, RC_MASK_XYW),
                inst->U.I.SrcReg[0],
                swizzle(srcreg(RC_FILE_CONSTANT, constant),
                        RC_SWIZZLE_ZERO, RC_SWIZZLE_ZERO, RC_SWIZZLE_ZERO, constant_swizzle&3));
-       emit2(c, inst->Prev, RC_OPCODE_MIN, 0,
+       emit2(c, inst->Prev, RC_OPCODE_MIN, NULL,
                dstregtmpmask(temp, RC_MASK_Z),
                swizzle_wwww(srctemp),
                negate(srcregswz(RC_FILE_CONSTANT, constant, constant_swizzle)));
 
        /* tmp.w = Pow(tmp.y, tmp.w) */
-       emit1(c, inst->Prev, RC_OPCODE_LG2, 0,
+       emit1(c, inst->Prev, RC_OPCODE_LG2, NULL,
                dstregtmpmask(temp, RC_MASK_W),
                swizzle_yyyy(srctemp));
-       emit2(c, inst->Prev, RC_OPCODE_MUL, 0,
+       emit2(c, inst->Prev, RC_OPCODE_MUL, NULL,
                dstregtmpmask(temp, RC_MASK_W),
                swizzle_wwww(srctemp),
                swizzle_zzzz(srctemp));
-       emit1(c, inst->Prev, RC_OPCODE_EX2, 0,
+       emit1(c, inst->Prev, RC_OPCODE_EX2, NULL,
                dstregtmpmask(temp, RC_MASK_W),
                swizzle_wwww(srctemp));
 
@@ -390,7 +390,7 @@ static void transform_LRP(struct radeon_compiler* c,
 {
        struct rc_dst_register dst = try_to_reuse_dst(c, inst);
 
-       emit3(c, inst->Prev, RC_OPCODE_MAD, 0,
+       emit3(c, inst->Prev, RC_OPCODE_ADD, NULL,
                dst,
                negate(inst->U.I.SrcReg[0]), inst->U.I.SrcReg[2], inst->U.I.SrcReg[2]);
        emit3(c, inst->Prev, RC_OPCODE_MAD, &inst->U.I,
@@ -408,8 +408,8 @@ static void transform_POW(struct radeon_compiler* c,
        tempdst.WriteMask = RC_MASK_W;
        tempsrc.Swizzle = RC_SWIZZLE_WWWW;
 
-       emit1(c, inst->Prev, RC_OPCODE_LG2, 0, tempdst, swizzle_xxxx(inst->U.I.SrcReg[0]));
-       emit2(c, inst->Prev, RC_OPCODE_MUL, 0, tempdst, tempsrc, swizzle_xxxx(inst->U.I.SrcReg[1]));
+       emit1(c, inst->Prev, RC_OPCODE_LG2, NULL, tempdst, swizzle_xxxx(inst->U.I.SrcReg[0]));
+       emit2(c, inst->Prev, RC_OPCODE_MUL, NULL, tempdst, tempsrc, swizzle_xxxx(inst->U.I.SrcReg[1]));
        emit1(c, inst->Prev, RC_OPCODE_EX2, &inst->U.I, inst->U.I.DstReg, tempsrc);
 
        rc_remove_instruction(inst);
@@ -435,7 +435,7 @@ static void transform_ROUND(struct radeon_compiler* c,
        /* add = src + .5 */
        add_index = rc_find_free_temporary(c);
        add_dst = dstregtmpmask(add_index, mask);
-       emit2(c, inst->Prev, RC_OPCODE_ADD, 0, add_dst, inst->U.I.SrcReg[0],
+       emit2(c, inst->Prev, RC_OPCODE_ADD, NULL, add_dst, inst->U.I.SrcReg[0],
                                                                builtin_half);
        add_src = srcreg(RC_FILE_TEMPORARY, add_dst.Index);
 
@@ -443,11 +443,11 @@ static void transform_ROUND(struct radeon_compiler* c,
        /* frac = FRC(add) */
        frac_index = rc_find_free_temporary(c);
        frac_dst = dstregtmpmask(frac_index, mask);
-       emit1(c, inst->Prev, RC_OPCODE_FRC, 0, frac_dst, add_src);
+       emit1(c, inst->Prev, RC_OPCODE_FRC, NULL, frac_dst, add_src);
        frac_src = srcreg(RC_FILE_TEMPORARY, frac_dst.Index);
 
        /* dst = add - frac */
-       emit2(c, inst->Prev, RC_OPCODE_ADD, 0, inst->U.I.DstReg,
+       emit2(c, inst->Prev, RC_OPCODE_ADD, NULL, inst->U.I.DstReg,
                                                add_src, negate(frac_src));
        rc_remove_instruction(inst);
 }
@@ -463,7 +463,7 @@ static void transform_SEQ(struct radeon_compiler* c,
 {
        struct rc_dst_register dst = try_to_reuse_dst(c, inst);
 
-       emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dst, inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1]));
+       emit2(c, inst->Prev, RC_OPCODE_ADD, NULL, dst, inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1]));
        emit3(c, inst->Prev, RC_OPCODE_CMP, &inst->U.I, inst->U.I.DstReg,
                negate(absolute(srcreg(RC_FILE_TEMPORARY, dst.Index))), builtin_zero, builtin_one);
 
@@ -475,7 +475,7 @@ static void transform_SGE(struct radeon_compiler* c,
 {
        struct rc_dst_register dst = try_to_reuse_dst(c, inst);
 
-       emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dst, inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1]));
+       emit2(c, inst->Prev, RC_OPCODE_ADD, NULL, dst, inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1]));
        emit3(c, inst->Prev, RC_OPCODE_CMP, &inst->U.I, inst->U.I.DstReg,
                srcreg(RC_FILE_TEMPORARY, dst.Index), builtin_zero, builtin_one);
 
@@ -487,7 +487,7 @@ static void transform_SGT(struct radeon_compiler* c,
 {
        struct rc_dst_register dst = try_to_reuse_dst(c, inst);
 
-       emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dst, negate(inst->U.I.SrcReg[0]), inst->U.I.SrcReg[1]);
+       emit2(c, inst->Prev, RC_OPCODE_ADD, NULL, dst, negate(inst->U.I.SrcReg[0]), inst->U.I.SrcReg[1]);
        emit3(c, inst->Prev, RC_OPCODE_CMP, &inst->U.I, inst->U.I.DstReg,
                srcreg(RC_FILE_TEMPORARY, dst.Index), builtin_one, builtin_zero);
 
@@ -499,7 +499,7 @@ static void transform_SLE(struct radeon_compiler* c,
 {
        struct rc_dst_register dst = try_to_reuse_dst(c, inst);
 
-       emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dst, negate(inst->U.I.SrcReg[0]), inst->U.I.SrcReg[1]);
+       emit2(c, inst->Prev, RC_OPCODE_ADD, NULL, dst, negate(inst->U.I.SrcReg[0]), inst->U.I.SrcReg[1]);
        emit3(c, inst->Prev, RC_OPCODE_CMP, &inst->U.I, inst->U.I.DstReg,
                srcreg(RC_FILE_TEMPORARY, dst.Index), builtin_zero, builtin_one);
 
@@ -511,7 +511,7 @@ static void transform_SLT(struct radeon_compiler* c,
 {
        struct rc_dst_register dst = try_to_reuse_dst(c, inst);
 
-       emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dst, inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1]));
+       emit2(c, inst->Prev, RC_OPCODE_ADD, NULL, dst, inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1]));
        emit3(c, inst->Prev, RC_OPCODE_CMP, &inst->U.I, inst->U.I.DstReg,
                srcreg(RC_FILE_TEMPORARY, dst.Index), builtin_one, builtin_zero);
 
@@ -523,7 +523,7 @@ static void transform_SNE(struct radeon_compiler* c,
 {
        struct rc_dst_register dst = try_to_reuse_dst(c, inst);
 
-       emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dst, inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1]));
+       emit2(c, inst->Prev, RC_OPCODE_ADD, NULL, dst, inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1]));
        emit3(c, inst->Prev, RC_OPCODE_CMP, &inst->U.I, inst->U.I.DstReg,
                negate(absolute(srcreg(RC_FILE_TEMPORARY, dst.Index))), builtin_one, builtin_zero);
 
@@ -544,7 +544,7 @@ static void transform_SSG(struct radeon_compiler* c,
 
        /* 0 < x */
        dst0 = try_to_reuse_dst(c, inst);
-       emit3(c, inst->Prev, RC_OPCODE_CMP, 0,
+       emit3(c, inst->Prev, RC_OPCODE_CMP, NULL,
              dst0,
              negate(inst->U.I.SrcReg[0]),
              builtin_one,
@@ -552,7 +552,7 @@ static void transform_SSG(struct radeon_compiler* c,
 
        /* x < 0 */
        tmp1 = rc_find_free_temporary(c);
-       emit3(c, inst->Prev, RC_OPCODE_CMP, 0,
+       emit3(c, inst->Prev, RC_OPCODE_CMP, NULL,
              dstregtmpmask(tmp1, inst->U.I.DstReg.WriteMask),
              inst->U.I.SrcReg[0],
              builtin_one,
@@ -560,7 +560,7 @@ static void transform_SSG(struct radeon_compiler* c,
 
        /* Either both are zero, or one of them is one and the other is zero. */
        /* result = tmp0 - tmp1 */
-       emit2(c, inst->Prev, RC_OPCODE_ADD, 0,
+       emit2(c, inst->Prev, RC_OPCODE_ADD, NULL,
              inst->U.I.DstReg,
              srcreg(RC_FILE_TEMPORARY, dst0.Index),
              negate(srcreg(RC_FILE_TEMPORARY, tmp1)));
@@ -634,13 +634,13 @@ static void transform_r300_vertex_CMP(struct radeon_compiler* c,
        struct rc_dst_register dst = try_to_reuse_dst(c, inst);
 
        /* SLT tmp0, src0, 0.0 */
-       emit2(c, inst->Prev, RC_OPCODE_SLT, 0,
+       emit2(c, inst->Prev, RC_OPCODE_SLT, NULL,
                dst,
                inst->U.I.SrcReg[0], builtin_zero);
 
        /* LRP dst, tmp0, src1, src2 */
        transform_LRP(c,
-               emit3(c, inst->Prev, RC_OPCODE_LRP, 0,
+               emit3(c, inst->Prev, RC_OPCODE_LRP, NULL,
                      inst->U.I.DstReg,
                      srcreg(RC_FILE_TEMPORARY, dst.Index), inst->U.I.SrcReg[1],  inst->U.I.SrcReg[2]));
 
@@ -681,12 +681,12 @@ static void transform_r300_vertex_fix_LIT(struct radeon_compiler* c,
 
        /* MOV dst, src */
        dst.WriteMask = RC_MASK_XYZW;
-       emit1(c, inst->Prev, RC_OPCODE_MOV, 0,
+       emit1(c, inst->Prev, RC_OPCODE_MOV, NULL,
                dst,
                inst->U.I.SrcReg[0]);
 
        /* MAX dst.y, src, 0.00...001 */
-       emit2(c, inst->Prev, RC_OPCODE_MAX, 0,
+       emit2(c, inst->Prev, RC_OPCODE_MAX, NULL,
                dstregtmpmask(dst.Index, RC_MASK_Y),
                srcreg(RC_FILE_TEMPORARY, dst.Index),
                srcregswz(RC_FILE_CONSTANT, constant, constant_swizzle));
@@ -701,19 +701,19 @@ static void transform_r300_vertex_SEQ(struct radeon_compiler *c,
        int tmp = rc_find_free_temporary(c);
 
        /* x <= y */
-       emit2(c, inst->Prev, RC_OPCODE_SGE, 0,
+       emit2(c, inst->Prev, RC_OPCODE_SGE, NULL,
              dstregtmpmask(tmp, inst->U.I.DstReg.WriteMask),
              inst->U.I.SrcReg[0],
              inst->U.I.SrcReg[1]);
 
        /* y <= x */
-       emit2(c, inst->Prev, RC_OPCODE_SGE, 0,
+       emit2(c, inst->Prev, RC_OPCODE_SGE, NULL,
              inst->U.I.DstReg,
              inst->U.I.SrcReg[1],
              inst->U.I.SrcReg[0]);
 
        /* x && y  =  x * y */
-       emit2(c, inst->Prev, RC_OPCODE_MUL, 0,
+       emit2(c, inst->Prev, RC_OPCODE_MUL, NULL,
              inst->U.I.DstReg,
              srcreg(RC_FILE_TEMPORARY, tmp),
              srcreg(inst->U.I.DstReg.File, inst->U.I.DstReg.Index));
@@ -728,19 +728,19 @@ static void transform_r300_vertex_SNE(struct radeon_compiler *c,
        int tmp = rc_find_free_temporary(c);
 
        /* x < y */
-       emit2(c, inst->Prev, RC_OPCODE_SLT, 0,
+       emit2(c, inst->Prev, RC_OPCODE_SLT, NULL,
              dstregtmpmask(tmp, inst->U.I.DstReg.WriteMask),
              inst->U.I.SrcReg[0],
              inst->U.I.SrcReg[1]);
 
        /* y < x */
-       emit2(c, inst->Prev, RC_OPCODE_SLT, 0,
+       emit2(c, inst->Prev, RC_OPCODE_SLT, NULL,
              inst->U.I.DstReg,
              inst->U.I.SrcReg[1],
              inst->U.I.SrcReg[0]);
 
        /* x || y  =  max(x, y) */
-       emit2(c, inst->Prev, RC_OPCODE_MAX, 0,
+       emit2(c, inst->Prev, RC_OPCODE_MAX, NULL,
              inst->U.I.DstReg,
              srcreg(RC_FILE_TEMPORARY, tmp),
              srcreg(inst->U.I.DstReg.File, inst->U.I.DstReg.Index));
@@ -780,21 +780,21 @@ static void transform_r300_vertex_SSG(struct radeon_compiler* c,
 
        /* 0 < x */
        dst0 = try_to_reuse_dst(c, inst);
-       emit2(c, inst->Prev, RC_OPCODE_SLT, 0,
+       emit2(c, inst->Prev, RC_OPCODE_SLT, NULL,
              dst0,
              builtin_zero,
              inst->U.I.SrcReg[0]);
 
        /* x < 0 */
        tmp1 = rc_find_free_temporary(c);
-       emit2(c, inst->Prev, RC_OPCODE_SLT, 0,
+       emit2(c, inst->Prev, RC_OPCODE_SLT, NULL,
              dstregtmpmask(tmp1, inst->U.I.DstReg.WriteMask),
              inst->U.I.SrcReg[0],
              builtin_zero);
 
        /* Either both are zero, or one of them is one and the other is zero. */
        /* result = tmp0 - tmp1 */
-       emit2(c, inst->Prev, RC_OPCODE_ADD, 0,
+       emit2(c, inst->Prev, RC_OPCODE_ADD, NULL,
              inst->U.I.DstReg,
              srcreg(RC_FILE_TEMPORARY, dst0.Index),
              negate(srcreg(RC_FILE_TEMPORARY, tmp1)));
@@ -888,18 +888,18 @@ static void sin_approx(
 {
        unsigned int tempreg = rc_find_free_temporary(c);
 
-       emit2(c, inst->Prev, RC_OPCODE_MUL, 0, dstregtmpmask(tempreg, RC_MASK_XY),
+       emit2(c, inst->Prev, RC_OPCODE_MUL, NULL, dstregtmpmask(tempreg, RC_MASK_XY),
                swizzle_xxxx(src),
                srcreg(RC_FILE_CONSTANT, constants[0]));
-       emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_X),
+       emit3(c, inst->Prev, RC_OPCODE_MAD, NULL, dstregtmpmask(tempreg, RC_MASK_X),
                swizzle_yyyy(srcreg(RC_FILE_TEMPORARY, tempreg)),
                absolute(swizzle_xxxx(src)),
                swizzle_xxxx(srcreg(RC_FILE_TEMPORARY, tempreg)));
-       emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_Y),
+       emit3(c, inst->Prev, RC_OPCODE_MAD, NULL, dstregtmpmask(tempreg, RC_MASK_Y),
                swizzle_xxxx(srcreg(RC_FILE_TEMPORARY, tempreg)),
                absolute(swizzle_xxxx(srcreg(RC_FILE_TEMPORARY, tempreg))),
                negate(swizzle_xxxx(srcreg(RC_FILE_TEMPORARY, tempreg))));
-       emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dst,
+       emit3(c, inst->Prev, RC_OPCODE_MAD, NULL, dst,
                swizzle_yyyy(srcreg(RC_FILE_TEMPORARY, tempreg)),
                swizzle_wwww(srcreg(RC_FILE_CONSTANT, constants[0])),
                swizzle_xxxx(srcreg(RC_FILE_TEMPORARY, tempreg)));
@@ -929,13 +929,13 @@ int r300_transform_trig_simple(struct radeon_compiler* c,
                /* MAD tmp.x, src, 1/(2*PI), 0.75 */
                /* FRC tmp.x, tmp.x */
                /* MAD tmp.z, tmp.x, 2*PI, -PI */
-               emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_W),
+               emit3(c, inst->Prev, RC_OPCODE_MAD, NULL, dstregtmpmask(tempreg, RC_MASK_W),
                        swizzle_xxxx(inst->U.I.SrcReg[0]),
                        swizzle_zzzz(srcreg(RC_FILE_CONSTANT, constants[1])),
                        swizzle_xxxx(srcreg(RC_FILE_CONSTANT, constants[1])));
-               emit1(c, inst->Prev, RC_OPCODE_FRC, 0, dstregtmpmask(tempreg, RC_MASK_W),
+               emit1(c, inst->Prev, RC_OPCODE_FRC, NULL, dstregtmpmask(tempreg, RC_MASK_W),
                        swizzle_wwww(srcreg(RC_FILE_TEMPORARY, tempreg)));
-               emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_W),
+               emit3(c, inst->Prev, RC_OPCODE_MAD, NULL, dstregtmpmask(tempreg, RC_MASK_W),
                        swizzle_wwww(srcreg(RC_FILE_TEMPORARY, tempreg)),
                        swizzle_wwww(srcreg(RC_FILE_CONSTANT, constants[1])),
                        negate(swizzle_zzzz(srcreg(RC_FILE_CONSTANT, constants[0]))));
@@ -944,13 +944,13 @@ int r300_transform_trig_simple(struct radeon_compiler* c,
                        swizzle_wwww(srcreg(RC_FILE_TEMPORARY, tempreg)),
                        constants);
        } else if (inst->U.I.Opcode == RC_OPCODE_SIN) {
-               emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_W),
+               emit3(c, inst->Prev, RC_OPCODE_MAD, NULL, dstregtmpmask(tempreg, RC_MASK_W),
                        swizzle_xxxx(inst->U.I.SrcReg[0]),
                        swizzle_zzzz(srcreg(RC_FILE_CONSTANT, constants[1])),
                        swizzle_yyyy(srcreg(RC_FILE_CONSTANT, constants[1])));
-               emit1(c, inst->Prev, RC_OPCODE_FRC, 0, dstregtmpmask(tempreg, RC_MASK_W),
+               emit1(c, inst->Prev, RC_OPCODE_FRC, NULL, dstregtmpmask(tempreg, RC_MASK_W),
                        swizzle_wwww(srcreg(RC_FILE_TEMPORARY, tempreg)));
-               emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_W),
+               emit3(c, inst->Prev, RC_OPCODE_MAD, NULL, dstregtmpmask(tempreg, RC_MASK_W),
                        swizzle_wwww(srcreg(RC_FILE_TEMPORARY, tempreg)),
                        swizzle_wwww(srcreg(RC_FILE_CONSTANT, constants[1])),
                        negate(swizzle_zzzz(srcreg(RC_FILE_CONSTANT, constants[0]))));
@@ -961,13 +961,13 @@ int r300_transform_trig_simple(struct radeon_compiler* c,
        } else {
                struct rc_dst_register dst;
 
-               emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_XY),
+               emit3(c, inst->Prev, RC_OPCODE_MAD, NULL, dstregtmpmask(tempreg, RC_MASK_XY),
                        swizzle_xxxx(inst->U.I.SrcReg[0]),
                        swizzle_zzzz(srcreg(RC_FILE_CONSTANT, constants[1])),
                        swizzle(srcreg(RC_FILE_CONSTANT, constants[1]), RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_W));
-               emit1(c, inst->Prev, RC_OPCODE_FRC, 0, dstregtmpmask(tempreg, RC_MASK_XY),
+               emit1(c, inst->Prev, RC_OPCODE_FRC, NULL, dstregtmpmask(tempreg, RC_MASK_XY),
                        srcreg(RC_FILE_TEMPORARY, tempreg));
-               emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_XY),
+               emit3(c, inst->Prev, RC_OPCODE_MAD, NULL, dstregtmpmask(tempreg, RC_MASK_XY),
                        srcreg(RC_FILE_TEMPORARY, tempreg),
                        swizzle_wwww(srcreg(RC_FILE_CONSTANT, constants[1])),
                        negate(swizzle_zzzz(srcreg(RC_FILE_CONSTANT, constants[0]))));
@@ -1029,10 +1029,10 @@ int radeonTransformTrigScale(struct radeon_compiler* c,
        temp = rc_find_free_temporary(c);
        constant = rc_constants_add_immediate_scalar(&c->Program.Constants, RCP_2PI, &constant_swizzle);
 
-       emit2(c, inst->Prev, RC_OPCODE_MUL, 0, dstregtmpmask(temp, RC_MASK_W),
+       emit2(c, inst->Prev, RC_OPCODE_MUL, NULL, dstregtmpmask(temp, RC_MASK_W),
                swizzle_xxxx(inst->U.I.SrcReg[0]),
                srcregswz(RC_FILE_CONSTANT, constant, constant_swizzle));
-       emit1(c, inst->Prev, RC_OPCODE_FRC, 0, dstregtmpmask(temp, RC_MASK_W),
+       emit1(c, inst->Prev, RC_OPCODE_FRC, NULL, dstregtmpmask(temp, RC_MASK_W),
                srcreg(RC_FILE_TEMPORARY, temp));
 
        r300_transform_SIN_COS(c, inst, temp);
@@ -1063,13 +1063,13 @@ int r300_transform_trig_scale_vertex(struct radeon_compiler *c,
        temp = rc_find_free_temporary(c);
        constant = rc_constants_add_immediate_vec4(&c->Program.Constants, cons);
 
-       emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(temp, RC_MASK_W),
+       emit3(c, inst->Prev, RC_OPCODE_MAD, NULL, dstregtmpmask(temp, RC_MASK_W),
                swizzle_xxxx(inst->U.I.SrcReg[0]),
                srcregswz(RC_FILE_CONSTANT, constant, RC_SWIZZLE_XXXX),
                srcregswz(RC_FILE_CONSTANT, constant, RC_SWIZZLE_YYYY));
-       emit1(c, inst->Prev, RC_OPCODE_FRC, 0, dstregtmpmask(temp, RC_MASK_W),
+       emit1(c, inst->Prev, RC_OPCODE_FRC, NULL, dstregtmpmask(temp, RC_MASK_W),
                srcreg(RC_FILE_TEMPORARY, temp));
-       emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(temp, RC_MASK_W),
+       emit3(c, inst->Prev, RC_OPCODE_MAD, NULL, dstregtmpmask(temp, RC_MASK_W),
                srcreg(RC_FILE_TEMPORARY, temp),
                srcregswz(RC_FILE_CONSTANT, constant, RC_SWIZZLE_ZZZZ),
                srcregswz(RC_FILE_CONSTANT, constant, RC_SWIZZLE_WWWW));
@@ -1189,7 +1189,7 @@ int rc_force_output_alpha_to_one(struct radeon_compiler *c,
        tmp = rc_find_free_temporary(c);
 
        /* Insert MOV after inst, set alpha to 1. */
-       emit1(c, inst, RC_OPCODE_MOV, 0, inst->U.I.DstReg,
+       emit1(c, inst, RC_OPCODE_MOV, NULL, inst->U.I.DstReg,
              srcregswz(RC_FILE_TEMPORARY, tmp, RC_SWIZZLE_XYZ1));
 
        /* Re-route the destination of inst to the source of mov. */
index d9c2aba..143d2d3 100644 (file)
@@ -881,7 +881,7 @@ static void r300_merge_textures_and_samplers(struct r300_context* r300)
                                                   view->swizzle, FALSE);
                 } else {
                     texstate->format.format1 |=
-                        r300_get_swizzle_combined(depth_swizzle, 0, FALSE);
+                        r300_get_swizzle_combined(depth_swizzle, NULL, FALSE);
                 }
             }
 
index cff8774..f47be75 100644 (file)
@@ -900,7 +900,7 @@ boolean r300_is_zs_format_supported(enum pipe_format format)
 
 boolean r300_is_sampler_format_supported(enum pipe_format format)
 {
-    return r300_translate_texformat(format, 0, TRUE, FALSE) != ~0;
+    return r300_translate_texformat(format, NULL, TRUE, FALSE) != ~0;
 }
 
 void r300_texture_setup_format_state(struct r300_screen *screen,
index 7e809d0..df1284c 100644 (file)
@@ -50,7 +50,7 @@ static void svga_flush( struct pipe_context *pipe,
    svga_context_flush(svga, fence);
 
    SVGA_DBG(DEBUG_DMA|DEBUG_PERF, "%s fence_ptr %p\n",
-            __FUNCTION__, fence ? *fence : 0x0);
+            __FUNCTION__, fence ? *fence : NULL);
 
    /* Enable to dump BMPs of the color/depth buffers each frame */
    if (0) {
index 3426ffa..10b3f6a 100644 (file)
@@ -335,7 +335,7 @@ renderer_bind_destination(struct xa_context *r,
     fb.height = surface->height;
     fb.nr_cbufs = 1;
     fb.cbufs[0] = surface;
-    fb.zsbuf = 0;
+    fb.zsbuf = NULL;
 
     /* Viewport just touches the bit we're interested in:
      */
index 83f6db1..91306bf 100644 (file)
@@ -154,7 +154,7 @@ create_vs(struct pipe_context *pipe, unsigned vs_traits)
 
     ureg = ureg_create(PIPE_SHADER_VERTEX);
     if (ureg == NULL)
-       return 0;
+       return NULL;
 
     const0 = ureg_DECL_constant(ureg, 0);
     const1 = ureg_DECL_constant(ureg, 1);
@@ -368,7 +368,7 @@ create_fs(struct pipe_context *pipe, unsigned fs_traits)
 
     ureg = ureg_create(PIPE_SHADER_FRAGMENT);
     if (ureg == NULL)
-       return 0;
+       return NULL;
 
     if (is_yuv)
        return create_yuv_shader(pipe, ureg);
@@ -462,7 +462,7 @@ static inline void *
 shader_from_cache(struct pipe_context *pipe,
                  unsigned type, struct cso_hash *hash, unsigned key)
 {
-    void *shader = 0;
+    void *shader = NULL;
 
     struct cso_hash_iter iter = cso_hash_find(hash, key);
 
index 74181a7..e319d50 100644 (file)
@@ -103,9 +103,9 @@ alloc_shm(struct dri_sw_displaytarget *dri_sw_dt, unsigned size)
    if (dri_sw_dt->shmid < 0)
       return NULL;
 
-   addr = (char *) shmat(dri_sw_dt->shmid, 0, 0);
+   addr = (char *) shmat(dri_sw_dt->shmid, NULL, 0);
    /* mark the segment immediately for deletion to avoid leaks */
-   shmctl(dri_sw_dt->shmid, IPC_RMID, 0);
+   shmctl(dri_sw_dt->shmid, IPC_RMID, NULL);
 
    if (addr == (char *) -1)
       return NULL;
@@ -173,7 +173,7 @@ dri_sw_displaytarget_destroy(struct sw_winsys *ws,
    if (dri_sw_dt->shmid >= 0) {
 #ifdef HAVE_SYS_SHM_H
       shmdt(dri_sw_dt->data);
-      shmctl(dri_sw_dt->shmid, IPC_RMID, 0);
+      shmctl(dri_sw_dt->shmid, IPC_RMID, NULL);
 #endif
    } else {
       align_free(dri_sw_dt->data);
index f644927..c91f7e2 100644 (file)
@@ -266,7 +266,7 @@ kms_sw_displaytarget_map(struct sw_winsys *ws,
    prot = (flags == PIPE_MAP_READ) ? PROT_READ : (PROT_READ | PROT_WRITE);
    void **ptr = (flags == PIPE_MAP_READ) ? &kms_sw_dt->ro_mapped : &kms_sw_dt->mapped;
    if (*ptr == MAP_FAILED) {
-      void *tmp = mmap(0, kms_sw_dt->size, prot, MAP_SHARED,
+      void *tmp = mmap(NULL, kms_sw_dt->size, prot, MAP_SHARED,
                        kms_sw->fd, map_req.offset);
       if (tmp == MAP_FAILED)
          return NULL;
index dcca354..ec4ec7f 100644 (file)
@@ -176,7 +176,7 @@ gbm_dri_bo_map_dumb(struct gbm_dri_bo *bo)
    if (ret)
       return NULL;
 
-   bo->map = mmap(0, bo->size, PROT_WRITE,
+   bo->map = mmap(NULL, bo->size, PROT_WRITE,
                   MAP_SHARED, bo->base.gbm->v0.fd, map_arg.offset);
    if (bo->map == MAP_FAILED) {
       bo->map = NULL;
index f00b965..3672828 100644 (file)
@@ -411,7 +411,7 @@ DRI2GetBuffers(Display * dpy, XID drawable,
    CARD32 *p;
    int i;
 
-   XextCheckExtension(dpy, info, dri2ExtensionName, False);
+   XextCheckExtension(dpy, info, dri2ExtensionName, NULL);
 
    LockDisplay(dpy);
    GetReqExtra(DRI2GetBuffers, count * 4, req);
@@ -470,7 +470,7 @@ DRI2GetBuffersWithFormat(Display * dpy, XID drawable,
    CARD32 *p;
    int i;
 
-   XextCheckExtension(dpy, info, dri2ExtensionName, False);
+   XextCheckExtension(dpy, info, dri2ExtensionName, NULL);
 
    LockDisplay(dpy);
    GetReqExtra(DRI2GetBuffers, count * (4 * 2), req);
index d51b63b..7e42aa7 100644 (file)
@@ -710,7 +710,7 @@ static void show_fps(struct dri2_drawable *draw)
    struct timeval tv;
    uint64_t current_time;
 
-   gettimeofday(&tv, 0);
+   gettimeofday(&tv, NULL);
    current_time = (uint64_t)tv.tv_sec*1000000 + (uint64_t)tv.tv_usec;
 
    draw->frames++;
index ff481a9..83a9c3e 100644 (file)
@@ -575,7 +575,7 @@ drisw_create_context_attribs(struct glx_screen *base,
    pcp->driContext =
       (*psc->swrast->createContextAttribs) (psc->driScreen,
                                            dca.api,
-                                           config ? config->driConfig : 0,
+                                           config ? config->driConfig : NULL,
                                            shared,
                                            num_ctx_attribs / 2,
                                            ctx_attribs,
index ffc7c3c..05ab830 100644 (file)
@@ -204,7 +204,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
    if (oldGC != &dummyContext) {
       if (--oldGC->thread_refcount == 0) {
         oldGC->vtable->unbind(oldGC, gc);
-        oldGC->currentDpy = 0;
+        oldGC->currentDpy = NULL;
       }
    }
 
index 461180c..912c804 100644 (file)
@@ -62,9 +62,9 @@
    gc = __glXGetCurrentContext();  \
    pc = gc->pc;                    \
    /* Muffle compilers */                  \
-   cmdlen = 0;         (void)cmdlen;          \
-   compsize = 0;       (void)compsize;        \
-   pixelHeaderPC = 0;  (void)pixelHeaderPC
+   cmdlen = 0;           (void)cmdlen;          \
+   compsize = 0;         (void)compsize;        \
+   pixelHeaderPC = NULL; (void)pixelHeaderPC
 
 /*
 ** Variable sized command support macro.  This macro is used by calls
index 99a170d..403d11f 100644 (file)
@@ -58,7 +58,7 @@
 #define __GLX_SINGLE_LOAD_VARIABLES()           \
    pc = gc->pc;                                 \
    /* Muffle compilers */                       \
-   pixelHeaderPC = 0;  (void)pixelHeaderPC;     \
+   pixelHeaderPC = NULL;  (void)pixelHeaderPC;     \
    compsize = 0;       (void)compsize;          \
    cmdlen = 0;         (void)cmdlen
 
index 4debf06..145116c 100644 (file)
@@ -143,20 +143,20 @@ glXQueryRendererStringMESA(Display *dpy, int screen,
    struct glx_screen *psc;
 
    if (dpy == NULL)
-      return False;
+      return NULL;
 
    /* This probably means the caller passed the wrong display pointer or
     * screen number.
     */
    psc = GetGLXScreenConfigs(dpy, screen);
    if (psc == NULL)
-      return False;
+      return NULL;
 
    /* Right now only a single renderer per display / screen combination is
     * supported.
     */
    if (renderer != 0)
-      return False;
+      return NULL;
 
    return __glXQueryRendererString(psc, attribute);
 }
@@ -167,7 +167,7 @@ glXQueryCurrentRendererStringMESA(int attribute)
    struct glx_context *gc = __glXGetCurrentContext();
 
    if (gc == &dummyContext)
-      return False;
+      return NULL;
 
    return __glXQueryRendererString(gc->psc, attribute);
 }
index 1ed8c0c..375367b 100644 (file)
@@ -647,7 +647,7 @@ __indirect_glGetString(GLenum name)
    GLubyte *s = NULL;
 
    if (!dpy)
-      return 0;
+      return NULL;
 
    /*
     ** Return the cached copy if the string has already been fetched
@@ -671,7 +671,7 @@ __indirect_glGetString(GLenum name)
       break;
    default:
       __glXSetError(gc, GL_INVALID_ENUM);
-      return 0;
+      return NULL;
    }
 
    /*
index 3214acd..dcecd3d 100644 (file)
@@ -2369,7 +2369,7 @@ void GLAPIENTRY
 _mesa_NamedBufferStorageMemEXT(GLuint buffer, GLsizeiptr size,
                                GLuint memory, GLuint64 offset)
 {
-   inlined_buffer_storage(GL_NONE, buffer, size, GL_NONE, 0, memory, offset,
+   inlined_buffer_storage(GL_NONE, buffer, size, NULL, 0, memory, offset,
                           true, true, false, "glNamedBufferStorageMemEXT");
 }
 
@@ -2378,7 +2378,7 @@ void GLAPIENTRY
 _mesa_NamedBufferStorageMemEXT_no_error(GLuint buffer, GLsizeiptr size,
                                         GLuint memory, GLuint64 offset)
 {
-   inlined_buffer_storage(GL_NONE, buffer, size, GL_NONE, 0, memory, offset,
+   inlined_buffer_storage(GL_NONE, buffer, size, NULL, 0, memory, offset,
                           true, true, true, "glNamedBufferStorageMemEXT");
 }
 
index 96d19c6..fe2b740 100644 (file)
@@ -360,7 +360,7 @@ GLubyte*
 _mesa_make_extension_string(struct gl_context *ctx)
 {
    /* The extension string. */
-   char *exts = 0;
+   char *exts = NULL;
    /* Length of extension string. */
    size_t length = 0;
    /* Number of extensions */
index ca92dd7..7a0c72a 100644 (file)
@@ -1000,7 +1000,7 @@ _mesa_marshal_MultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count,
         !is_index_type_valid(type) ||
         (!user_buffer_mask && !has_user_indices))) {
       multi_draw_elements_async(ctx, mode, count, type, indices, draw_count,
-                                basevertex, 0, 0, NULL);
+                                basevertex, NULL, 0, NULL);
       return;
    }
 
@@ -1034,7 +1034,7 @@ _mesa_marshal_MultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count,
          if (vertex_count < 0) {
             /* Just call the driver to set the error. */
             multi_draw_elements_async(ctx, mode, count, type, indices, draw_count,
-                                      basevertex, 0, 0, NULL);
+                                      basevertex, NULL, 0, NULL);
             return;
          }
          if (vertex_count == 0)
@@ -1059,7 +1059,7 @@ _mesa_marshal_MultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count,
       if (total_count == 0 || num_vertices == 0) {
          /* Nothing to do, but call the driver to set possible GL errors. */
          multi_draw_elements_async(ctx, mode, count, type, indices, draw_count,
-                                   basevertex, 0, 0, NULL);
+                                   basevertex, NULL, 0, NULL);
          return;
       }
 
@@ -1075,7 +1075,7 @@ _mesa_marshal_MultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count,
          if (vertex_count < 0) {
             /* Just call the driver to set the error. */
             multi_draw_elements_async(ctx, mode, count, type, indices, draw_count,
-                                      basevertex, 0, 0, NULL);
+                                      basevertex, NULL, 0, NULL);
             return;
          }
          if (vertex_count == 0)
@@ -1087,7 +1087,7 @@ _mesa_marshal_MultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count,
       if (total_count == 0) {
          /* Nothing to do, but call the driver to set possible GL errors. */
          multi_draw_elements_async(ctx, mode, count, type, indices, draw_count,
-                                   basevertex, 0, 0, NULL);
+                                   basevertex, NULL, 0, NULL);
          return;
       }
    }
index 1a3ab2a..a91d68c 100644 (file)
@@ -707,7 +707,7 @@ st_UnmapTextureImage(struct gl_context *ctx,
 
       itransfer->temp_data = NULL;
       itransfer->temp_stride = 0;
-      itransfer->map = 0;
+      itransfer->map = NULL;
    }
 
    st_texture_image_unmap(st, stImage, slice);
index 000feaa..6f91b82 100644 (file)
@@ -91,7 +91,7 @@ util_dynarray_ensure_cap(struct util_dynarray *buf, unsigned newcap)
          data = realloc(buf->data, capacity);
       }
       if (!data)
-         return 0;
+         return NULL;
 
       buf->data = data;
       buf->capacity = capacity;
@@ -105,12 +105,12 @@ MUST_CHECK static inline void *
 util_dynarray_resize_bytes(struct util_dynarray *buf, unsigned nelts, size_t eltsize)
 {
    if (unlikely(nelts > UINT_MAX / eltsize))
-      return 0;
+      return NULL;
 
    unsigned newsize = nelts * eltsize;
    void *p = util_dynarray_ensure_cap(buf, newsize);
    if (!p)
-      return 0;
+      return NULL;
 
    buf->size = newsize;
 
@@ -133,12 +133,12 @@ util_dynarray_grow_bytes(struct util_dynarray *buf, unsigned ngrow, size_t eltsi
 
    if (unlikely(ngrow > (UINT_MAX / eltsize) ||
                 growbytes > UINT_MAX - buf->size))
-      return 0;
+      return NULL;
 
    unsigned newsize = buf->size + growbytes;
    void *p = util_dynarray_ensure_cap(buf, newsize);
    if (!p)
-      return 0;
+      return NULL;
 
    buf->size = newsize;
 
index 305d16f..015264f 100644 (file)
@@ -165,8 +165,8 @@ SliceBlock(struct mem_block *p,
    p->next_free->prev_free = p->prev_free;
    p->prev_free->next_free = p->next_free;
 
-   p->next_free = 0;
-   p->prev_free = 0;
+   p->next_free = NULL;
+   p->prev_free = NULL;
 
    p->reserved = reserved;
    return p;
index ec2aa29..789684d 100644 (file)
@@ -272,7 +272,7 @@ findOption(const driOptionCache *cache, const char *name)
    /* this is just the starting point of the linear search for the option */
    for (i = 0; i < size; ++i, hash = (hash+1) & mask) {
       /* if we hit an empty entry then the option is not defined (yet) */
-      if (cache->info[hash].name == 0)
+      if (cache->info[hash].name == NULL)
          break;
       else if (!strcmp(name, cache->info[hash].name))
          break;