sparklemotion/nokogiri — pull request #993 by larskanis (2013-10-30 16:15:48+00:00)
Title: Work around broken vsnprintf implementation in mingw.

This fixes currently failing tests in XML::TestSaxEntityReference: https://gist.github.com/larskanis/7186885

It affects the currently released nokogiri-1.6.0-x86-mingw32.gem for both ruby-1.9 and ruby-2.0.

I found that the following build environments have this bug and verified that the attached patch works around it on all of them:
```gcc (tdm-1) 4.5.2``` - used for native builds on ruby-1.9
```gcc (rubenvb-4.7.2-release) 4.7.2``` - used for native build on ruby-2.0 (both x86 and x64)
```i586-mingw32msvc-gcc (GCC) 4.2.1-sjlj (mingw32-2)``` - used to cross build for ruby-1.9
```x86_64-w64-mingw32-gcc (rubenvb-4.7.2-release) 4.7.2``` - used to cross build for ruby-2.0-x64
```i686-w64-mingw32-gcc (rubenvb-4.7.2-release) 4.7.2``` - used to cross build for ruby-2.0-x86

This issue is independent from #989, but also affects the x64-mingw32 version.

All nokogiri tests pass when the gem is built with any of the above environments and when using this PR together with #989. Verified with Ruby-x64 2.0.0-p0, Ruby-x86 2.0.0-p0 and Ruby-x86 1.9.3-p392 installed per RubyInstaller.

The buildin vasprintf() function is also used on Solaris, which I'm not able to test. But the given workaround should work on any platform that implements vsnprintf() according to C99.