xmlXPathFormatNumber contains redundant code
if (buffersize > (int)sizeof are unnecessary since that function is only called from a single place, and that buffer has size 99.
Furthermore, if the buffersize were too small, the buffer would have been left uninitialized, invoking undefined behavior.
Furthermore, buffersize should be
size_t instead of
int, to make the casts unnecessary.
I stumbled upon this code because GCC issued a warning about an out-of-bounds array access in the "Finally copy result back to caller" paragraph, but I think that's a false positive.
Still, it's confusing in that paragraph to use
memmove when a simple
memcpy is enough.