/[ascend]/trunk/ascend/compiler/destroyinst.c
ViewVC logotype

Diff of /trunk/ascend/compiler/destroyinst.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2688 by jpye, Mon Mar 4 08:11:49 2013 UTC revision 2689 by jpye, Mon Mar 4 11:28:19 2013 UTC
# Line 257  static void RemoveRelationLinks(struct I Line 257  static void RemoveRelationLinks(struct I
257    register unsigned long c,length;    register unsigned long c,length;
258    assert(list!=NULL);    assert(list!=NULL);
259    length = gl_length(list);    length = gl_length(list);
260    for(c=1;c<=length;c++) {    for(c=1;c<=length;c++){
261      CONSOLE_DEBUG("Var %p: remove links to this var in relation %p",i, INST(gl_fetch(list,c)));      //CONSOLE_DEBUG("Var %p: referenced in relation %p",i, INST(gl_fetch(list,c)));
262      ChangeRelationPointers(INST(gl_fetch(list,c)),i,INST(NULL));      ChangeRelationPointers(INST(gl_fetch(list,c)),i,INST(NULL));
263    }    }
264    gl_destroy(list);    gl_destroy(list);
# Line 306  static void DestroyAtomChildren( Line 306  static void DestroyAtomChildren(
306      AssertMemory(*i);      AssertMemory(*i);
307      if ((*i)->t==SET_INST) {      if ((*i)->t==SET_INST) {
308        if (S_INST(*i)->list!=NULL) {        if (S_INST(*i)->list!=NULL) {
309      DestroySet(S_INST(*i)->list);          DestroySet(S_INST(*i)->list);
310        }        }
311      }      }
312      i++;            /* position pointer for next child */      i++;            /* position pointer for next child */
# Line 407  static void DestroyInstanceParts(struct Line 407  static void DestroyInstanceParts(struct
407      ascfree((char *)i);      ascfree((char *)i);
408      return;      return;
409    case REAL_ATOM_INST:    case REAL_ATOM_INST:
410      CONSOLE_DEBUG("Removing parts of var %p",i);      //CONSOLE_DEBUG("REMOVE PARTS OF VAR %p =========",i);
411      /* deallocate dynamic memory used by children */      /* deallocate dynamic memory used by children */
412      DestroyAtomChildren(RA_CHILD(i,0),ChildListLen(GetChildList(RA_INST(i)->desc)));      DestroyAtomChildren(RA_CHILD(i,0),ChildListLen(GetChildList(RA_INST(i)->desc)));
413      /* continue delete the atom */      /* continue delete the atom */
# Line 493  static void DestroyInstanceParts(struct Line 493  static void DestroyInstanceParts(struct
493      ascfree((char *)i);      ascfree((char *)i);
494      return;      return;
495    case REL_INST:    case REL_INST:
496      CONSOLE_DEBUG("Removing parts of rel %p",i);      //CONSOLE_DEBUG("REMOVE PARTS OF REL %p ===================",i);
497      /* deallocate dynamic memory used by children */      /* deallocate dynamic memory used by children */
498      DestroyAtomChildren(REL_CHILD(i,0),      DestroyAtomChildren(REL_CHILD(i,0),
499      ChildListLen(GetChildList(RELN_INST(i)->desc)));      ChildListLen(GetChildList(RELN_INST(i)->desc)));
# Line 512  static void DestroyInstanceParts(struct Line 512  static void DestroyInstanceParts(struct
512      }      }
513      /* delete references of reals to this expression */      /* delete references of reals to this expression */
514      if(RELN_INST(i)->ptr != NULL){      if(RELN_INST(i)->ptr != NULL){
515        CONSOLE_DEBUG("Destroying links to relation %p",i);        //CONSOLE_DEBUG("Destroying links to relation %p",i);
516        DestroyRelation(RELN_INST(i)->ptr,i);        DestroyRelation(RELN_INST(i)->ptr,i);
517        RELN_INST(i)->ptr = NULL;        RELN_INST(i)->ptr = NULL;
518      }      }

Legend:
Removed from v.2688  
changed lines
  Added in v.2689

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22