bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

style: minor changes


From: Akim Demaille
Subject: style: minor changes
Date: Sun, 1 Dec 2019 18:22:52 +0100

This is a diff -w, to be shorter, but the actual commit respects the 
indentation.

commit 5732678100596807a1d1541ab74719f1b01b46a0
Author: Akim Demaille <address@hidden>
Date:   Sun Dec 1 18:18:08 2019 +0100

    style: minor changes
    
    * data/skeletons/glr.c (yysplitStack): Reduce scopes.
    * tests/atlocal.in: Formatting changes.

diff --git a/data/skeletons/glr.c b/data/skeletons/glr.c
index 6bb7bf45..5dbb1739 100644
--- a/data/skeletons/glr.c
+++ b/data/skeletons/glr.c
@@ -1523,18 +1523,16 @@ yysplitStack (yyGLRStack* yystackp, ptrdiff_t yyk)
       YYASSERT (yyk == 0);
       yystackp->yysplitPoint = yystackp->yytops.yystates[yyk];
     }
-  if (yystackp->yytops.yysize >= yystackp->yytops.yycapacity)
+  if (yystackp->yytops.yycapacity <= yystackp->yytops.yysize)
     {
-      yyGLRState** yynewStates = YY_NULLPTR;
-      yybool* yynewLookaheadNeeds;
       ptrdiff_t state_size = sizeof yynewStates[0];
       ptrdiff_t half_max_capacity = YYSIZEMAX / 2 / state_size;
-
       if (half_max_capacity < yystackp->yytops.yycapacity)
         yyMemoryExhausted (yystackp);
       yystackp->yytops.yycapacity *= 2;
 
-      yynewStates
+      {
+        yyGLRState** yynewStates
           = YY_CAST (yyGLRState**,
                      YYREALLOC (yystackp->yytops.yystates,
                                 (YY_CAST (size_t, yystackp->yytops.yycapacity)
@@ -1542,8 +1540,10 @@ yysplitStack (yyGLRStack* yystackp, ptrdiff_t yyk)
         if (yynewStates == YY_NULLPTR)
           yyMemoryExhausted (yystackp);
         yystackp->yytops.yystates = yynewStates;
+      }
 
-      yynewLookaheadNeeds
+      {
+        yybool* yynewLookaheadNeeds
           = YY_CAST (yybool*,
                      YYREALLOC (yystackp->yytops.yylookaheadNeeds,
                                 (YY_CAST (size_t, yystackp->yytops.yycapacity)
@@ -1552,6 +1552,7 @@ yysplitStack (yyGLRStack* yystackp, ptrdiff_t yyk)
           yyMemoryExhausted (yystackp);
         yystackp->yytops.yylookaheadNeeds = yynewLookaheadNeeds;
       }
+    }
   yystackp->yytops.yystates[yystackp->yytops.yysize]
     = yystackp->yytops.yystates[yyk];
   yystackp->yytops.yylookaheadNeeds[yystackp->yytops.yysize]
@@ -1591,7 +1592,7 @@ yymergeOptionSets (yySemanticOption* yyy0, 
yySemanticOption* yyy1)
   int yyn;
   for (yys0 = yyy0->yystate, yys1 = yyy1->yystate,
        yyn = yyrhsLength (yyy0->yyrule);
-       yyn > 0;
+       0 < yyn;
        yys0 = yys0->yypred, yys1 = yys1->yypred, yyn -= 1)
     {
       if (yys0 == yys1)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]