Edits
authorbdemsky <bdemsky@uci.edu>
Tue, 20 Jun 2017 20:38:08 +0000 (13:38 -0700)
committerbdemsky <bdemsky@uci.edu>
Tue, 20 Jun 2017 20:38:08 +0000 (13:38 -0700)
src/AST/table.c
src/AST/table.h

index 1f95f43..6482d83 100644 (file)
@@ -7,10 +7,9 @@
 
 Table * allocTable(Set **domains, uint numDomain, Set * range){
     Table* table = (Table*) ourmalloc(sizeof(Table));
-    table->domains = allocDefVectorSet();
-    for(int i=0; i<numDomain; i++){
-        pushVectorSet(table->domains, domains[i]);
-    }
+               table->numDomains=numDomain;
+    table->domains = ourmalloc(numDomain*sizeof(Set *));
+               memcpy(table->domains, domains, numDomain * sizeof(Set *));
     table->range =range;
                return table;
 }
@@ -21,16 +20,12 @@ void addNewTableEntry(Table* table, uint64_t* inputs, uint inputSize, uint64_t r
 }
 
 void deleteTable(Table* table){
-    uint size = getSizeVectorSet(table->domains);
-    for(uint i=0; i<size; i++){
-       deleteSet(getVectorSet(table->domains,i));
-    }
-    ourfree(table->domains);
-    ourfree(table->range);
-    size = getSizeVectorTableEntry(table->entries);
-    for(uint i=0; i<size; i++){
-       deleteTableEntry(getVectorTableEntry(table->entries, i));
-    }
-    ourfree(table);
+       ourfree(table->domains);
+       uint size = getSizeVectorTableEntry(table->entries);
+       for(uint i=0; i<size; i++){
+               deleteTableEntry(getVectorTableEntry(table->entries, i));
+       }
+       deleteVectorTableEntry(table->entries);
+       ourfree(table);
 }
 
index 21e3223..cff8ec6 100644 (file)
@@ -5,9 +5,10 @@
 #include "structs.h"
 
 struct Table {
-    VectorSet* domains;
-    Set * range;
-    VectorTableEntry* entries;
+       Set ** domains;
+       Set * range;
+       uint numDomains;
+       VectorTableEntry* entries;
 };
 
 Table * allocTable(Set **domains, uint numDomain, Set * range);