scc

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

commit e12a1007fa3b9df81e20951314a1fc93f0707382
parent 62b5f13a7e487d4cadb1c82ca7642e34dfcbb512
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;