Be consistent
[satune.git] / src / AST / element.c
index 3cec4770d3601f34282bd3a74f6a62127b566012..36005e630a35366dc3cf380c99db6b5036437991 100644 (file)
@@ -15,7 +15,9 @@ Element* allocElementFunction(Function * function, Element ** array, uint numArr
        GETELEMENTTYPE(tmp)= ELEMFUNCRETURN;
        tmp->function=function;
        tmp->overflowstatus = overflowstatus;
-       tmp->Elements = allocVectorArrayElement(numArrays, array);
+       tmp->inputs=ourmalloc(sizeof(Element *)*numArrays);
+       tmp->numInputs=numArrays;
+       memcpy(tmp->inputs, array, numArrays*sizeof(Element *));
        allocInlineDefVectorASTNode(GETELEMENTPARENTS(tmp));
        for(uint i=0;i<numArrays;i++)
                pushVectorASTNode(GETELEMENTPARENTS(array[i]), (ASTNode *) tmp);
@@ -23,6 +25,13 @@ Element* allocElementFunction(Function * function, Element ** array, uint numArr
 }
 
 void deleteElement(Element *This) {
+       switch(GETELEMENTTYPE(This)) {
+       case ELEMFUNCRETURN:
+               ourfree(((ElementFunction *)This)->inputs);
+               break;
+       default:
+               ;
+       }
        deleteVectorArrayASTNode(GETELEMENTPARENTS(This));
        ourfree(This);
 }