Several improvements in design, safety and performance

That for now.
Next saving libass errors from callback into state, store header copy in state, change events storing and add code comments.
I think this is redundant because the compiler only uses the last optimization flag passed to it. This is true for gcc at least, and I'd be quite surprised if clang behaved differently. [bad source](http://stackoverflow.com/questions/5557261/gcc-multiple-optimization-flags)