From 383c39e58e0ab888afac473526109b62ec0f8f6f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 25 Aug 2006 15:14:25 +0000 Subject: use _mesa_alloc_instructions() --- src/mesa/shader/arbprogparse.c | 3 +-- src/mesa/shader/nvfragparse.c | 7 +++---- src/mesa/shader/nvvertparse.c | 3 +-- 3 files changed, 5 insertions(+), 8 deletions(-) (limited to 'src/mesa/shader') diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index 6c1fb04de7..734c753eb6 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -4000,8 +4000,7 @@ _mesa_parse_arb_program(GLcontext *ctx, GLenum target, /* Initialize the arb_program struct */ program->Base.String = strz; - program->Base.Instructions = (struct prog_instruction *) - _mesa_malloc(MAX_INSTRUCTIONS * sizeof(struct prog_instruction)); + program->Base.Instructions = _mesa_alloc_instructions(MAX_INSTRUCTIONS); program->Base.NumInstructions = program->Base.NumTemporaries = program->Base.NumParameters = diff --git a/src/mesa/shader/nvfragparse.c b/src/mesa/shader/nvfragparse.c index 13610417e9..49ce220944 100644 --- a/src/mesa/shader/nvfragparse.c +++ b/src/mesa/shader/nvfragparse.c @@ -1534,14 +1534,13 @@ _mesa_parse_nv_fragment_program(GLcontext *ctx, GLenum dstTarget, /* copy the compiled instructions */ assert(parseState.numInst <= MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS); - newInst = (struct prog_instruction *) - MALLOC(parseState.numInst * sizeof(struct prog_instruction)); + newInst = _mesa_alloc_instructions(parseState.numInst); if (!newInst) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV"); return; /* out of memory */ } - MEMCPY(newInst, instBuffer, - parseState.numInst * sizeof(struct prog_instruction)); + _mesa_memcpy(newInst, instBuffer, + parseState.numInst * sizeof(struct prog_instruction)); /* install the program */ program->Base.Target = target; diff --git a/src/mesa/shader/nvvertparse.c b/src/mesa/shader/nvvertparse.c index 927bf60c9f..ee6d9f122c 100644 --- a/src/mesa/shader/nvvertparse.c +++ b/src/mesa/shader/nvvertparse.c @@ -1374,8 +1374,7 @@ _mesa_parse_nv_vertex_program(GLcontext *ctx, GLenum dstTarget, /* copy the compiled instructions */ assert(parseState.numInst <= MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS); - newInst = (struct prog_instruction *) - _mesa_malloc(parseState.numInst * sizeof(struct prog_instruction)); + newInst = _mesa_alloc_instructions(parseState.numInst); if (!newInst) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV"); _mesa_free(programString); -- cgit v1.2.3