From: bdemsky Date: Mon, 1 Nov 2004 03:28:30 +0000 (+0000) Subject: Fixed a memory leak in the runtime...Print neater text. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=5bdc1b8dceb971518a0e836661f01e783aa37d63;p=repair.git Fixed a memory leak in the runtime...Print neater text. --- diff --git a/Repair/RepairCompiler/MCC/CRuntime/tmap.c b/Repair/RepairCompiler/MCC/CRuntime/tmap.c index 22333fd..25c326d 100755 --- a/Repair/RepairCompiler/MCC/CRuntime/tmap.c +++ b/Repair/RepairCompiler/MCC/CRuntime/tmap.c @@ -17,7 +17,7 @@ struct typemap * allocatetypemap() { void freefunction(void *ptr) { if(ptr!=NULL) { - free((struct structuremap *)ptr); + freestructuremap((struct structuremap *)ptr); } } diff --git a/Repair/RepairCompiler/MCC/IR/PrintWrapper.java b/Repair/RepairCompiler/MCC/IR/PrintWrapper.java index a855aaf..e74567c 100755 --- a/Repair/RepairCompiler/MCC/IR/PrintWrapper.java +++ b/Repair/RepairCompiler/MCC/IR/PrintWrapper.java @@ -21,6 +21,11 @@ public class PrintWrapper { if (!buffer) output.flush(); } + private void doindent() { + for (int i = 0; i < indent; i++) { + output.print(" "); + } + } void println(String s) { if (buffer) buffered.append(s+"\n"); @@ -34,6 +39,7 @@ public class PrintWrapper { //Print out declarations for(Iterator it=vartable.keySet().iterator();it.hasNext();) { String var=(String)it.next(); + doindent(); output.println(((String)vartable.get(var))+" "+var+";"); } output.print(buffered.toString()); diff --git a/Repair/RepairCompiler/MCC/IR/RepairGenerator.java b/Repair/RepairCompiler/MCC/IR/RepairGenerator.java index 2ece344..cc07b7e 100755 --- a/Repair/RepairCompiler/MCC/IR/RepairGenerator.java +++ b/Repair/RepairCompiler/MCC/IR/RepairGenerator.java @@ -494,7 +494,7 @@ public class RepairGenerator { craux.outputline(relation.getSafeSymbol() + "_hashinv = noargallocateSimpleHash();"); } } - + craux.outputline("return thisvar;"); craux.endblock(); crhead.outputline("};"); craux.outputline("void free"+name+"(struct "+ name +"* thisvar)"); @@ -547,7 +547,9 @@ public class RepairGenerator { crhead.outputline("void doanalysis(struct "+name+"_state *);"); craux.outputline("void doanalysis(struct "+name+"_state * thisvar)"); craux.startblock(); + craux.outputline("int highmark;"); /* This declaration is special...need it to be first */ craux.startBuffer(); + if (Compiler.TIME) { craux.outputline("struct timeval _begin_time,_end_time;"); craux.outputline("gettimeofday(&_begin_time,NULL);"); @@ -557,7 +559,7 @@ public class RepairGenerator { craux.outputline("rebuildcount=0;"); craux.outputline("abstractcount=0;"); } - craux.addDeclaration("int","highmark"); + craux.addDeclaration("struct "+name+ " * ",oldmodel.getSafeSymbol()); craux.outputline(oldmodel.getSafeSymbol()+"=0;");