From 4bd915e48b6b6278ed8c4b7be95781535f2ce10a Mon Sep 17 00:00:00 2001 From: Adrian Thurston Date: Thu, 25 Dec 2014 11:46:23 -0500 Subject: some renaming and cleanup --- src/struct.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/struct.c (limited to 'src/struct.c') diff --git a/src/struct.c b/src/struct.c new file mode 100644 index 00000000..8a13e9b5 --- /dev/null +++ b/src/struct.c @@ -0,0 +1,24 @@ +#include +#include + +struct colm_struct *colm_new_struct( Program *prg, int id ) +{ + int structSize = prg->rtd->selInfo[id].size; + size_t memsize = sizeof(struct colm_struct) + ( sizeof(Tree*) * structSize ); + struct colm_struct *item = (struct colm_struct*) malloc( memsize ); + memset( item, 0, memsize ); + item->id = id; + + if ( prg->heap.head == 0 ) { + prg->heap.head = prg->heap.tail = item; + item->prev = item->next = 0; + } + else { + item->prev = prg->heap.tail; + item->next = 0; + prg->heap.tail->next = item; + prg->heap.tail = item; + } + + return item; +} -- cgit v1.2.1