scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit fa420983bd4538a1b7ce8b63c091c1c621510469
parent 07ca4e7afc28735ee37d68d438b8e3502bc1e71c
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon, 11 Feb 2019 16:55:59 +0000

[ld] Add moreundef()

Diffstat:
Msrc/cmd/ld/main.c | 14++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/cmd/ld/main.c b/src/cmd/ld/main.c @@ -90,6 +90,13 @@ cleanup(void) remove(output); } +static int +moreundef(void) +{ + + return refhead.next != &refhead; +} + static Symbol * lookup(char *name, int install) { @@ -236,15 +243,14 @@ loadlib(FILE *fp) int t, loaded; long n; Objsymdef *def, *dp; - Symbol *sym, *p; + Symbol *sym; if (getindex(bintype, &n, &def, fp) < 0) { error("corrupted index"); return; } - p = &refhead; - for (loaded = 0; p->next != p; loaded = 0) { + for (loaded = 0; moreundef(); loaded = 0) { for (dp = def; dp; dp = dp->next) { sym = lookup(dp->name, NOINSTALL); if (!sym || !sym->def) @@ -382,7 +388,7 @@ pass1(int argc, char *argv[]) fclose(fp); } - if (refhead.next != &refhead) { + if (moreundef()) { Symbol *sym, *p; p = &refhead;