static inline void freeStateTree(StateTree * tree) { freeArrayList(tree->nodeArrays); freeArrayList(tree->dataArrays); freeArrayList(tree->successorArrays); FREE(tree); }
/* Create FastIntBuffer with initial page size of 1024 ints */ FastIntBuffer *createFastIntBuffer(){ FastIntBuffer *fib = NULL; ArrayList *al= createArrayList(); if (al==NULL){ throwException2(out_of_mem, "FastIntBuffer allocation failed "); return NULL; } fib = (FastIntBuffer *)malloc(sizeof(FastIntBuffer)); if (fib==NULL) { freeArrayList(al); throwException2(out_of_mem, "FastIntBuffer allocation failed "); return NULL; } fib->size = 0; fib->capacity = 0; fib->pageSize = 1<<10; fib->exp = 10; fib->r = 1023; fib->al = al; return fib; }
/* create FastLongBuffer with page size of (1<<e) longs*/ FastLongBuffer *createFastLongBuffer2(int exp){ FastLongBuffer *flb = NULL; ArrayList *al= createArrayList(); if (al==NULL){ throwException2(out_of_mem, "FastLongBuffer allocation failed "); return NULL; } flb = (FastLongBuffer *)malloc(sizeof(FastLongBuffer)); if (flb==NULL) { freeArrayList(al); throwException2(out_of_mem, "FastLongBuffer allocation failed "); return NULL; } flb->size = 0; flb->capacity = 0; flb->pageSize = 1<<exp; flb->exp = exp; flb->r = (1<<exp)-1; flb->al = al; return flb; }
/* Free FastIntBuffer */ void freeFastIntBuffer(FastIntBuffer *fib){ if (fib != NULL) { freeArrayList(fib->al); free(fib); } }
/* free FastLongBuffer */ void freeFastLongBuffer(FastLongBuffer *flb){ if (flb != NULL) { freeArrayList(flb->al); free(flb); } }