]> git.saurik.com Git - bison.git/commitdiff
* data/glr.c (yysplitStack): A little stylistic rewrite.
authorPaul Hilfinger <Hilfinger@CS.Berkeley.EDU>
Thu, 12 Jan 2006 00:16:35 +0000 (00:16 +0000)
committerPaul Hilfinger <Hilfinger@CS.Berkeley.EDU>
Thu, 12 Jan 2006 00:16:35 +0000 (00:16 +0000)
ChangeLog
data/glr.c

index 9f9d2d37f754b6b24800f6abba2aee612eaba662..31c96a8c606d644ce847fca5c32d12356f8c5189 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2006-01-11  Paul Hilfinger  <hilfingr@tully.CS.Berkeley.EDU>
+
+       * data/glr.c (yysplitStack): A little stylistic rewrite.
+
 2006-01-11  Paul Hilfinger  <hilfingr@tully.CS.Berkeley.EDU>
 
        * data/glr.c (yyaddDeferredAction): Flesh out the comment.
index b82f5edee2862e56548512982c3126b26c35838e..881037705682a83b5094f8edfc25f84329f75fc8 100644 (file)
@@ -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;
     }