No rush on the review. I had to put the code aside for a while (pesky day job :-) and had to write some tests to try to hit most code paths.
I tried not to change too much existing code since the change is pretty big to begin with. I only tried to rewrite things that affected performance or optimize using the new functions. I tried to use the profiler (-pg) but was not able to get citserver to output the profile file, so I really have not tested before/after. If you know how to get the profiler working, I would be interest in seeing where we can optimize things for the biggest bang for the buck.