Term was modified to have a reference count 'ref' in stead of the 'status' variable. The idea is to change a ref to 0 when the payload is not needed and then call free() on it by checking if ref is zero.
Term's termcmp() was modified to compare memory addresses for equality.
Post uses a reference count variable too.
Post now stores the docid string in stead of a unsigned integer. Since ID strings reside in only one place, Posts point to memory and do not carry around copies or use a level of indirection to refer to a document.
Post's postcmp compares memory addresses for equality in stead of calling strcmp() on the strings.
Since deallocation needed on Term and Post turns out to be shallow only, their deallocation routines were simplified. At this point none of them are in use; free() is good enough.
ii.c now uses a the khash.h interface to make use of two hash tables to store the doc ID strings and terms. Pointers from the nodes in the BST point to this data replacing the need to keep copies of strings in the trees.
tfile.c had mallocs() allocating wrong amounts of memory as valgrind pointed out. These were fixed.
Makefile uses the -o0 in CFLAGS so that valgrind may be used on the output.