[hackers] [scc] [cc1] use dynamic storage for U flags || Quentin Rameau

From: <git_AT_suckless.org>
Date: Fri, 17 Jun 2016 21:45:13 +0200 (CEST)

commit 8dd36e66c2d29394875ef9a977cfd20195b21aea
Author: Quentin Rameau <quinq_AT_fifth.space>
AuthorDate: Thu Jun 16 16:18:57 2016 +0200
Commit: Quentin Rameau <quinq_AT_fifth.space>
CommitDate: Fri Jun 17 21:41:10 2016 +0200

    [cc1] use dynamic storage for U flags

diff --git a/cc1/main.c b/cc1/main.c
index 91974a9..d7fa487 100644
--- a/cc1/main.c
+++ b/cc1/main.c
_AT_@ -16,6 +16,7 @@ int warnings;
 jmp_buf recover;
 
 static char *base, *output;
+static struct items uflags;
 int onlycpp;
 
 extern int failure;
_AT_@ -41,7 +42,7 @@ int
 main(int argc, char *argv[])
 {
         char *base;
- static char *uvec[NR_USWITCHES], **umacro = uvec;
+ int i;
 
         atexit(clean);
         icpp();
_AT_@ -63,9 +64,7 @@ main(int argc, char *argv[])
                 incdir(EARGF(usage()));
                 break;
         case 'U':
- if (umacro == &uvec[NR_USWITCHES])
- die("too many -U switches");
- *umacro++ = EARGF(usage());
+ uflags.s = newitem(uflags.s, uflags.n++, EARGF(usage()));
                 break;
         case 'd':
                 DBGON();
_AT_@ -89,8 +88,8 @@ main(int argc, char *argv[])
         if (!strcmp(base, "cpp"))
                 onlycpp = 1;
 
- for (umacro = uvec; *umacro; umacro++)
- undefmacro(*umacro);
+ for (i = 0; i < uflags.n; ++i)
+ undefmacro(uflags.s[i]);
 
         ilex(*argv);
         if (onlycpp) {
Received on Fri Jun 17 2016 - 21:45:13 CEST

This archive was generated by hypermail 2.3.0 : Fri Jun 17 2016 - 21:48:37 CEST