summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/main/imports.c13
-rw-r--r--src/mesa/main/imports.h2
-rw-r--r--src/mesa/main/texcompress_fxt1.c4
-rw-r--r--src/mesa/main/texenvprogram.c8
-rw-r--r--src/mesa/main/texobj.c2
-rw-r--r--src/mesa/math/m_matrix.c4
-rw-r--r--src/mesa/shader/arbprogparse.c2
-rw-r--r--src/mesa/shader/nvfragparse.c4
-rw-r--r--src/mesa/shader/program.c2
-rw-r--r--src/mesa/shader/slang/slang_compile.c4
-rw-r--r--src/mesa/shader/slang/slang_execute.c2
-rw-r--r--src/mesa/swrast/s_nvfragprog.c4
-rw-r--r--src/mesa/tnl/t_context.c2
-rw-r--r--src/mesa/tnl/t_vb_arbprogram.c2
-rw-r--r--src/mesa/tnl/t_vb_arbprogram_sse.c2
-rw-r--r--src/mesa/tnl/t_vertex_sse.c2
-rw-r--r--src/mesa/tnl/t_vp_build.c2
-rw-r--r--src/mesa/tnl/t_vtx_api.c2
-rw-r--r--src/mesa/tnl/t_vtx_x86.c6
-rw-r--r--src/mesa/x86/rtasm/x86sse.c5
20 files changed, 45 insertions, 29 deletions
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index fec0d338448..8d39f77b410 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -259,6 +259,19 @@ _mesa_bzero( void *dst, size_t n )
#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
+}
+
/*@}*/
diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
index 27cc1a57f78..134eff84b34 100644
--- a/src/mesa/main/imports.h
+++ b/src/mesa/main/imports.h
@@ -613,6 +613,8 @@ _mesa_memset16( unsigned short *dst, unsigned short val, size_t n );
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);
diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c
index 748824194ce..5fc41fa6bc9 100644
--- a/src/mesa/main/texcompress_fxt1.c
+++ b/src/mesa/main/texcompress_fxt1.c
@@ -474,7 +474,7 @@ fxt1_choose (GLfloat vec[][MAX_COMP], GLint nv,
} 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 @@ fxt1_quantize (GLuint *cc, const GLubyte *lines[], GLint comps)
if (comps == 3) {
/* make the whole block opaque */
- memset(input, -1, sizeof(input));
+ _mesa_memset(input, -1, sizeof(input));
}
/* 8 texels each line */
diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c
index 68dcc51b4c5..2ffb1774a34 100644
--- a/src/mesa/main/texenvprogram.c
+++ b/src/mesa/main/texenvprogram.c
@@ -480,7 +480,7 @@ emit_op(struct texenv_fragment_program *p,
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 @@ static struct ureg emit_combine( struct texenv_fragment_program *p,
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 @@ static void create_new_program(struct state_key *key, GLcontext *ctx,
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 @@ static void *search_cache( struct texenvprog_cache *cache,
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;
}
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 5594cd9382b..3c74e748722 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -246,7 +246,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
/* 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;
diff --git a/src/mesa/math/m_matrix.c b/src/mesa/math/m_matrix.c
index 408db9b9631..ff32e3d94bf 100644
--- a/src/mesa/math/m_matrix.c
+++ b/src/mesa/math/m_matrix.c
@@ -804,8 +804,8 @@ _math_matrix_rotate( GLmatrix *mat,
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;
diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c
index 3c62a1f4866..23cb46637c1 100644
--- a/src/mesa/shader/arbprogparse.c
+++ b/src/mesa/shader/arbprogparse.c
@@ -560,7 +560,7 @@ var_cache_find (struct var_cache *va, GLubyte * name)
/*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;
diff --git a/src/mesa/shader/nvfragparse.c b/src/mesa/shader/nvfragparse.c
index 17dd42bbf82..4f27a96eebf 100644
--- a/src/mesa/shader/nvfragparse.c
+++ b/src/mesa/shader/nvfragparse.c
@@ -1588,7 +1588,7 @@ PrintSrcReg(const struct fragment_program *program,
}
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 @@ PrintSrcReg(const struct fragment_program *program,
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) {
diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c
index e7211981366..70a9ced7a66 100644
--- a/src/mesa/shader/program.c
+++ b/src/mesa/shader/program.c
@@ -1304,7 +1304,7 @@ _mesa_GetProgramRegisterfvMESA(GLenum target,
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]);
diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c
index 2377173cf0a..0ff450ca91c 100644
--- a/src/mesa/shader/slang/slang_compile.c
+++ b/src/mesa/shader/slang/slang_compile.c
@@ -635,7 +635,7 @@ int slang_info_log_error (slang_info_log *log, const char *msg, ...)
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 @@ int slang_info_log_warning (slang_info_log *log, const char *msg, ...)
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);
diff --git a/src/mesa/shader/slang/slang_execute.c b/src/mesa/shader/slang/slang_execute.c
index d47f3eaca24..78a638b4445 100644
--- a/src/mesa/shader/slang/slang_execute.c
+++ b/src/mesa/shader/slang/slang_execute.c
@@ -169,7 +169,7 @@ static void dump (const slang_assembly_file *file)
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;
diff --git a/src/mesa/swrast/s_nvfragprog.c b/src/mesa/swrast/s_nvfragprog.c
index 1f9ec448c2a..931bf64f925 100644
--- a/src/mesa/swrast/s_nvfragprog.c
+++ b/src/mesa/swrast/s_nvfragprog.c
@@ -1034,8 +1034,8 @@ execute_program( GLcontext *ctx,
{
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 );
diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c
index 472b97bfe57..cda4cf2cbd4 100644
--- a/src/mesa/tnl/t_context.c
+++ b/src/mesa/tnl/t_context.c
@@ -73,7 +73,7 @@ _tnl_CreateContext( GLcontext *ctx )
return GL_FALSE;
}
- if (getenv("MESA_CODEGEN"))
+ if (_mesa_getenv("MESA_CODEGEN"))
tnl->AllowCodegen = GL_TRUE;
/* Initialize the VB.
diff --git a/src/mesa/tnl/t_vb_arbprogram.c b/src/mesa/tnl/t_vb_arbprogram.c
index 5cee3d78dc3..9fc49a2ceef 100644
--- a/src/mesa/tnl/t_vb_arbprogram.c
+++ b/src/mesa/tnl/t_vb_arbprogram.c
@@ -1031,7 +1031,7 @@ static void compile_vertex_program( struct vertex_program *program,
/* 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:
diff --git a/src/mesa/tnl/t_vb_arbprogram_sse.c b/src/mesa/tnl/t_vb_arbprogram_sse.c
index 330d30efb92..c5da430dd37 100644
--- a/src/mesa/tnl/t_vb_arbprogram_sse.c
+++ b/src/mesa/tnl/t_vb_arbprogram_sse.c
@@ -1181,7 +1181,7 @@ _tnl_sse_codegen_vertex_program(struct tnl_compiled_program *p)
{
struct compilation cp;
- memset(&cp, 0, sizeof(cp));
+ _mesa_memset(&cp, 0, sizeof(cp));
cp.p = p;
cp.have_sse2 = 1;
diff --git a/src/mesa/tnl/t_vertex_sse.c b/src/mesa/tnl/t_vertex_sse.c
index 13dc2f4d534..ad4cc62d5f7 100644
--- a/src/mesa/tnl/t_vertex_sse.c
+++ b/src/mesa/tnl/t_vertex_sse.c
@@ -637,7 +637,7 @@ void _tnl_generate_sse_emit( GLcontext *ctx )
return;
}
- memset(&p, 0, sizeof(p));
+ _mesa_memset(&p, 0, sizeof(p));
p.ctx = ctx;
p.inputs_safe = 0; /* for now */
diff --git a/src/mesa/tnl/t_vp_build.c b/src/mesa/tnl/t_vp_build.c
index e62c5b374c2..3e77758edbb 100644
--- a/src/mesa/tnl/t_vp_build.c
+++ b/src/mesa/tnl/t_vp_build.c
@@ -1406,7 +1406,7 @@ static void *search_cache( struct tnl_cache *cache,
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;
}
diff --git a/src/mesa/tnl/t_vtx_api.c b/src/mesa/tnl/t_vtx_api.c
index fa9e04ad336..ae2056971ef 100644
--- a/src/mesa/tnl/t_vtx_api.c
+++ b/src/mesa/tnl/t_vtx_api.c
@@ -943,7 +943,7 @@ void _tnl_vtx_init( GLcontext *ctx )
_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;
diff --git a/src/mesa/tnl/t_vtx_x86.c b/src/mesa/tnl/t_vtx_x86.c
index 38cdad451c7..1812cfa4715 100644
--- a/src/mesa/tnl/t_vtx_x86.c
+++ b/src/mesa/tnl/t_vtx_x86.c
@@ -90,7 +90,7 @@ EXTERN( _tnl_x86_choose_fv );
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 @@ do { \
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 @@ void _tnl_x86choosers( tnl_attrfv_func (*choose)[4],
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);
diff --git a/src/mesa/x86/rtasm/x86sse.c b/src/mesa/x86/rtasm/x86sse.c
index adc7126801d..40ffc03204e 100644
--- a/src/mesa/x86/rtasm/x86sse.c
+++ b/src/mesa/x86/rtasm/x86sse.c
@@ -1,5 +1,6 @@
#if defined(USE_X86_ASM)
+#include "imports.h"
#include "x86sse.h"
#define DISASSEM 0
@@ -970,13 +971,13 @@ struct x86_reg x86_fn_arg( struct x86_function *p,
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);
}