[hackers] [scc] [cc1] Use newitem() in incdir() || Roberto E. Vargas Caballero
commit f1689426d892911f774884c79ecdc2e639522448
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Thu Jan 19 12:24:55 2017 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Thu Jan 19 12:24:55 2017 +0100
[cc1] Use newitem() in incdir()
This why newitem() was created.
diff --git a/cc1/cpp.c b/cc1/cpp.c
index 8c4f8f2..610bf8c 100644
--- a/cc1/cpp.c
+++ b/cc1/cpp.c
_AT_@ -16,8 +16,8 @@ static unsigned arglen;
static unsigned ncmdlines;
static Symbol *symline, *symfile;
static unsigned char ifstatus[NR_COND];
-static int ninclude, cppoff;
-static char **dirinclude;
+static int cppoff;
+static struct items dirinclude;
unsigned cppctx;
int disexpand;
_AT_@ -417,9 +417,7 @@ incdir(char *dir)
{
if (!dir || *dir == '\0')
die("incorrect -I flag");
- ++ninclude;
- dirinclude = xrealloc(dirinclude, sizeof(*dirinclude) * ninclude);
- dirinclude[ninclude-1] = dir;
+ newitem(&dirinclude, dir);
}
static int
_AT_@ -499,8 +497,8 @@ include(void)
goto bad_include;
}
- n = ninclude;
- for (bp = dirinclude; n--; ++bp) {
+ n = dirinclude.n;
+ for (bp = dirinclude.s; n--; ++bp) {
if (includefile(*bp, file, filelen))
goto its_done;
}
Received on Thu Jan 19 2017 - 12:25:22 CET
This archive was generated by hypermail 2.3.0
: Thu Jan 19 2017 - 12:36:16 CET