use actual type to get the size

see: http://bugs.ruby-lang.org/issues/6144
(cherry picked from commit cc10b3df14e704c7629c69b08ae3b480b6686a28)
fix: segmation fault occurs when many groups are used (Close #24)

Allocate Onigmo's stack from a heap instead of a stack when many groups
are used.

see: https://bugs.ruby-lang.org/issues/8716
(cherry picked from commit b9fba1dc63ccb42a86e934011b468e6022fabb74)

Conflicts:

	regexec.c
fix memory leaks

Also add NULL checks for safety.
(cherry picked from commit c1fc76b9bd463948ffc5058bc352bf93732f0314)
additional fix for #24

Use xalloca() to allocate a stack.
(cherry picked from commit a0efc0a200f7108ca3d5ac3039c8f952e0051619)
Fix build on mingw
(cherry picked from commit 20047796196d1ae3dda41e6b5ac69717a565eee1)
Add Makefile for mingw
(cherry picked from commit fdfba0970edf9a50b943bbf071d94e3b0c955e15)
Check __MINGW32__ instead of !defined(_MSC_VER)
(cherry picked from commit 2f6397926e4864c6ae505aceb92aa7b154ec8485)
[dist] remove a workaround for EditorConfig on Win32

See: https://github.com/editorconfig/editorconfig/issues/125
(cherry picked from commit 8bd7e1863ff0f5b80353f3cc3d8944a6dfb6f44d)
[dist] update HISTORY
[bug] deadlock occurs when recursive lock is not allowed
(cherry picked from commit 727a168444cb2378524ab4a9ed1b9ef4279e4e83)
[dist] update HISTORY