use _mesa_alloc_instructions()
authorBrian Paul <brian.paul@tungstengraphics.com>
Fri, 25 Aug 2006 15:14:25 +0000 (15:14 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Fri, 25 Aug 2006 15:14:25 +0000 (15:14 +0000)
src/mesa/shader/arbprogparse.c
src/mesa/shader/nvfragparse.c
src/mesa/shader/nvvertparse.c

index 6c1fb04de707daf8c94712864bb1ad4d5332ba26..734c753eb6fb59b6b3fcf3f2340b8c076dba7518 100644 (file)
@@ -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 =
index 13610417e90f769dfec5438573f8511abbf389f6..49ce220944eba19e923084e2a2aad54d9dea206c 100644 (file)
@@ -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;
index 927bf60c9fc8a41312deceab3a802256fe1abd50..ee6d9f122cb9caf24c15acae153ea316318283c5 100644 (file)
@@ -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);