Index: src/mesa/main/imports.c =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/main/imports.c,v retrieving revision 1.50 diff -u -r1.50 imports.c --- src/mesa/main/imports.c 30 Jun 2005 14:24:44 -0000 1.50 +++ src/mesa/main/imports.c 15 Sep 2005 15:52:51 -0000 @@ -259,6 +259,19 @@ #endif } +/** Wrapper around either memcmp() or xf86memcmp() */ +int +_mesa_memcmp( const void *s1, const void *s2, size_t n ) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86memcmp( s1, s2, n ); +#elif defined(SUNOS4) + return memcmp( (char *) s1, (char *) s2, (int) n ); +#else + return memcmp(s1, s2, n); +#endif +} + /*@}*/ Index: src/mesa/main/imports.h =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/main/imports.h,v retrieving revision 1.55 diff -u -r1.55 imports.h --- src/mesa/main/imports.h 6 Sep 2005 02:56:51 -0000 1.55 +++ src/mesa/main/imports.h 15 Sep 2005 15:52:53 -0000 @@ -87,6 +87,8 @@ #define MEMCPY( DST, SRC, BYTES) _mesa_memcpy(DST, SRC, BYTES) /** Set \p N bytes in \p DST to \p VAL */ #define MEMSET( DST, VAL, N ) _mesa_memset(DST, VAL, N) +/** Compare the first \p N bytes of \p S1 and \p S2 */ +#define MEMCMP( S1, S2, N ) _mesa_memcmp(S1, S2, N) /*@}*/ @@ -613,6 +615,8 @@ extern void _mesa_bzero( void *dst, size_t n ); +extern int +_mesa_memcmp( const void *s1, const void *s2, size_t n ); extern double _mesa_sin(double a); Index: src/mesa/main/texcompress_fxt1.c =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/main/texcompress_fxt1.c,v retrieving revision 1.26 diff -u -r1.26 texcompress_fxt1.c --- src/mesa/main/texcompress_fxt1.c 12 Sep 2005 13:59:29 -0000 1.26 +++ src/mesa/main/texcompress_fxt1.c 15 Sep 2005 15:52:57 -0000 @@ -474,7 +474,7 @@ } hist[N_TEXELS]; GLint lenh = 0; - memset(hist, 0, sizeof(hist)); + _mesa_memset(hist, 0, sizeof(hist)); for (k = 0; k < n; k++) { GLint l; @@ -1268,7 +1268,7 @@ if (comps == 3) { /* make the whole block opaque */ - memset(input, -1, sizeof(input)); + _mesa_memset(input, -1, sizeof(input)); } /* 8 texels each line */ Index: src/mesa/main/texenvprogram.c =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/main/texenvprogram.c,v retrieving revision 1.22 diff -u -r1.22 texenvprogram.c --- src/mesa/main/texenvprogram.c 15 Sep 2005 05:00:45 -0000 1.22 +++ src/mesa/main/texenvprogram.c 15 Sep 2005 15:53:00 -0000 @@ -480,7 +480,7 @@ GLuint nr = p->program->Base.NumInstructions++; struct fp_instruction *inst = &p->program->Instructions[nr]; - memset(inst, 0, sizeof(*inst)); + _mesa_memset(inst, 0, sizeof(*inst)); inst->Opcode = op; emit_arg( &inst->SrcReg[0], src0 ); @@ -792,7 +792,7 @@ emit_arith( p, FP_OPCODE_MAD, tmp0, WRITEMASK_XYZW, 0, two, src[0], neg1); - if (memcmp(&src[0], &src[1], sizeof(struct ureg)) == 0) + if (_mesa_memcmp(&src[0], &src[1], sizeof(struct ureg)) == 0) tmp1 = tmp0; else emit_arith( p, FP_OPCODE_MAD, tmp1, WRITEMASK_XYZW, 0, @@ -1039,7 +1039,7 @@ emit_arith( &p, FP_OPCODE_ADD, out, WRITEMASK_XYZ, 0, cf, s, undef ); emit_arith( &p, FP_OPCODE_MOV, out, WRITEMASK_W, 0, cf, undef, undef ); } - else if (memcmp(&cf, &out, sizeof(cf)) != 0) { + else if (_mesa_memcmp(&cf, &out, sizeof(cf)) != 0) { /* Will wind up in here if no texture enabled or a couple of * other scenarios (GL_REPLACE for instance). */ @@ -1093,7 +1093,7 @@ struct texenvprog_cache *c; for (c = cache; c; c = c->next) { - if (c->hash == hash && memcmp(c->key, key, keysize) == 0) + if (c->hash == hash && _mesa_memcmp(c->key, key, keysize) == 0) return c->data; } Index: src/mesa/main/texobj.c =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/main/texobj.c,v retrieving revision 1.94 diff -u -r1.94 texobj.c --- src/mesa/main/texobj.c 22 Mar 2005 14:27:10 -0000 1.94 +++ src/mesa/main/texobj.c 15 Sep 2005 15:53:03 -0000 @@ -246,7 +246,7 @@ /* Always need the base level image */ if (!t->Image[0][baseLevel]) { char s[100]; - sprintf(s, "obj %p (%d) Image[baseLevel=%d] == NULL", + _mesa_sprintf(s, "obj %p (%d) Image[baseLevel=%d] == NULL", (void *) t, t->Name, baseLevel); incomplete(t, s); t->Complete = GL_FALSE; Index: src/mesa/math/m_matrix.c =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/math/m_matrix.c,v retrieving revision 1.22 diff -u -r1.22 m_matrix.c --- src/mesa/math/m_matrix.c 30 Jun 2005 14:22:23 -0000 1.22 +++ src/mesa/math/m_matrix.c 15 Sep 2005 15:53:07 -0000 @@ -804,8 +804,8 @@ GLfloat m[16]; GLboolean optimized; - s = (GLfloat) sin( angle * DEG2RAD ); - c = (GLfloat) cos( angle * DEG2RAD ); + s = (GLfloat) _mesa_sin( angle * DEG2RAD ); + c = (GLfloat) _mesa_cos( angle * DEG2RAD ); MEMCPY(m, Identity, sizeof(GLfloat)*16); optimized = GL_FALSE; Index: src/mesa/shader/arbprogparse.c =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/shader/arbprogparse.c,v retrieving revision 1.32 diff -u -r1.32 arbprogparse.c --- src/mesa/shader/arbprogparse.c 8 Sep 2005 18:35:48 -0000 1.32 +++ src/mesa/shader/arbprogparse.c 15 Sep 2005 15:53:16 -0000 @@ -560,7 +560,7 @@ /*struct var_cache *first = va;*/ while (va) { - if (!strcmp ( (const char*) name, (const char*) va->name)) { + if (!_mesa_strcmp ( (const char*) name, (const char*) va->name)) { if (va->type == vt_alias) return va->alias_binding; return va; Index: src/mesa/shader/nvfragparse.c =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/shader/nvfragparse.c,v retrieving revision 1.9 diff -u -r1.9 nvfragparse.c --- src/mesa/shader/nvfragparse.c 8 Sep 2005 18:35:48 -0000 1.9 +++ src/mesa/shader/nvfragparse.c 15 Sep 2005 15:53:20 -0000 @@ -1588,7 +1588,7 @@ } if (src->File == PROGRAM_NAMED_PARAM) { if (program->Parameters->Parameters[src->Index].Type == CONSTANT) { - printf("{%g, %g, %g, %g}", + _mesa_printf("{%g, %g, %g, %g}", program->Parameters->ParameterValues[src->Index][0], program->Parameters->ParameterValues[src->Index][1], program->Parameters->ParameterValues[src->Index][2], @@ -1597,7 +1597,7 @@ else { ASSERT(program->Parameters->Parameters[src->Index].Type == NAMED_PARAMETER); - printf("%s", program->Parameters->Parameters[src->Index].Name); + _mesa_printf("%s", program->Parameters->Parameters[src->Index].Name); } } else if (src->File == PROGRAM_OUTPUT) { Index: src/mesa/shader/program.c =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/shader/program.c,v retrieving revision 1.26 diff -u -r1.26 program.c --- src/mesa/shader/program.c 2 Sep 2005 01:11:53 -0000 1.26 +++ src/mesa/shader/program.c 15 Sep 2005 15:53:23 -0000 @@ -1304,7 +1304,7 @@ for (i = 0; i < ctx->Const.MaxVertexProgramAttribs; i++) { const char *name = _mesa_nv_vertex_input_register_name(i); char number[10]; - sprintf(number, "%d", i); + _mesa_sprintf(number, "%d", i); if (_mesa_strncmp(reg + 2, name, 4) == 0 || _mesa_strncmp(reg + 2, number, _mesa_strlen(number)) == 0) { COPY_4V(v, ctx->VertexProgram.Inputs[i]); Index: src/mesa/shader/slang/slang_compile.c =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/shader/slang/slang_compile.c,v retrieving revision 1.9 diff -u -r1.9 slang_compile.c --- src/mesa/shader/slang/slang_compile.c 1 Jun 2005 12:05:34 -0000 1.9 +++ src/mesa/shader/slang/slang_compile.c 15 Sep 2005 15:53:28 -0000 @@ -635,7 +635,7 @@ char buf[1024]; va_start (va, msg); - vsprintf (buf, msg, va); + _mesa_sprintf (buf, msg, va); if (slang_info_log_message (log, "error", buf)) return 1; slang_info_log_memory (log); @@ -649,7 +649,7 @@ char buf[1024]; va_start (va, msg); - vsprintf (buf, msg, va); + _mesa_sprintf (buf, msg, va); if (slang_info_log_message (log, "warning", buf)) return 1; slang_info_log_memory (log); Index: src/mesa/shader/slang/slang_execute.c =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/shader/slang/slang_execute.c,v retrieving revision 1.5 diff -u -r1.5 slang_execute.c --- src/mesa/shader/slang/slang_execute.c 10 Aug 2005 14:40:05 -0000 1.5 +++ src/mesa/shader/slang/slang_execute.c 15 Sep 2005 15:53:29 -0000 @@ -169,7 +169,7 @@ char filename[256]; counter++; - sprintf (filename, "~mesa-slang-assembly-dump-(%u).txt", counter); + _mesa_sprintf (filename, "~mesa-slang-assembly-dump-(%u).txt", counter); f = fopen (filename, "w"); if (f == NULL) return; Index: src/mesa/swrast/s_nvfragprog.c =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/swrast/s_nvfragprog.c,v retrieving revision 1.54 diff -u -r1.54 s_nvfragprog.c --- src/mesa/swrast/s_nvfragprog.c 15 Sep 2005 00:58:03 -0000 1.54 +++ src/mesa/swrast/s_nvfragprog.c 15 Sep 2005 15:53:32 -0000 @@ -1034,8 +1034,8 @@ { GLfloat a[4], result[4]; fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a ); - result[0] = (GLfloat)cos(a[0]); - result[1] = (GLfloat)sin(a[0]); + result[0] = (GLfloat)_mesa_cos(a[0]); + result[1] = (GLfloat)_mesa_sin(a[0]); result[2] = 0.0; /* undefined! */ result[3] = 0.0; /* undefined! */ store_vector4( inst, machine, result ); Index: src/mesa/tnl/t_context.c =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/tnl/t_context.c,v retrieving revision 1.53 diff -u -r1.53 t_context.c --- src/mesa/tnl/t_context.c 14 Sep 2005 14:32:20 -0000 1.53 +++ src/mesa/tnl/t_context.c 15 Sep 2005 15:53:34 -0000 @@ -73,7 +73,7 @@ return GL_FALSE; } - if (getenv("MESA_CODEGEN")) + if (_mesa_getenv("MESA_CODEGEN")) tnl->AllowCodegen = GL_TRUE; /* Initialize the VB. Index: src/mesa/tnl/t_vb_arbprogram.c =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/tnl/t_vb_arbprogram.c,v retrieving revision 1.24 diff -u -r1.24 t_vb_arbprogram.c --- src/mesa/tnl/t_vb_arbprogram.c 12 Aug 2005 18:56:56 -0000 1.24 +++ src/mesa/tnl/t_vb_arbprogram.c 15 Sep 2005 15:53:37 -0000 @@ -1031,7 +1031,7 @@ /* Initialize cp. Note that ctx and VB aren't used in compilation * so we don't have to worry about statechanges: */ - memset(&cp, 0, sizeof(cp)); + _mesa_memset(&cp, 0, sizeof(cp)); cp.csr = p->instructions; /* Compile instructions: Index: src/mesa/tnl/t_vb_arbprogram_sse.c =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/tnl/t_vb_arbprogram_sse.c,v retrieving revision 1.5 diff -u -r1.5 t_vb_arbprogram_sse.c --- src/mesa/tnl/t_vb_arbprogram_sse.c 10 Jul 2005 11:23:10 -0000 1.5 +++ src/mesa/tnl/t_vb_arbprogram_sse.c 15 Sep 2005 15:53:40 -0000 @@ -1181,7 +1181,7 @@ { struct compilation cp; - memset(&cp, 0, sizeof(cp)); + _mesa_memset(&cp, 0, sizeof(cp)); cp.p = p; cp.have_sse2 = 1; Index: src/mesa/tnl/t_vertex_sse.c =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/tnl/t_vertex_sse.c,v retrieving revision 1.9 diff -u -r1.9 t_vertex_sse.c --- src/mesa/tnl/t_vertex_sse.c 8 Jun 2005 21:58:30 -0000 1.9 +++ src/mesa/tnl/t_vertex_sse.c 15 Sep 2005 15:53:41 -0000 @@ -637,7 +637,7 @@ return; } - memset(&p, 0, sizeof(p)); + _mesa_memset(&p, 0, sizeof(p)); p.ctx = ctx; p.inputs_safe = 0; /* for now */ Index: src/mesa/tnl/t_vp_build.c =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/tnl/t_vp_build.c,v retrieving revision 1.26 diff -u -r1.26 t_vp_build.c --- src/mesa/tnl/t_vp_build.c 6 Aug 2005 05:19:42 -0000 1.26 +++ src/mesa/tnl/t_vp_build.c 15 Sep 2005 15:53:45 -0000 @@ -1406,7 +1406,7 @@ struct tnl_cache *c; for (c = cache; c; c = c->next) { - if (c->hash == hash && memcmp(c->key, key, keysize) == 0) + if (c->hash == hash && _mesa_memcmp(c->key, key, keysize) == 0) return c->data; } Index: src/mesa/tnl/t_vtx_api.c =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/tnl/t_vtx_api.c,v retrieving revision 1.38 diff -u -r1.38 t_vtx_api.c --- src/mesa/tnl/t_vtx_api.c 18 Jul 2005 12:31:30 -0000 1.38 +++ src/mesa/tnl/t_vtx_api.c 15 Sep 2005 15:53:47 -0000 @@ -943,7 +943,7 @@ _mesa_install_exec_vtxfmt( ctx, &tnl->exec_vtxfmt ); - memcpy( tnl->vtx.tabfv, choose, sizeof(choose) ); + _mesa_memcpy( tnl->vtx.tabfv, choose, sizeof(choose) ); for (i = 0 ; i < _TNL_ATTRIB_MAX ; i++) tnl->vtx.attrsz[i] = 0; Index: src/mesa/tnl/t_vtx_x86.c =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/tnl/t_vtx_x86.c,v retrieving revision 1.19 diff -u -r1.19 t_vtx_x86.c --- src/mesa/tnl/t_vtx_x86.c 6 Jan 2005 07:45:17 -0000 1.19 +++ src/mesa/tnl/t_vtx_x86.c 15 Sep 2005 15:53:48 -0000 @@ -90,7 +90,7 @@ insert_at_head( &CACHE, dfn ); \ dfn->key = KEY; \ dfn->code = ALIGN_MALLOC( end - start, 16 ); \ - memcpy (dfn->code, start, end - start) + _mesa_memcpy (dfn->code, start, end - start) @@ -277,7 +277,7 @@ const char *end = WARP##_end; \ int offset = 0; \ code = ALIGN_MALLOC( end - start, 16 ); \ - memcpy (code, start, end - start); \ + _mesa_memcpy (code, start, end - start); \ FIXUP(code, 0, 0, (int)&(TNL_CONTEXT(ctx)->vtx.tabfv[ATTR][SIZE-1]));\ *(void **)&vfmt->FUNC = code; \ } while (0) @@ -351,7 +351,7 @@ const char *end = _tnl_x86_choose_fv_end; int offset = 0; code = ALIGN_MALLOC( end - start, 16 ); - memcpy (code, start, end - start); + _mesa_memcpy (code, start, end - start); FIXUP(code, 0, 0, attr); FIXUP(code, 0, 1, size + 1); FIXUPREL(code, 0, 2, do_choose); Index: src/mesa/x86/rtasm/x86sse.c =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/x86/rtasm/x86sse.c,v retrieving revision 1.4 diff -u -r1.4 x86sse.c --- src/mesa/x86/rtasm/x86sse.c 10 Jul 2005 11:14:00 -0000 1.4 +++ src/mesa/x86/rtasm/x86sse.c 15 Sep 2005 15:53:57 -0000 @@ -1,5 +1,6 @@ #if defined(USE_X86_ASM) +#include "imports.h" #include "x86sse.h" #define DISASSEM 0 @@ -970,13 +971,13 @@ void x86_init_func( struct x86_function *p ) { - p->store = malloc(1024); + p->store = _mesa_malloc(1024); p->csr = p->store; } void x86_release_func( struct x86_function *p ) { - free(p->store); + _mesa_free(p->store); }