mesa: added _mesa_free_instructions()
authorBrian Paul <brian.paul@tungstengraphics.com>
Wed, 14 May 2008 18:37:07 +0000 (12:37 -0600)
committerBrian Paul <brian.paul@tungstengraphics.com>
Wed, 14 May 2008 18:37:07 +0000 (12:37 -0600)
cherry-picked from gallium-0.1

src/mesa/shader/prog_instruction.c
src/mesa/shader/prog_instruction.h

index d6b5652a2767cf2ced3e85b1ff895f6ce9f5207d..329fec3bac70336ef16458aeb93e9e3a43c55423 100644 (file)
@@ -118,6 +118,23 @@ _mesa_copy_instructions(struct prog_instruction *dest,
 }
 
 
+/**
+ * Free an array of instructions
+ */
+void
+_mesa_free_instructions(struct prog_instruction *inst, GLuint count)
+{
+   GLuint i;
+   for (i = 0; i < count; i++) {
+      if (inst[i].Data)
+         _mesa_free(inst[i].Data);
+      if (inst[i].Comment)
+         _mesa_free((char *) inst[i].Comment);
+   }
+   _mesa_free(inst);
+}
+
+
 /**
  * Basic info about each instruction
  */
index c800757aa0f6c993fa0d0e32e508e966aa5ff22a..ce4daec104111833ca7a5608d887e5cdada80c55 100644 (file)
@@ -437,6 +437,9 @@ extern struct prog_instruction *
 _mesa_copy_instructions(struct prog_instruction *dest,
                         const struct prog_instruction *src, GLuint n);
 
+extern void
+_mesa_free_instructions(struct prog_instruction *inst, GLuint count);
+
 extern GLuint
 _mesa_num_inst_src_regs(gl_inst_opcode opcode);