Quantcast
Channel: User raptortech97 - Code Review Stack Exchange
Viewing all articles
Browse latest Browse all 22

Answer by raptortech97 for Red Black Tree Implementation

$
0
0

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 of char*, but then you call strcmp 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 to rbtree_t and leave TNODE smaller?

  • I don't know the naming conventions for types in C, so don't take this as implicit agreement or disagreement

  • talloc and lalloc probably don't need to be their own functions; malloc(sizeof(TNODE)) is probably sufficient


Viewing all articles
Browse latest Browse all 22

Trending Articles