X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/b3324f97a8e2520f4a3fd2d0a37ac2eec2056ca2..648185ab4a265a28758e3b5d9f34c68bdf05fef7:/src/bison.simple diff --git a/src/bison.simple b/src/bison.simple index 4a3ca508..455c9d87 100644 --- a/src/bison.simple +++ b/src/bison.simple @@ -108,20 +108,20 @@ # define YYSTACK_REALLOC(Type, What, Array) \ do { \ Type *old = What; \ - What = (Type *) malloc (yystacksize * sizeof (Type)); \ + What = (Type *) alloca (yystacksize * sizeof (Type)); \ __yy_memcpy ((char *) What, (char *) old, \ (size) * (unsigned int) sizeof (Type)); \ - yyfree_stacks = 1; \ - if (old != Array) \ - free (old); \ } while (0) #else # define YYSTACK_REALLOC(Type, What, Array) \ do { \ Type *old = What; \ - What = (Type *) alloca (yystacksize * sizeof (Type)); \ + What = (Type *) malloc (yystacksize * sizeof (Type)); \ __yy_memcpy ((char *) What, (char *) old, \ (size) * (unsigned int) sizeof (Type)); \ + yyfree_stacks = 1; \ + if (old != Array) \ + free (old); \ } while (0) #endif