From 26f8fad1456fdc2b352cea9d3b4c32cb5f6ae947 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 18 Feb 2010 23:51:00 -0800 Subject: [PATCH] Remove _mesa_memset in favor of plain memset. This may break the SUNOS4 build, but it's no longer relevant. --- src/glx/glcontextmodes.c | 7 ++----- src/mesa/drivers/dri/i965/brw_state_upload.c | 2 +- src/mesa/drivers/dri/i965/brw_wm_sampler_state.c | 2 +- src/mesa/drivers/windows/gdi/mesa.def | 1 - src/mesa/drivers/windows/icd/mesa.def | 1 - src/mesa/drivers/x11/xm_dd.c | 2 +- src/mesa/glapi/mesadef.py | 1 - src/mesa/main/bitset.h | 4 ++-- src/mesa/main/ffvertex_prog.c | 2 +- src/mesa/main/imports.c | 11 ----------- src/mesa/main/imports.h | 5 +---- src/mesa/main/renderbuffer.c | 4 ++-- src/mesa/main/texcompress_fxt1.c | 4 ++-- src/mesa/main/texenvprogram.c | 2 +- src/mesa/shader/atifragshader.c | 2 +- src/mesa/shader/prog_cache.c | 2 +- src/mesa/shader/prog_parameter.c | 4 ++-- src/mesa/shader/program.c | 2 +- src/mesa/swrast/s_depth.c | 2 +- src/mesa/swrast/s_span.c | 4 ++-- src/mesa/swrast/s_stencil.c | 4 ++-- src/mesa/tnl/t_vertex_sse.c | 2 +- src/mesa/vf/vf_sse.c | 2 +- 23 files changed, 26 insertions(+), 46 deletions(-) diff --git a/src/glx/glcontextmodes.c b/src/glx/glcontextmodes.c index 232031c2ca8..257087a802f 100644 --- a/src/glx/glcontextmodes.c +++ b/src/glx/glcontextmodes.c @@ -48,17 +48,14 @@ # include # define _mesa_malloc(b) malloc(b) # define _mesa_free(m) free(m) -# define _mesa_memset memset #else # ifdef XFree86Server # include # include # define _mesa_malloc(b) xalloc(b) # define _mesa_free(m) xfree(m) -# define _mesa_memset memset # else # include -# define _mesa_memset memset # define _mesa_malloc(b) Xmalloc(b) # define _mesa_free(m) Xfree(m) # endif /* XFree86Server */ @@ -133,7 +130,7 @@ _gl_copy_visual_to_context_mode(__GLcontextModes * mode, { __GLcontextModes *const next = mode->next; - (void) _mesa_memset(mode, 0, sizeof(__GLcontextModes)); + (void) memset(mode, 0, sizeof(__GLcontextModes)); mode->next = next; mode->visualID = config->vid; @@ -402,7 +399,7 @@ _gl_context_modes_create(unsigned count, size_t minimum_size) break; } - (void) _mesa_memset(*next, 0, size); + (void) memset(*next, 0, size); (*next)->visualID = GLX_DONT_CARE; (*next)->visualType = GLX_DONT_CARE; (*next)->visualRating = GLX_NONE; diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index 0ecbef1ef92..4f477cfc6b3 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -349,7 +349,7 @@ void brw_upload_state(struct brw_context *brw) * state atoms are ordered correctly in the list. */ struct brw_state_flags examined, prev; - _mesa_memset(&examined, 0, sizeof(examined)); + memset(&examined, 0, sizeof(examined)); prev = *state; for (i = 0; i < Elements(atoms); i++) { diff --git a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c index 87387b1e2d5..c232cd27914 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c @@ -105,7 +105,7 @@ static void brw_update_sampler_state(struct wm_sampler_entry *key, dri_bo *sdc_bo, struct brw_sampler_state *sampler) { - _mesa_memset(sampler, 0, sizeof(*sampler)); + memset(sampler, 0, sizeof(*sampler)); switch (key->minfilter) { case GL_NEAREST: diff --git a/src/mesa/drivers/windows/gdi/mesa.def b/src/mesa/drivers/windows/gdi/mesa.def index f82db88bc53..d7d6cfa4e2a 100644 --- a/src/mesa/drivers/windows/gdi/mesa.def +++ b/src/mesa/drivers/windows/gdi/mesa.def @@ -899,7 +899,6 @@ EXPORTS _mesa_init_renderbuffer _mesa_initialize_context _mesa_make_current - _mesa_memset _mesa_new_array_object _mesa_new_framebuffer _mesa_new_program diff --git a/src/mesa/drivers/windows/icd/mesa.def b/src/mesa/drivers/windows/icd/mesa.def index 06c384d8b0c..f6bd2aa68b8 100644 --- a/src/mesa/drivers/windows/icd/mesa.def +++ b/src/mesa/drivers/windows/icd/mesa.def @@ -54,7 +54,6 @@ EXPORTS _mesa_init_driver_functions _mesa_initialize_context _mesa_make_current - _mesa_memset _mesa_new_buffer_object _mesa_new_texture_object _mesa_problem diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index df04e3a1011..d70236c2a02 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -336,7 +336,7 @@ clear_32bit_ximage(GLcontext *ctx, struct xmesa_renderbuffer *xrb, GLuint *ptr4 = (GLuint *) xrb->ximage->data; if (pixel == 0) { /* common case */ - _mesa_memset(ptr4, pixel, 4 * n); + memset(ptr4, pixel, 4 * n); } else { GLuint i; diff --git a/src/mesa/glapi/mesadef.py b/src/mesa/glapi/mesadef.py index c7e2c086f77..59cea59ac2c 100644 --- a/src/mesa/glapi/mesadef.py +++ b/src/mesa/glapi/mesadef.py @@ -134,7 +134,6 @@ def PrintTail(): print '\t_mesa_init_default_imports' print '\t_mesa_initialize_context' print '\t_mesa_make_current' - print '\t_mesa_memset' print '\t_mesa_new_buffer_object' print '\t_mesa_new_texture_object' print '\t_mesa_problem' diff --git a/src/mesa/main/bitset.h b/src/mesa/main/bitset.h index 5463c0a3c9e..29468e84861 100644 --- a/src/mesa/main/bitset.h +++ b/src/mesa/main/bitset.h @@ -49,8 +49,8 @@ */ #define BITSET_COPY(x, y) memcpy( (x), (y), sizeof (x) ) #define BITSET_EQUAL(x, y) (_mesa_memcmp( (x), (y), sizeof (x) ) == 0) -#define BITSET_ZERO(x) _mesa_memset( (x), 0, sizeof (x) ) -#define BITSET_ONES(x) _mesa_memset( (x), 0xff, sizeof (x) ) +#define BITSET_ZERO(x) memset( (x), 0, sizeof (x) ) +#define BITSET_ONES(x) memset( (x), 0xff, sizeof (x) ) #define BITSET_BITWORD(b) ((b) / BITSET_WORDBITS) #define BITSET_BIT(b) (1 << ((b) % BITSET_WORDBITS)) diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 867a55242c0..48edec657bd 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -1590,7 +1590,7 @@ create_new_program( const struct state_key *key, { struct tnl_program p; - _mesa_memset(&p, 0, sizeof(p)); + memset(&p, 0, sizeof(p)); p.state = key; p.program = program; p.eye_position = undef; diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index 0abdfca381e..d8375bf5727 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -244,17 +244,6 @@ _mesa_realloc(void *oldBuffer, size_t oldSize, size_t newSize) return newBuffer; } -/** Wrapper around memset() */ -void -_mesa_memset( void *dst, int val, size_t n ) -{ -#if defined(SUNOS4) - memset( (char *) dst, (int) val, (int) n ); -#else - memset(dst, val, n); -#endif -} - /** * Fill memory with a constant 16bit word. * \param dst destination pointer. diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index 8f13d518ea7..68d2043c916 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -74,7 +74,7 @@ extern "C" { /** Copy \p BYTES bytes from \p SRC into \p DST */ #define MEMCPY( DST, SRC, BYTES) memcpy(DST, SRC, BYTES) /** Set \p N bytes in \p DST to \p VAL */ -#define MEMSET( DST, VAL, N ) _mesa_memset(DST, VAL, N) +#define MEMSET( DST, VAL, N ) memset(DST, VAL, N) /*@}*/ @@ -543,9 +543,6 @@ _mesa_exec_free( void *addr ); extern void * _mesa_realloc( void *oldBuffer, size_t oldSize, size_t newSize ); -extern void -_mesa_memset( void *dst, int val, size_t n ); - extern void _mesa_memset16( unsigned short *dst, unsigned short val, size_t n ); diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c index 4ae5843662d..bb0c78382c5 100644 --- a/src/mesa/main/renderbuffer.c +++ b/src/mesa/main/renderbuffer.c @@ -548,7 +548,7 @@ put_mono_row_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, ASSERT(rb->DataType == GL_UNSIGNED_BYTE); if (!mask && val0 == val1 && val1 == val2) { /* optimized case */ - _mesa_memset(dst, val0, 3 * count); + memset(dst, val0, 3 * count); } else { GLuint i; @@ -1319,7 +1319,7 @@ put_mono_row_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb, GLuint count, } } else { - _mesa_memset(dst, val, count); + memset(dst, val, count); } } diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c index 85becb80d2a..73a31a17ec3 100644 --- a/src/mesa/main/texcompress_fxt1.c +++ b/src/mesa/main/texcompress_fxt1.c @@ -406,7 +406,7 @@ fxt1_choose (GLfloat vec[][MAX_COMP], GLint nv, } hist[N_TEXELS]; GLint lenh = 0; - _mesa_memset(hist, 0, sizeof(hist)); + memset(hist, 0, sizeof(hist)); for (k = 0; k < n; k++) { GLint l; @@ -1211,7 +1211,7 @@ fxt1_quantize (GLuint *cc, const GLubyte *lines[], GLint comps) if (comps == 3) { /* make the whole block opaque */ - _mesa_memset(input, -1, sizeof(input)); + memset(input, -1, sizeof(input)); } /* 8 texels each line */ diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 5cc5fdaebd1..35a2cebab82 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -1416,7 +1416,7 @@ create_new_program(GLcontext *ctx, struct state_key *key, GLuint unit; struct ureg cf, out; - _mesa_memset(&p, 0, sizeof(p)); + memset(&p, 0, sizeof(p)); p.state = key; p.program = program; diff --git a/src/mesa/shader/atifragshader.c b/src/mesa/shader/atifragshader.c index 3e26c43c480..fb2fa4b95f9 100644 --- a/src/mesa/shader/atifragshader.c +++ b/src/mesa/shader/atifragshader.c @@ -96,7 +96,7 @@ create_dst_mod_str(GLuint mod) { static char ret_str[1024]; - _mesa_memset(ret_str, 0, 1024); + memset(ret_str, 0, 1024); if (mod & GL_2X_BIT_ATI) strncat(ret_str, "|2X", 1024); diff --git a/src/mesa/shader/prog_cache.c b/src/mesa/shader/prog_cache.c index 9437e596138..8e54f3a5a03 100644 --- a/src/mesa/shader/prog_cache.c +++ b/src/mesa/shader/prog_cache.c @@ -88,7 +88,7 @@ rehash(struct gl_program_cache *cache) size = cache->size * 3; items = (struct cache_item**) _mesa_malloc(size * sizeof(*items)); - _mesa_memset(items, 0, size * sizeof(*items)); + memset(items, 0, size * sizeof(*items)); for (i = 0; i < cache->size; i++) for (c = cache->items[i]; c; c = next) { diff --git a/src/mesa/shader/prog_parameter.c b/src/mesa/shader/prog_parameter.c index 435e6ceb093..1feb7bd71d3 100644 --- a/src/mesa/shader/prog_parameter.c +++ b/src/mesa/shader/prog_parameter.c @@ -146,8 +146,8 @@ _mesa_add_parameter(struct gl_program_parameter_list *paramList, paramList->NumParameters = oldNum + sz4; - _mesa_memset(¶mList->Parameters[oldNum], 0, - sz4 * sizeof(struct gl_program_parameter)); + memset(¶mList->Parameters[oldNum], 0, + sz4 * sizeof(struct gl_program_parameter)); for (i = 0; i < sz4; i++) { struct gl_program_parameter *p = paramList->Parameters + oldNum + i; diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c index 3bf9a659050..2410ccb0472 100644 --- a/src/mesa/shader/program.c +++ b/src/mesa/shader/program.c @@ -809,7 +809,7 @@ _mesa_find_used_registers(const struct gl_program *prog, { GLuint i, j; - _mesa_memset(used, 0, usedSize); + memset(used, 0, usedSize); for (i = 0; i < prog->NumInstructions; i++) { const struct prog_instruction *inst = prog->Instructions + i; diff --git a/src/mesa/swrast/s_depth.c b/src/mesa/swrast/s_depth.c index ac5dae2148b..36c8db21072 100644 --- a/src/mesa/swrast/s_depth.c +++ b/src/mesa/swrast/s_depth.c @@ -1438,7 +1438,7 @@ _swrast_clear_depth_buffer( GLcontext *ctx, struct gl_renderbuffer *rb ) /* optimized case */ GLushort *dst = (GLushort *) rb->GetPointer(ctx, rb, x, y); GLuint len = width * height * sizeof(GLushort); - _mesa_memset(dst, (clearValue & 0xff), len); + memset(dst, (clearValue & 0xff), len); } else { /* general case */ diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index 63a8d4e350e..7087f25d274 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -869,7 +869,7 @@ _swrast_write_index_span( GLcontext *ctx, SWspan *span) span->writeAll = GL_FALSE; } else { - _mesa_memset(span->array->mask, 1, span->end); + memset(span->array->mask, 1, span->end); span->writeAll = GL_TRUE; } @@ -1338,7 +1338,7 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span) span->writeAll = GL_FALSE; } else { - _mesa_memset(span->array->mask, 1, span->end); + memset(span->array->mask, 1, span->end); span->writeAll = GL_TRUE; } diff --git a/src/mesa/swrast/s_stencil.c b/src/mesa/swrast/s_stencil.c index 5e9a4e37c7d..aa74b21ee80 100644 --- a/src/mesa/swrast/s_stencil.c +++ b/src/mesa/swrast/s_stencil.c @@ -1181,7 +1181,7 @@ _swrast_clear_stencil_buffer( GLcontext *ctx, struct gl_renderbuffer *rb ) /* Note: bottom-to-top raster assumed! */ GLubyte *stencil = (GLubyte *) rb->GetPointer(ctx, rb, x, y); GLuint len = width * height * sizeof(GLubyte); - _mesa_memset(stencil, clearVal, len); + memset(stencil, clearVal, len); } else { /* general case */ @@ -1189,7 +1189,7 @@ _swrast_clear_stencil_buffer( GLcontext *ctx, struct gl_renderbuffer *rb ) for (i = 0; i < height; i++) { GLvoid *stencil = rb->GetPointer(ctx, rb, x, y + i); if (rb->DataType == GL_UNSIGNED_BYTE) { - _mesa_memset(stencil, clearVal, width); + memset(stencil, clearVal, width); } else { _mesa_memset16((short unsigned int*) stencil, clearVal, width); diff --git a/src/mesa/tnl/t_vertex_sse.c b/src/mesa/tnl/t_vertex_sse.c index 7a255d680a1..6436cbfc6ea 100644 --- a/src/mesa/tnl/t_vertex_sse.c +++ b/src/mesa/tnl/t_vertex_sse.c @@ -648,7 +648,7 @@ void _tnl_generate_sse_emit( GLcontext *ctx ) return; } - _mesa_memset(&p, 0, sizeof(p)); + memset(&p, 0, sizeof(p)); p.ctx = ctx; p.inputs_safe = 0; /* for now */ diff --git a/src/mesa/vf/vf_sse.c b/src/mesa/vf/vf_sse.c index 4d70196ffed..04275903c93 100644 --- a/src/mesa/vf/vf_sse.c +++ b/src/mesa/vf/vf_sse.c @@ -629,7 +629,7 @@ void vf_generate_sse_emit( struct vertex_fetch *vf ) return; } - _mesa_memset(&p, 0, sizeof(p)); + memset(&p, 0, sizeof(p)); p.vf = vf; p.inputs_safe = 0; /* for now */ -- 2.30.2