fix instruction comment code
authorBrian <brian@yutani.localnet.net>
Fri, 20 Apr 2007 14:12:17 +0000 (08:12 -0600)
committerBrian <brian@yutani.localnet.net>
Sat, 21 Apr 2007 16:05:05 +0000 (10:05 -0600)
src/mesa/shader/prog_instruction.c
src/mesa/shader/program.c

index 1e8e08122628436232cdcd1af80d6210016d5a04..d6b5652a2767cf2ced3e85b1ff895f6ce9f5207d 100644 (file)
@@ -108,7 +108,13 @@ struct prog_instruction *
 _mesa_copy_instructions(struct prog_instruction *dest,
                         const struct prog_instruction *src, GLuint n)
 {
-   return _mesa_memcpy(dest, src, n * sizeof(struct prog_instruction));
+   GLuint i;
+   _mesa_memcpy(dest, src, n * sizeof(struct prog_instruction));
+   for (i = 0; i < n; i++) {
+      if (src[i].Comment)
+         dest[i].Comment = _mesa_strdup(src[i].Comment);
+   }
+   return dest;
 }
 
 
index e872d78611f54c184d55cfad1b79d947440d2275..420591982825d95fc8401f784032b44a726da747 100644 (file)
@@ -281,6 +281,8 @@ _mesa_delete_program(GLcontext *ctx, struct gl_program *prog)
       for (i = 0; i < prog->NumInstructions; i++) {
          if (prog->Instructions[i].Data)
             _mesa_free(prog->Instructions[i].Data);
+         if (prog->Instructions[i].Comment)
+            _mesa_free((char *) prog->Instructions[i].Comment);
       }
       _mesa_free(prog->Instructions);
    }