Fixed a memory leak in the runtime...Print neater text.
authorbdemsky <bdemsky>
Mon, 1 Nov 2004 03:28:30 +0000 (03:28 +0000)
committerbdemsky <bdemsky>
Mon, 1 Nov 2004 03:28:30 +0000 (03:28 +0000)
Repair/RepairCompiler/MCC/CRuntime/tmap.c
Repair/RepairCompiler/MCC/IR/PrintWrapper.java
Repair/RepairCompiler/MCC/IR/RepairGenerator.java

index 22333fd1570927e8c773944ab8207937f7da12d7..25c326d9068fcbfce731172d1d9170aff7a6e5ba 100755 (executable)
@@ -17,7 +17,7 @@ struct typemap * allocatetypemap() {
 
 void freefunction(void *ptr) {
   if(ptr!=NULL) {
-    free((struct structuremap *)ptr);
+    freestructuremap((struct structuremap *)ptr);
   }
 }
 
index a855aaf77ec9aafda4d36d51c31a5ac79965e638..e74567c9ff342f463444bcb615877c5fd8279bb1 100755 (executable)
@@ -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());
index 2ece34467b8c1b6f41db3b85f6ff185d1c424198..cc07b7e342108a8df208fe2a6af6f7be26d9edb4 100755 (executable)
@@ -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;");