_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;
}
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);
}