XPath: Split optimize into optimize and optimize_self
XPath: Split optimize into optimize and optimize_self

This makes the code slightly more readable, but more importantly it fixes a
false positive in Clang static analyzer.

Fixes #47.

zeux/pugixml,zeux/pugixml,zeux/pugixml,zeux/pugixml