From eb4a4d73bc046caa4c0179ebdcb0ed01e735ef16 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 27 Nov 2001 23:31:47 +0000 Subject: [PATCH] * src/bison.simple (YYSTACK_REALLOC): Fix typo that caused us to use alloca when we didn't want to, and vice versa. --- ChangeLog | 5 +++++ src/bison.simple | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 51db4e6d..e6847a1c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2001-11-27 Paul Eggert + + * src/bison.simple (YYSTACK_REALLOC): Fix typo that caused us to + use alloca when we didn't want to, and vice versa. + 2001-11-27 Akim Demaille * tests/torture.at (Exploding the Stack Size with Malloc): diff --git a/src/bison.simple b/src/bison.simple index 98fa0c4b..fa23877f 100644 --- a/src/bison.simple +++ b/src/bison.simple @@ -82,20 +82,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 -- 2.50.0