X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=lzindex%2Flztrie.c;h=2ac090a2c73fe878f98e7b90b18f88983ec12d36;hb=refs%2Fheads%2Flocal-new-trunk;hp=0a4c56b481f2a4e420beb1951881bfb46dd6e7e8;hpb=5d74bc076c9d15d607d183c16ff8468ea961a0f9;p=SXSI%2FTextCollection.git diff --git a/lzindex/lztrie.c b/lzindex/lztrie.c index 0a4c56b..2ac090a 100644 --- a/lzindex/lztrie.c +++ b/lzindex/lztrie.c @@ -59,6 +59,8 @@ lztrie buildLZTrie(byte *text, byte s, uint text_length) destroyTrie(T); LZT = createLZTrie(parent,letters,Node,n,text_length); + + free(Node); Node = 0; return LZT; } @@ -73,6 +75,7 @@ void destroyLZTrie(lztrie T) destroyNodemap(T->Node); destroyPosition(T->TPos); free(T->boost); + free(T); } @@ -132,7 +135,7 @@ lztrie loadLZTrie (FILE *f) i = 1; // shortcut for first child of root while (i != 2*T->n-1) { // shortcut for its closing parenthesis T->boost[T->letters[i-rank(T->pdata->bdata,i)]] = i; - // shortcut for leftrankLZTrie + // shortcut for leftrankLZTrie i = findclose(T->pdata,i)+1; } @@ -171,7 +174,7 @@ trieNode parentLZTrie (lztrie T, trieNode i) { if (i == ROOT) return NULLT; // parent of root if (T->boost[T->letters[i-rank(T->pdata->bdata,i)]] == i) return ROOT; - return enclose (T->pdata,i); + return _enclose (T->pdata,i); } // subtree size