From: Brian Paul Date: Fri, 19 Feb 2010 15:32:36 +0000 (-0700) Subject: mesa: replace _mesa_bzero() with memset() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6bf1ea897fa470af58fe8916dff45e2da79634a3;p=mesa.git mesa: replace _mesa_bzero() with memset() --- diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index 4f6f0836779..87163e6505c 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -70,7 +70,7 @@ void _mesa_init_driver_functions(struct dd_function_table *driver) { - _mesa_bzero(driver, sizeof(*driver)); + memset(driver, 0, sizeof(*driver)); driver->GetString = NULL; /* REQUIRED! */ driver->UpdateState = NULL; /* REQUIRED! */ diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_common.c b/src/mesa/drivers/dri/r300/r300_fragprog_common.c index f3d8f2f4244..acc66e0ae02 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog_common.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog_common.c @@ -72,7 +72,7 @@ static void build_state( { int unit; - _mesa_bzero(state, sizeof(*state)); + memset(state, 0, sizeof(*state)); for(unit = 0; unit < 16; ++unit) { if (fp->Base.ShadowSamplers & (1 << unit)) { diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index c735661dc2c..2e9793ea0e5 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -295,7 +295,7 @@ _mesa_initialize_buffer_object( struct gl_buffer_object *obj, { (void) target; - _mesa_bzero(obj, sizeof(struct gl_buffer_object)); + memset(obj, 0, sizeof(struct gl_buffer_object)); _glthread_INIT_MUTEX(obj->Mutex); obj->RefCount = 1; obj->Name = name; diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 9c472d85e32..740ebfe17a5 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -9711,7 +9711,7 @@ _mesa_init_display_list(GLcontext *ctx) /* zero-out the instruction size table, just once */ if (!tableInitialized) { - _mesa_bzero(InstSize, sizeof(InstSize)); + memset(InstSize, 0, sizeof(InstSize)); tableInitialized = GL_TRUE; } diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c index 96e53443836..41b54209432 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -127,7 +127,7 @@ _mesa_initialize_window_framebuffer(struct gl_framebuffer *fb, assert(fb); assert(visual); - _mesa_bzero(fb, sizeof(struct gl_framebuffer)); + memset(fb, 0, sizeof(struct gl_framebuffer)); _glthread_INIT_MUTEX(fb->Mutex); @@ -169,7 +169,7 @@ _mesa_initialize_user_framebuffer(struct gl_framebuffer *fb, GLuint name) assert(fb); assert(name); - _mesa_bzero(fb, sizeof(struct gl_framebuffer)); + memset(fb, 0, sizeof(struct gl_framebuffer)); fb->Name = name; fb->RefCount = 1; @@ -526,7 +526,7 @@ _mesa_update_framebuffer_visual(struct gl_framebuffer *fb) { GLuint i; - _mesa_bzero(&fb->Visual, sizeof(fb->Visual)); + memset(&fb->Visual, 0, sizeof(fb->Visual)); fb->Visual.rgbMode = GL_TRUE; /* assume this */ #if 0 /* this _might_ be needed */ diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index 67305002258..5c2c863f976 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -257,17 +257,6 @@ _mesa_memset16( unsigned short *dst, unsigned short val, size_t n ) *dst++ = val; } -/** Wrapper around either memset() or bzero() */ -void -_mesa_bzero( void *dst, size_t n ) -{ -#if defined(__FreeBSD__) - bzero( dst, n ); -#else - memset( dst, 0, n ); -#endif -} - /*@}*/ diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index 048ae912c9d..106dd021a14 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -541,9 +541,6 @@ _mesa_realloc( void *oldBuffer, size_t oldSize, size_t newSize ); extern void _mesa_memset16( unsigned short *dst, unsigned short val, size_t n ); -extern void -_mesa_bzero( void *dst, size_t n ); - extern double _mesa_sin(double a); diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c index bb0c78382c5..aec22d9d148 100644 --- a/src/mesa/main/renderbuffer.c +++ b/src/mesa/main/renderbuffer.c @@ -706,7 +706,7 @@ put_mono_row_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, ASSERT(rb->Format == MESA_FORMAT_RGBA8888); if (!mask && val == 0) { /* common case */ - _mesa_bzero(dst, count * 4 * sizeof(GLubyte)); + memset(dst, 0, count * 4 * sizeof(GLubyte)); } else { /* general case */ @@ -868,7 +868,7 @@ put_mono_row_ushort4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, ASSERT(rb->DataType == GL_UNSIGNED_SHORT || rb->DataType == GL_SHORT); if (!mask && val0 == 0 && val1 == 0 && val2 == 0 && val3 == 0) { /* common case for clearing accum buffer */ - _mesa_bzero(dst, count * 4 * sizeof(GLushort)); + memset(dst, 0, count * 4 * sizeof(GLushort)); } else { GLuint i; diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 9db95814d00..649f3587cb6 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -106,7 +106,7 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj, target == GL_TEXTURE_1D_ARRAY_EXT || target == GL_TEXTURE_2D_ARRAY_EXT); - _mesa_bzero(obj, sizeof(*obj)); + memset(obj, 0, sizeof(*obj)); /* init the non-zero fields */ _glthread_INIT_MUTEX(obj->Mutex); obj->RefCount = 1; diff --git a/src/mesa/shader/nvfragparse.c b/src/mesa/shader/nvfragparse.c index 35f18aa2fb7..639408d82a4 100644 --- a/src/mesa/shader/nvfragparse.c +++ b/src/mesa/shader/nvfragparse.c @@ -1483,7 +1483,7 @@ _mesa_parse_nv_fragment_program(GLcontext *ctx, GLenum dstTarget, programString[len] = 0; /* Get ready to parse */ - _mesa_bzero(&parseState, sizeof(struct parse_state)); + memset(&parseState, 0, sizeof(struct parse_state)); parseState.ctx = ctx; parseState.start = programString; parseState.program = program; diff --git a/src/mesa/shader/prog_instruction.c b/src/mesa/shader/prog_instruction.c index dcf834f52da..0c4da4d1079 100644 --- a/src/mesa/shader/prog_instruction.c +++ b/src/mesa/shader/prog_instruction.c @@ -40,7 +40,7 @@ _mesa_init_instructions(struct prog_instruction *inst, GLuint count) { GLuint i; - _mesa_bzero(inst, count * sizeof(struct prog_instruction)); + memset(inst, 0, count * sizeof(struct prog_instruction)); for (i = 0; i < count; i++) { inst[i].SrcReg[0].File = PROGRAM_UNDEFINED; diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c index 2410ccb0472..0c3c5ffbd5f 100644 --- a/src/mesa/shader/program.c +++ b/src/mesa/shader/program.c @@ -240,7 +240,7 @@ _mesa_init_program_struct( GLcontext *ctx, struct gl_program *prog, (void) ctx; if (prog) { GLuint i; - _mesa_bzero(prog, sizeof(*prog)); + memset(prog, 0, sizeof(*prog)); prog->Id = id; prog->Target = target; prog->Resident = GL_TRUE; diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index fa3a63ea4be..b621e892c33 100644 --- a/src/mesa/shader/slang/slang_emit.c +++ b/src/mesa/shader/slang/slang_emit.c @@ -241,7 +241,7 @@ alloc_local_temp(slang_emit_info *emitInfo, slang_ir_storage *temp, GLint size) { assert(size >= 1); assert(size <= 4); - _mesa_bzero(temp, sizeof(*temp)); + memset(temp, 0, sizeof(*temp)); temp->Size = size; temp->File = PROGRAM_TEMPORARY; temp->Index = -1; @@ -1136,7 +1136,7 @@ emit_clamp(slang_emit_info *emitInfo, slang_ir_node *n) * dest for this clamp() is an output reg, we can't use that reg for * the intermediate result. Use a temp register instead. */ - _mesa_bzero(&tmpNode, sizeof(tmpNode)); + memset(&tmpNode, 0, sizeof(tmpNode)); if (!alloc_node_storage(emitInfo, &tmpNode, n->Store->Size)) { return NULL; } diff --git a/src/mesa/shader/slang/slang_typeinfo.c b/src/mesa/shader/slang/slang_typeinfo.c index a96f2fb4c25..01e2bc4a22b 100644 --- a/src/mesa/shader/slang/slang_typeinfo.c +++ b/src/mesa/shader/slang/slang_typeinfo.c @@ -419,7 +419,7 @@ slang_type_specifier_compatible(const slang_type_specifier * x, GLboolean slang_typeinfo_construct(slang_typeinfo * ti) { - _mesa_bzero(ti, sizeof(*ti)); + memset(ti, 0, sizeof(*ti)); slang_type_specifier_ctr(&ti->spec); ti->array_len = 0; return GL_TRUE; diff --git a/src/mesa/swrast/s_depth.c b/src/mesa/swrast/s_depth.c index 36c8db21072..3e36cf9a7e5 100644 --- a/src/mesa/swrast/s_depth.c +++ b/src/mesa/swrast/s_depth.c @@ -259,7 +259,7 @@ depth_test_span16( GLcontext *ctx, GLuint n, } break; case GL_NEVER: - _mesa_bzero(mask, n * sizeof(GLubyte)); + memset(mask, 0, n * sizeof(GLubyte)); break; default: _mesa_problem(ctx, "Bad depth func in depth_test_span16"); @@ -488,7 +488,7 @@ depth_test_span32( GLcontext *ctx, GLuint n, } break; case GL_NEVER: - _mesa_bzero(mask, n * sizeof(GLubyte)); + memset(mask, 0, n * sizeof(GLubyte)); break; default: _mesa_problem(ctx, "Bad depth func in depth_test_span32"); @@ -844,7 +844,7 @@ direct_depth_test_pixels16(GLcontext *ctx, GLushort *zStart, GLuint stride, break; case GL_NEVER: /* depth test never passes */ - _mesa_bzero(mask, n * sizeof(GLubyte)); + memset(mask, 0, n * sizeof(GLubyte)); break; default: _mesa_problem(ctx, "Bad depth func in direct_depth_test_pixels"); @@ -1090,7 +1090,7 @@ direct_depth_test_pixels32(GLcontext *ctx, GLuint *zStart, GLuint stride, break; case GL_NEVER: /* depth test never passes */ - _mesa_bzero(mask, n * sizeof(GLubyte)); + memset(mask, 0, n * sizeof(GLubyte)); break; default: _mesa_problem(ctx, "Bad depth func in direct_depth_test_pixels"); @@ -1260,7 +1260,7 @@ _swrast_read_depth_span_float( GLcontext *ctx, struct gl_renderbuffer *rb, if (!rb) { /* really only doing this to prevent FP exceptions later */ - _mesa_bzero(depth, n * sizeof(GLfloat)); + memset(depth, 0, n * sizeof(GLfloat)); return; } @@ -1269,7 +1269,7 @@ _swrast_read_depth_span_float( GLcontext *ctx, struct gl_renderbuffer *rb, if (y < 0 || y >= (GLint) rb->Height || x + n <= 0 || x >= (GLint) rb->Width) { /* span is completely outside framebuffer */ - _mesa_bzero(depth, n * sizeof(GLfloat)); + memset(depth, 0, n * sizeof(GLfloat)); return; } @@ -1326,7 +1326,7 @@ _swrast_read_depth_span_uint( GLcontext *ctx, struct gl_renderbuffer *rb, if (!rb) { /* really only doing this to prevent FP exceptions later */ - _mesa_bzero(depth, n * sizeof(GLuint)); + memset(depth, 0, n * sizeof(GLuint)); return; } @@ -1337,7 +1337,7 @@ _swrast_read_depth_span_uint( GLcontext *ctx, struct gl_renderbuffer *rb, if (y < 0 || y >= (GLint) rb->Height || x + n <= 0 || x >= (GLint) rb->Width) { /* span is completely outside framebuffer */ - _mesa_bzero(depth, n * sizeof(GLfloat)); + memset(depth, 0, n * sizeof(GLfloat)); return; } diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c index d31da4c4022..7c1de62e878 100644 --- a/src/mesa/swrast/s_fragprog.c +++ b/src/mesa/swrast/s_fragprog.c @@ -148,8 +148,7 @@ init_machine(GLcontext *ctx, struct gl_program_machine *machine, if (program->Base.Target == GL_FRAGMENT_PROGRAM_NV) { /* Clear temporary registers (undefined for ARB_f_p) */ - _mesa_bzero(machine->Temporaries, - MAX_PROGRAM_TEMPS * 4 * sizeof(GLfloat)); + memset(machine->Temporaries, 0, MAX_PROGRAM_TEMPS * 4 * sizeof(GLfloat)); } /* ARB_fragment_coord_conventions */ diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index 7087f25d274..dada3643606 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -1579,7 +1579,7 @@ _swrast_read_rgba_span( GLcontext *ctx, struct gl_renderbuffer *rb, if (y < 0 || y >= bufHeight || x + (GLint) n < 0 || x >= bufWidth) { /* completely above, below, or right */ /* XXX maybe leave rgba values undefined? */ - _mesa_bzero(rgba, 4 * n * sizeof(GLchan)); + memset(rgba, 0, 4 * n * sizeof(GLchan)); } else { GLint skip, length; @@ -1642,7 +1642,7 @@ _swrast_read_index_span( GLcontext *ctx, struct gl_renderbuffer *rb, if (y < 0 || y >= bufHeight || x + (GLint) n < 0 || x >= bufWidth) { /* completely above, below, or right */ - _mesa_bzero(index, n * sizeof(GLuint)); + memset(index, 0, n * sizeof(GLuint)); } else { GLint skip, length;