From: Paul Hilfinger Date: Thu, 12 Jan 2006 00:16:35 +0000 (+0000) Subject: * data/glr.c (yysplitStack): A little stylistic rewrite. X-Git-Tag: v2.3b~499 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/ddee1b066660d06c6c3bf0cf6f9884d79e6fee27 * data/glr.c (yysplitStack): A little stylistic rewrite. --- diff --git a/ChangeLog b/ChangeLog index 9f9d2d37..31c96a8c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2006-01-11 Paul Hilfinger + + * data/glr.c (yysplitStack): A little stylistic rewrite. + 2006-01-11 Paul Hilfinger * data/glr.c (yyaddDeferredAction): Flesh out the comment. diff --git a/data/glr.c b/data/glr.c index b82f5ede..88103770 100644 --- a/data/glr.c +++ b/data/glr.c @@ -1534,18 +1534,27 @@ yysplitStack (yyGLRStack* yystackp, size_t yyk) { yyGLRState** yynewStates; yybool* yynewLookaheadStatuses; - if (! ((yystackp->yytops.yycapacity - <= (YYSIZEMAX / (2 * sizeof yynewStates[0]))) - && (yynewStates = - (yyGLRState**) YYREALLOC (yystackp->yytops.yystates, - ((yystackp->yytops.yycapacity *= 2) - * sizeof yynewStates[0]))))) + + yynewStates = NULL; + + if (yystackp->yytops.yycapacity + > (YYSIZEMAX / (2 * sizeof yynewStates[0]))) + yyMemoryExhausted (yystackp); + yystackp->yytops.yycapacity *= 2; + + yynewStates = + (yyGLRState**) YYREALLOC (yystackp->yytops.yystates, + (yystackp->yytops.yycapacity + * sizeof yynewStates[0])); + if (yynewStates == NULL) yyMemoryExhausted (yystackp); yystackp->yytops.yystates = yynewStates; - if (! (yynewLookaheadStatuses = - (yybool*) YYREALLOC (yystackp->yytops.yylookaheadStatuses, - ((yystackp->yytops.yycapacity) - * sizeof yynewLookaheadStatuses[0])))) + + yynewLookaheadStatuses = + (yybool*) YYREALLOC (yystackp->yytops.yylookaheadStatuses, + (yystackp->yytops.yycapacity + * sizeof yynewLookaheadStatuses[0])); + if (yynewLookaheadStatuses == NULL) yyMemoryExhausted (yystackp); yystackp->yytops.yylookaheadStatuses = yynewLookaheadStatuses; }