Module Name: othersrc Committed By: dholland Date: Sat Mar 23 17:47:12 UTC 2013
Modified Files: othersrc/usr.bin/dholland-make2: main.c nonints.h suff.c Log Message: Make the DEBUG_SRC code compile again. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 othersrc/usr.bin/dholland-make2/main.c cvs rdiff -u -r1.5 -r1.6 othersrc/usr.bin/dholland-make2/nonints.h cvs rdiff -u -r1.12 -r1.13 othersrc/usr.bin/dholland-make2/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: othersrc/usr.bin/dholland-make2/main.c diff -u othersrc/usr.bin/dholland-make2/main.c:1.8 othersrc/usr.bin/dholland-make2/main.c:1.9 --- othersrc/usr.bin/dholland-make2/main.c:1.8 Tue Mar 5 04:31:27 2013 +++ othersrc/usr.bin/dholland-make2/main.c Sat Mar 23 17:47:11 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.8 2013/03/05 04:31:27 dholland Exp $ */ +/* $NetBSD: main.c,v 1.9 2013/03/23 17:47:11 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -128,7 +128,7 @@ MAKE_COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\ The Regents of the University of California. All rights reserved."); -MAKE_RCSID("$NetBSD: main.c,v 1.8 2013/03/05 04:31:27 dholland Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.9 2013/03/23 17:47:11 dholland Exp $"); #ifndef DEFMAXLOCAL @@ -1742,11 +1742,10 @@ usage(void) } -int -PrintAddr(void *a, void *b) +void +PrintAddr(void *a) { - printf("%lx ", (unsigned long) a); - return b ? 0 : 0; + printf("%p ", a); } Index: othersrc/usr.bin/dholland-make2/nonints.h diff -u othersrc/usr.bin/dholland-make2/nonints.h:1.5 othersrc/usr.bin/dholland-make2/nonints.h:1.6 --- othersrc/usr.bin/dholland-make2/nonints.h:1.5 Tue Mar 5 04:27:27 2013 +++ othersrc/usr.bin/dholland-make2/nonints.h Sat Mar 23 17:47:11 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: nonints.h,v 1.5 2013/03/05 04:27:27 dholland Exp $ */ +/* $NetBSD: nonints.h,v 1.6 2013/03/23 17:47:11 dholland Exp $ */ /*- * Copyright (c) 1988, 1989, 1990, 1993 @@ -113,7 +113,7 @@ void Error(const char *, ...) MAKE_ATTR_ void Fatal(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2) MAKE_ATTR_DEAD; void Punt(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2) MAKE_ATTR_DEAD; void DieHorribly(void) MAKE_ATTR_DEAD; -int PrintAddr(void *, void *); +void PrintAddr(void *); void Finish(int) MAKE_ATTR_DEAD; int eunlink(const char *); void execError(const char *, const char *); Index: othersrc/usr.bin/dholland-make2/suff.c diff -u othersrc/usr.bin/dholland-make2/suff.c:1.12 othersrc/usr.bin/dholland-make2/suff.c:1.13 --- othersrc/usr.bin/dholland-make2/suff.c:1.12 Sat Mar 23 17:36:37 2013 +++ othersrc/usr.bin/dholland-make2/suff.c Sat Mar 23 17:47:11 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.12 2013/03/23 17:36:37 dholland Exp $ */ +/* $NetBSD: suff.c,v 1.13 2013/03/23 17:47:11 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -131,7 +131,9 @@ #include "hash.h" #include "dir.h" -MAKE_RCSID("$NetBSD: suff.c,v 1.12 2013/03/23 17:36:37 dholland Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.13 2013/03/23 17:47:11 dholland Exp $"); + +#define CLEANUP /* * Structure describing an individual suffix. @@ -180,7 +182,7 @@ typedef struct Src { int children; /* Count of existing children (so we don't free * this thing too early or never nuke it) */ #ifdef DEBUG_SRC - Lst cp; /* Debug; children list */ + struct srclist cp; /* Debug; children list */ #endif } Src; @@ -198,8 +200,6 @@ typedef struct { DEFARRAY_BYTYPE(sufflist, Suff, MAKE_ATTR_UNUSED static); DEFARRAY_BYTYPE(srclist, Src, MAKE_ATTR_UNUSED static); -#define CLEANUP - static struct sufflist sufflist; /* all current suffixes */ #ifdef CLEANUP static struct sufflist suffClean; /* suffixes to be cleaned */ @@ -1188,6 +1188,18 @@ Suff_AddLib(char *sname) * A Src structure is created and tacked onto the end of the list *----------------------------------------------------------------------- */ +#ifdef DEBUG_SRC +static void +srclist_print(struct srclist *ll) +{ + unsigned i; + + for (i=0; i<srclist_num(ll); i++) { + PrintAddr(srclist_get(ll, i)); + } +} +#endif /* DEBUG_SRC */ + static void SuffAddSrc(Suff *s, struct srclist *ll, Src *targ) { @@ -1210,10 +1222,10 @@ SuffAddSrc(Suff *s, struct srclist *ll, targ->children += 1; srclist_add(ll, s2, NULL); #ifdef DEBUG_SRC - s2->cp = Lst_Init(FALSE); - Lst_AtEnd(targ->cp, s2); - fprintf(debug_file, "1 add %x %x to %x:", targ, s2, ls->l); - Lst_ForEach(ls->l, PrintAddr, NULL); + srclist_init(&s2->cp); + srclist_add(&targ->cp, s2, NULL); + fprintf(debug_file, "1 add %p %p to %p:", targ, s2, ll); + srclist_print(ll); fprintf(debug_file, "\n"); #endif } @@ -1228,10 +1240,10 @@ SuffAddSrc(Suff *s, struct srclist *ll, targ->children += 1; srclist_add(ll, s2, NULL); #ifdef DEBUG_SRC - s2->cp = Lst_Init(FALSE); - Lst_AtEnd(targ->cp, s2); - fprintf(debug_file, "2 add %x %x to %x:", targ, s2, ls->l); - Lst_ForEach(ls->l, PrintAddr, NULL); + srclist_init(&s2->cp); + srclist_add(&targ->cp, s2, NULL); + fprintf(debug_file, "2 add %p %p to %p:", targ, s2, ll); + srclist_print(ll); fprintf(debug_file, "\n"); #endif } @@ -1284,8 +1296,8 @@ SuffRemoveSrc(struct srclist *l) unsigned i, num; #ifdef DEBUG_SRC - fprintf(debug_file, "cleaning %lx: ", (unsigned long) l); - Lst_ForEach(l, PrintAddr, NULL); + fprintf(debug_file, "cleaning %p: ", l); + srclist_print(l); fprintf(debug_file, "\n"); #endif @@ -1298,15 +1310,14 @@ SuffRemoveSrc(struct srclist *l) free(s->pref); else { #ifdef DEBUG_SRC - LstNode ln = Lst_Member(s->parent->cp, s); - if (ln != NULL) - Lst_Remove(s->parent->cp, ln); + srclist_removeval(&s->parent->cp, s); #endif --s->parent->children; } #ifdef DEBUG_SRC - fprintf(debug_file, "free: [l=%x] p=%x %d\n", l, s, s->children); - Lst_Destroy(s->cp, NULL); + fprintf(debug_file, "free: [l=%p] p=%p %d\n", l, s, s->children); + srclist_setsize(&s->cp, 0); + srclist_cleanup(&s->cp); #endif srclist_remove(l, i); free(s); @@ -1314,8 +1325,8 @@ SuffRemoveSrc(struct srclist *l) } #ifdef DEBUG_SRC else { - fprintf(debug_file, "keep: [l=%x] p=%x %d: ", l, s, s->children); - Lst_ForEach(s->cp, PrintAddr, NULL); + fprintf(debug_file, "keep: [l=%p] p=%p %d: ", l, s, s->children); + srclist_print(&s->cp); fprintf(debug_file, "\n"); } #endif @@ -1363,7 +1374,7 @@ SuffFindThem(struct srclist *srcs, struc */ if (Targ_FindNode(s->file, TARG_NOCREATE) != NULL) { #ifdef DEBUG_SRC - fprintf(debug_file, "remove %x from %x\n", s, srcs); + fprintf(debug_file, "remove %p from %p\n", s, srcs); #endif rs = s; break; @@ -1372,7 +1383,7 @@ SuffFindThem(struct srclist *srcs, struc if ((ptr = Dir_FindFile(s->file, &s->suff->searchPath)) != NULL) { rs = s; #ifdef DEBUG_SRC - fprintf(debug_file, "remove %x from %x\n", s, srcs); + fprintf(debug_file, "remove %p from %p\n", s, srcs); #endif free(ptr); break; @@ -1486,9 +1497,9 @@ SuffFindCmds(Src *targ, struct srclist * ret->children = 0; targ->children += 1; #ifdef DEBUG_SRC - ret->cp = Lst_Init(FALSE); - fprintf(debug_file, "3 add %x %x\n", targ, ret); - Lst_AtEnd(targ->cp, ret); + srclist_init(&ret->cp); + fprintf(debug_file, "3 add %p %p\n", targ, ret); + srclist_add(&targ->cp, ret, NULL); #endif srclist_add(slst, ret, NULL); if (DEBUG(SUFF)) { @@ -2122,7 +2133,7 @@ SuffFindNormalDeps(GNode *gn, struct src targ->parent = NULL; targ->children = 0; #ifdef DEBUG_SRC - targ->cp = Lst_Init(FALSE); + srclist_init(&targ->cp); #endif /* @@ -2163,7 +2174,7 @@ SuffFindNormalDeps(GNode *gn, struct src targ->children = 0; targ->pref = bmake_strdup(sopref); #ifdef DEBUG_SRC - targ->cp = Lst_Init(FALSE); + srclist_init(&targ->cp); #endif /*