use size_t for sizes instead of int
made xstrdup a bit faster (theoretically)
removed malloc casts(!), changed sizeof usages

using "foo = malloc(sizeof *foo)" is more change-friendly than
"foo = malloc(sizeof (type*)"
Merge pull request #17 from Foxtacles/upstream

Contributions by rmartinjak