[hackers] [scc] [cc2] Update the number of cases per switch v2 || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Thu, 26 May 2016 16:44:27 +0200 (CEST)

commit 14b14db116c59bfeeed0319493db6ccf3bc33d60
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Thu May 26 16:43:31 2016 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Thu May 26 16:43:31 2016 +0200

    [cc2] Update the number of cases per switch v2

diff --git a/cc2/parser.c b/cc2/parser.c
index 292d1ce..077d95a 100644
--- a/cc2/parser.c
+++ b/cc2/parser.c
_AT_@ -32,6 +32,7 @@ union tokenop {
 
 struct swtch {
         int nr;
+ Node *first;
         Node *last;
 };
 
_AT_@ -354,21 +355,27 @@ waft(Node *np)
 static void
 bswitch(char *token, union tokenop u)
 {
- if (swp++ == &swtbl[NR_BLOCK+1])
+ struct swtch *cur;
+
+ if (swp == &swtbl[NR_BLOCK+1])
                 error(EWTACKO);
+ cur = swp++;
+ cur->nr = 0;
         jump(token, u);
- swp->nr = 0;
- swp->last = push(pop());
+ cur->first = cur->last = push(pop());
 }
 
 static void
 eswitch(char *token, union tokenop u)
 {
+ struct swtch *cur;
+
         if (swp == swtbl)
                 error(EWTACKU);
         jump(token, u);
         waft(pop());
- --swp;
+ cur = swp--;
+ cur->first->u.i = cur->nr;
 }
 
 static void
Received on Thu May 26 2016 - 16:44:27 CEST

This archive was generated by hypermail 2.3.0 : Thu May 26 2016 - 16:48:14 CEST