parser.c: shrink the input buffer when appropriate

Fixes GNOME/libxml2#200

Also see discussions at:
- GNOME/libxml2#192
- nwellnhof/libxml2@99bda1e1
- https://github.com/sparklemotion/nokogiri/issues/2132
12 jobs for flavorjones-fix-missing-buffer-shrink in 9 minutes and 2 seconds (queued for 1 second)
latest
Status Job ID Name Coverage
  Test
passed #1118080
clang:asan

00:03:54

passed #1118081
clang:msan

00:04:47

passed #1118084
cmake:linux:clang:shared

00:02:51

passed #1118085
cmake:linux:clang:static

00:02:39

passed #1118082
cmake:linux:gcc:shared

00:02:52

passed #1118083
cmake:linux:gcc:static

00:03:31

passed #1118086
win32-ps
cmake:mingw:w64-i686:shared

00:04:45

passed #1118087
win32-ps
cmake:mingw:w64-i686:static

00:03:00

passed #1118088
win32-ps
cmake:mingw:w64-x86_64:shared

00:02:48

passed #1118089
win32-ps
cmake:mingw:w64-x86_64:static

00:04:15

passed #1118078
gcc

00:02:19

passed #1118079
gcc:python3

00:03:09