This isn't quite a full review, but here goes anyway:
It looks like you're using 8-space indents. That's quite a lot. I think 4 is more common, but it is a matter of preference and it is consistent, so it's definitely not wrong
You have
KEY
, presumably a typedef ofchar*
, but then you callstrcmp
on it. If you want it to be general across key types (which is a pretty good idea IMO), you should pass in a comparator function that takes two keys as arguments.I'm going to assume that the other fields of
TNODE
exist for some reason, but is there a chance you could move them out torbtree_t
and leaveTNODE
smaller?I don't know the naming conventions for types in C, so don't take this as implicit agreement or disagreement
talloc
andlalloc
probably don't need to be their own functions;malloc(sizeof(TNODE))
is probably sufficient