summaryrefslogtreecommitdiff
path: root/usr.bin/make
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2000-06-10 01:32:24 +0000
committerMarc Espie <espie@cvs.openbsd.org>2000-06-10 01:32:24 +0000
commit902d39cd46468c0b8155dcef6b36cbca21d39ef4 (patch)
treecfabd80ee6dbc8f45687ba6fe88bb5d092930a7b /usr.bin/make
parent180f58f247b5d42362ff6fe4a356db32d22d8d27 (diff)
Thus, Lst_ForEach no longer needs returning a status.
In fact, it can become a macro based on Lst_ForEachFrom. This also introduces Lst_Every, as a shortcut for the very common case where Lst_ForEach does not need any user data. Finally, make consistent use of a few function typedefs, instead of having explicit void (*)(Lst) arguments all over the place.
Diffstat (limited to 'usr.bin/make')
-rw-r--r--usr.bin/make/Makefile4
-rw-r--r--usr.bin/make/compat.c21
-rw-r--r--usr.bin/make/dir.c40
-rw-r--r--usr.bin/make/extern.h12
-rw-r--r--usr.bin/make/for.c11
-rw-r--r--usr.bin/make/job.c32
-rw-r--r--usr.bin/make/lst.h35
-rw-r--r--usr.bin/make/lst.lib/Makefile6
-rw-r--r--usr.bin/make/lst.lib/lstDestroy.c8
-rw-r--r--usr.bin/make/lst.lib/lstDupl.c11
-rw-r--r--usr.bin/make/lst.lib/lstForEachFrom.c68
-rw-r--r--usr.bin/make/main.c12
-rw-r--r--usr.bin/make/make.c88
-rw-r--r--usr.bin/make/parse.c71
-rw-r--r--usr.bin/make/suff.c197
-rw-r--r--usr.bin/make/targ.c95
-rw-r--r--usr.bin/make/var.c17
17 files changed, 276 insertions, 452 deletions
diff --git a/usr.bin/make/Makefile b/usr.bin/make/Makefile
index 230f862efb9..47e1383621f 100644
--- a/usr.bin/make/Makefile
+++ b/usr.bin/make/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.13 1999/12/19 00:04:24 espie Exp $
+# $OpenBSD: Makefile,v 1.14 2000/06/10 01:32:22 espie Exp $
PROG= make
CFLAGS+= -I${.CURDIR} -Wall -Wno-char-subscripts -Wno-unused -Wstrict-prototypes#-Wmissing-prototypes -Wstrict-prototypes
@@ -11,7 +11,7 @@ SRCS= arch.c buf.c compat.c cond.c dir.c error.c for.c hash.c job.c main.c \
make.c parse.c str.c suff.c targ.c var.c #util.c
SRCS+= lstAppend.c lstAtEnd.c lstAtFront.c lstClose.c lstConcat.c \
lstDatum.c lstDeQueue.c lstDestroy.c lstDupl.c lstEnQueue.c \
- lstFindFrom.c lstFirst.c lstForEach.c lstForEachFrom.c \
+ lstFindFrom.c lstFirst.c lstForEachFrom.c \
lstInit.c lstInsert.c lstIsAtEnd.c lstIsEmpty.c lstLast.c \
lstMember.c lstNext.c lstOpen.c lstRemove.c lstReplace.c lstSucc.c
.PATH: ${.CURDIR}/lst.lib
diff --git a/usr.bin/make/compat.c b/usr.bin/make/compat.c
index d01d7ce2e6f..baf71114f4e 100644
--- a/usr.bin/make/compat.c
+++ b/usr.bin/make/compat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: compat.c,v 1.25 2000/06/10 01:26:36 espie Exp $ */
+/* $OpenBSD: compat.c,v 1.26 2000/06/10 01:32:22 espie Exp $ */
/* $NetBSD: compat.c,v 1.14 1996/11/06 17:59:01 christos Exp $ */
/*
@@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94";
#else
-static char rcsid[] = "$OpenBSD: compat.c,v 1.25 2000/06/10 01:26:36 espie Exp $";
+static char rcsid[] = "$OpenBSD: compat.c,v 1.26 2000/06/10 01:32:22 espie Exp $";
#endif
#endif /* not lint */
@@ -85,7 +85,7 @@ static GNode *curTarg = NULL;
static GNode *ENDNode;
static void CompatInterrupt __P((int));
static int CompatRunCommand __P((ClientData, ClientData));
-static int CompatMake __P((ClientData, ClientData));
+static void CompatMake __P((ClientData, ClientData));
static int shellneed __P((char **av));
/*-
@@ -423,16 +423,13 @@ CompatRunCommand (cmdp, gnp)
* CompatMake --
* Make a target.
*
- * Results:
- * 0
- *
* Side Effects:
* If an error is detected and not being ignored, the process exits.
*
*-----------------------------------------------------------------------
*/
-static int
-CompatMake (gnp, pgnp)
+static void
+CompatMake(gnp, pgnp)
ClientData gnp; /* The node to make */
ClientData pgnp; /* Parent to abort if necessary */
{
@@ -462,7 +459,7 @@ CompatMake (gnp, pgnp)
if (!gn->make) {
gn->made = ABORTED;
pgn->make = FALSE;
- return (0);
+ return;
}
if (Lst_Member (gn->iParents, pgn) != NULL) {
@@ -483,7 +480,7 @@ CompatMake (gnp, pgnp)
if (DEBUG(MAKE)) {
printf("up-to-date.\n");
}
- return (0);
+ return;
} else if (DEBUG(MAKE)) {
printf("out-of-date.\n");
}
@@ -642,8 +639,6 @@ CompatMake (gnp, pgnp)
break;
}
}
-
- return (0);
}
/*-
@@ -716,7 +711,7 @@ Compat_Run(targs)
*/
errors = 0;
while ((gn = (GNode *)Lst_DeQueue(targs)) != NULL) {
- CompatMake (gn, gn);
+ CompatMake(gn, gn);
if (gn->made == UPTODATE) {
printf ("`%s' is up to date.\n", gn->name);
diff --git a/usr.bin/make/dir.c b/usr.bin/make/dir.c
index 44f6dbeeb91..3bbd7c98824 100644
--- a/usr.bin/make/dir.c
+++ b/usr.bin/make/dir.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dir.c,v 1.17 2000/03/26 16:21:32 espie Exp $ */
+/* $OpenBSD: dir.c,v 1.18 2000/06/10 01:32:22 espie Exp $ */
/* $NetBSD: dir.c,v 1.14 1997/03/29 16:51:26 christos Exp $ */
/*
@@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94";
#else
-static char rcsid[] = "$OpenBSD: dir.c,v 1.17 2000/03/26 16:21:32 espie Exp $";
+static char rcsid[] = "$OpenBSD: dir.c,v 1.18 2000/06/10 01:32:22 espie Exp $";
#endif
#endif /* not lint */
@@ -197,8 +197,8 @@ static int DirFindName __P((ClientData, ClientData));
static int DirMatchFiles __P((char *, Path *, Lst));
static void DirExpandCurly __P((char *, char *, Lst, Lst));
static void DirExpandInt __P((char *, Lst, Lst));
-static int DirPrintWord __P((ClientData, ClientData));
-static int DirPrintDir __P((ClientData, ClientData));
+static void DirPrintWord __P((ClientData));
+static void DirPrintDir __P((ClientData));
/*-
*-----------------------------------------------------------------------
@@ -534,25 +534,15 @@ DirExpandInt(word, path, expansions)
/*-
*-----------------------------------------------------------------------
* DirPrintWord --
- * Print a word in the list of expansions. Callback for Dir_Expand
- * when DEBUG(DIR), via Lst_ForEach.
- *
- * Results:
- * === 0
- *
- * Side Effects:
- * The passed word is printed, followed by a space.
- *
+ * Print a word in the list of expansions, followed by a space.
+ * Callback for Dir_Expand when DEBUG(DIR), via Lst_ForEach.
*-----------------------------------------------------------------------
*/
-static int
-DirPrintWord(word, dummy)
+static void
+DirPrintWord(word)
ClientData word;
- ClientData dummy;
{
- printf("%s ", (char *) word);
-
- return(dummy ? 0 : 0);
+ printf("%s ", (char *)word);
}
/*-
@@ -663,7 +653,7 @@ Dir_Expand (word, path, expansions)
}
}
if (DEBUG(DIR)) {
- Lst_ForEach(expansions, DirPrintWord, NULL);
+ Lst_Every(expansions, DirPrintWord);
fputc('\n', stdout);
}
}
@@ -1297,17 +1287,15 @@ Dir_PrintDirectories()
}
}
-static int DirPrintDir (p, dummy)
+static void DirPrintDir(p)
ClientData p;
- ClientData dummy;
{
- printf ("%s ", ((Path *) p)->name);
- return (dummy ? 0 : 0);
+ printf("%s ", ((Path *)p)->name);
}
void
-Dir_PrintPath (path)
+Dir_PrintPath(path)
Lst path;
{
- Lst_ForEach(path, DirPrintDir, NULL);
+ Lst_Every(path, DirPrintDir);
}
diff --git a/usr.bin/make/extern.h b/usr.bin/make/extern.h
index 6ac0af8c4fd..7e144fdf54f 100644
--- a/usr.bin/make/extern.h
+++ b/usr.bin/make/extern.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: extern.h,v 1.20 2000/04/17 23:45:23 espie Exp $ */
+/* $OpenBSD: extern.h,v 1.21 2000/06/10 01:32:22 espie Exp $ */
/* $NetBSD: nonints.h,v 1.12 1996/11/06 17:59:19 christos Exp $ */
/*-
@@ -75,13 +75,13 @@ void Error __P((char *, ...));
void Fatal __P((char *, ...));
void Punt __P((char *, ...));
void DieHorribly __P((void));
-int PrintAddr __P((ClientData, ClientData));
+void PrintAddr __P((ClientData));
void Finish __P((int));
/* make.c */
-int Make_TimeStamp __P((GNode *, GNode *));
+void Make_TimeStamp __P((GNode *, GNode *));
Boolean Make_OODate __P((GNode *));
-int Make_HandleUse __P((GNode *, GNode *));
+void Make_HandleUse __P((GNode *, GNode *));
void Make_Update __P((GNode *));
void Make_DoAllVar __P((GNode *));
Boolean Make_Run __P((Lst));
@@ -114,7 +114,7 @@ char *interval_dup __P((const char *begin, const char *end));
void Suff_ClearSuffixes __P((void));
Boolean Suff_IsTransform __P((char *));
GNode *Suff_AddTransform __P((char *));
-int Suff_EndTransform __P((ClientData, ClientData));
+void Suff_EndTransform __P((ClientData));
void Suff_AddSuffix __P((char *));
Lst Suff_GetPath __P((char *));
void Suff_DoPaths __P((void));
@@ -136,7 +136,7 @@ Boolean Targ_Ignore __P((GNode *));
Boolean Targ_Silent __P((GNode *));
Boolean Targ_Precious __P((GNode *));
void Targ_SetMain __P((GNode *));
-int Targ_PrintCmd __P((ClientData, ClientData));
+void Targ_PrintCmd __P((ClientData));
char *Targ_FmtTime __P((time_t));
void Targ_PrintType __P((int));
void Targ_PrintGraph __P((int));
diff --git a/usr.bin/make/for.c b/usr.bin/make/for.c
index 5b99434189c..f5b7d4654eb 100644
--- a/usr.bin/make/for.c
+++ b/usr.bin/make/for.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: for.c,v 1.15 2000/03/26 16:21:32 espie Exp $ */
+/* $OpenBSD: for.c,v 1.16 2000/06/10 01:32:22 espie Exp $ */
/* $NetBSD: for.c,v 1.4 1996/11/06 17:59:05 christos Exp $ */
/*
@@ -82,7 +82,7 @@
#if 0
static char sccsid[] = "@(#)for.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: for.c,v 1.15 2000/03/26 16:21:32 espie Exp $";
+static char rcsid[] = "$OpenBSD: for.c,v 1.16 2000/06/10 01:32:22 espie Exp $";
#endif
#endif /* not lint */
@@ -111,7 +111,7 @@ struct For_ {
unsigned long level; /* Nesting level */
};
-static int ForExec __P((ClientData, ClientData));
+static void ForExec __P((ClientData, ClientData));
static void build_words_list __P((Lst, const char *));
/* Cut a string into words, stuff that into list. */
@@ -268,7 +268,7 @@ For_Accumulate(arg, line)
* Expand the for loop for this index and push it in the Makefile
*-----------------------------------------------------------------------
*/
-static int
+static void
ForExec(namep, argp)
ClientData namep;
ClientData argp;
@@ -286,7 +286,6 @@ ForExec(namep, argp)
Parse_FromString(Buf_Retrieve(&arg->buf), arg->lineno);
Var_Delete(arg->var, VAR_GLOBAL);
- return 0;
}
@@ -307,6 +306,6 @@ For_Run(arg)
Lst_ForEach(arg->lst, ForExec, arg);
free(arg->var);
free(arg->text);
- Lst_Destroy(arg->lst, (void (*) __P((ClientData)))free);
+ Lst_Destroy(arg->lst, (SimpleProc)free);
free(arg);
}
diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c
index 9a75dda2acd..29aa6c952cd 100644
--- a/usr.bin/make/job.c
+++ b/usr.bin/make/job.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: job.c,v 1.26 2000/06/10 01:26:36 espie Exp $ */
+/* $OpenBSD: job.c,v 1.27 2000/06/10 01:32:22 espie Exp $ */
/* $NetBSD: job.c,v 1.16 1996/11/06 17:59:08 christos Exp $ */
/*
@@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94";
#else
-static char rcsid[] = "$OpenBSD: job.c,v 1.26 2000/06/10 01:26:36 espie Exp $";
+static char rcsid[] = "$OpenBSD: job.c,v 1.27 2000/06/10 01:32:22 espie Exp $";
#endif
#endif /* not lint */
@@ -292,11 +292,11 @@ STATIC Lst stoppedJobs; /* Lst of Job structures describing
#define W_SETEXITSTATUS(st, val) W_SETMASKED(st, val, WEXITSTATUS)
-static int JobCondPassSig __P((ClientData, ClientData));
+static void JobCondPassSig __P((ClientData, ClientData));
static void JobPassSig __P((int));
static int JobCmpPid __P((ClientData, ClientData));
static int JobPrintCommand __P((ClientData, ClientData));
-static int JobSaveCommand __P((ClientData, ClientData));
+static void JobSaveCommand __P((ClientData, ClientData));
static void JobClose __P((Job *));
#ifdef REMOTE
static int JobCmpRmtID __P((Job *, ClientData));
@@ -322,15 +322,12 @@ static void JobRestartJobs __P((void));
* Pass a signal to a job if the job is remote or if USE_PGRP
* is defined.
*
- * Results:
- * === 0
- *
* Side Effects:
* None, except the job may bite it.
*
*-----------------------------------------------------------------------
*/
-static int
+static void
JobCondPassSig(jobp, signop)
ClientData jobp; /* Job to biff */
ClientData signop; /* Signal to send it */
@@ -356,7 +353,6 @@ JobCondPassSig(jobp, signop)
}
KILL(job->pid, signo);
#endif
- return 0;
}
/*-
@@ -663,22 +659,18 @@ JobPrintCommand(cmdp, jobp)
* Save a command to be executed when everything else is done.
* Callback function for JobFinish...
*
- * Results:
- * Always returns 0
- *
* Side Effects:
* The command is tacked onto the end of postCommands's commands list.
*
*-----------------------------------------------------------------------
*/
-static int
+static void
JobSaveCommand(cmd, gn)
ClientData cmd;
ClientData gn;
{
cmd = (ClientData) Var_Subst((char *) cmd, (GNode *) gn, FALSE);
Lst_AtEnd(postCommands->commands, cmd);
- return(0);
}
@@ -965,11 +957,7 @@ JobFinish(job, status)
* the parents. In addition, any saved commands for the node are placed
* on the .END target.
*/
- if (job->tailCmds != NULL) {
- Lst_ForEachFrom(job->node->commands, job->tailCmds,
- JobSaveCommand,
- job->node);
- }
+ Lst_ForEachFrom(job->tailCmds, JobSaveCommand, job->node);
job->node->made = MADE;
Make_Update(job->node);
free((Address)job);
@@ -1850,11 +1838,7 @@ JobStart(gn, flags, previous)
*/
if (cmdsOK) {
if (aborting == 0) {
- if (job->tailCmds != NULL) {
- Lst_ForEachFrom(job->node->commands, job->tailCmds,
- JobSaveCommand,
- job->node);
- }
+ Lst_ForEachFrom(job->tailCmds, JobSaveCommand, job->node);
Make_Update(job->node);
}
free((Address)job);
diff --git a/usr.bin/make/lst.h b/usr.bin/make/lst.h
index 34c234670ba..40c793060df 100644
--- a/usr.bin/make/lst.h
+++ b/usr.bin/make/lst.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: lst.h,v 1.11 1999/12/19 00:04:25 espie Exp $ */
+/* $OpenBSD: lst.h,v 1.12 2000/06/10 01:32:23 espie Exp $ */
/* $NetBSD: lst.h,v 1.7 1996/11/06 17:59:12 christos Exp $ */
/*
@@ -60,15 +60,18 @@
typedef struct Lst *Lst;
typedef struct LstNode *LstNode;
-typedef int (*FindProc)__P((ClientData, ClientData));
+typedef int (*FindProc) __P((ClientData, ClientData));
+typedef void (*SimpleProc) __P((ClientData));
+typedef void (*ForEachProc) __P((ClientData, ClientData));
+typedef ClientData (*DuplicateProc) __P((ClientData));
/*
* NOFREE can be used as the freeProc to Lst_Destroy when the elements are
* not to be freed.
* NOCOPY performs similarly when given as the copyProc to Lst_Duplicate.
*/
-#define NOFREE ((void (*) __P((ClientData))) 0)
-#define NOCOPY ((ClientData (*) __P((ClientData))) 0)
+#define NOFREE ((SimpleProc)0)
+#define NOCOPY ((DuplicateProc)0)
#define LST_CONCNEW 0 /* create new LstNode's when using Lst_Concat */
#define LST_CONCLINK 1 /* relink LstNode's when using Lst_Concat */
@@ -79,9 +82,9 @@ typedef int (*FindProc)__P((ClientData, ClientData));
/* Create a new list */
Lst Lst_Init __P((void));
/* Duplicate an existing list */
-Lst Lst_Duplicate __P((Lst, ClientData (*)(ClientData)));
+Lst Lst_Duplicate __P((Lst, DuplicateProc));
/* Destroy an old one */
-void Lst_Destroy __P((Lst, void (*)(ClientData)));
+void Lst_Destroy __P((Lst, SimpleProc));
/* True if list is empty */
Boolean Lst_IsEmpty __P((Lst));
@@ -124,22 +127,20 @@ ClientData Lst_Datum __P((LstNode));
/* Find an element starting from somewhere */
LstNode Lst_FindFrom __P((LstNode, FindProc, ClientData));
+
+/* Apply a function to all elements of a lst */
+#define Lst_ForEach(l, proc, d) Lst_ForEachFrom(Lst_First(l), proc, d)
+/* Apply a function to all elements of a lst starting from a certain point. */
+void Lst_ForEachFrom __P((LstNode, ForEachProc, ClientData));
+void Lst_Every __P((Lst, SimpleProc));
+
+
/*
* See if the given datum is on the list. Returns the LstNode containing
* the datum
*/
LstNode Lst_Member __P((Lst, ClientData));
-/* Apply a function to all elements of a lst */
-void Lst_ForEach __P((Lst, int (*)(ClientData, ClientData),
- ClientData));
-/*
- * Apply a function to all elements of a lst starting from a certain point.
- * If the list is circular, the application will wrap around to the
- * beginning of the list again.
- */
-void Lst_ForEachFrom __P((Lst, LstNode,
- int (*)(ClientData, ClientData),
- ClientData));
+
/*
* these functions are for dealing with a list as a table, of sorts.
* An idea of the "current element" is kept and used by all the functions
diff --git a/usr.bin/make/lst.lib/Makefile b/usr.bin/make/lst.lib/Makefile
index 1bf425655ef..c101a0e8698 100644
--- a/usr.bin/make/lst.lib/Makefile
+++ b/usr.bin/make/lst.lib/Makefile
@@ -1,11 +1,11 @@
-# $OpenBSD: Makefile,v 1.6 1999/12/19 00:04:25 espie Exp $
+# $OpenBSD: Makefile,v 1.7 2000/06/10 01:32:23 espie Exp $
# $NetBSD: Makefile,v 1.4 1996/11/06 17:59:31 christos Exp $
OBJ=lstAppend.o lstDupl.o lstInit.o lstOpen.o lstAtEnd.o lstEnQueue.o \
lstInsert.o lstAtFront.o lstIsAtEnd.o lstClose.o lstIsEmpty.o \
lstRemove.o lstConcat.o lstFindFrom.o lstLast.o lstReplace.o lstFirst.o \
- lstDatum.o lstForEach.o lstMember.o lstSucc.o lstDeQueue.o \
- lstForEachFrom.o lstDestroy.o lstNext.o
+ lstDatum.o lstMember.o lstSucc.o lstDeQueue.o lstForEachFrom.o \
+ lstDestroy.o lstNext.o
CFLAGS+=-I..
all: ${OBJ}
diff --git a/usr.bin/make/lst.lib/lstDestroy.c b/usr.bin/make/lst.lib/lstDestroy.c
index 4625656e3c3..87861d8417b 100644
--- a/usr.bin/make/lst.lib/lstDestroy.c
+++ b/usr.bin/make/lst.lib/lstDestroy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lstDestroy.c,v 1.5 1999/12/18 21:53:33 espie Exp $ */
+/* $OpenBSD: lstDestroy.c,v 1.6 2000/06/10 01:32:23 espie Exp $ */
/* $NetBSD: lstDestroy.c,v 1.6 1996/11/06 17:59:37 christos Exp $ */
/*
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)lstDestroy.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: lstDestroy.c,v 1.5 1999/12/18 21:53:33 espie Exp $";
+static char rcsid[] = "$OpenBSD: lstDestroy.c,v 1.6 2000/06/10 01:32:23 espie Exp $";
#endif
#endif /* not lint */
@@ -68,9 +68,9 @@ static char rcsid[] = "$OpenBSD: lstDestroy.c,v 1.5 1999/12/18 21:53:33 espie Ex
*-----------------------------------------------------------------------
*/
void
-Lst_Destroy (l, freeProc)
+Lst_Destroy(l, freeProc)
Lst l;
- register void (*freeProc) __P((ClientData));
+ SimpleProc freeProc;
{
register ListNode ln;
register ListNode tln = NULL;
diff --git a/usr.bin/make/lst.lib/lstDupl.c b/usr.bin/make/lst.lib/lstDupl.c
index 69c53b3d5a6..1ae98f2983f 100644
--- a/usr.bin/make/lst.lib/lstDupl.c
+++ b/usr.bin/make/lst.lib/lstDupl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lstDupl.c,v 1.7 1999/12/18 21:58:08 espie Exp $ */
+/* $OpenBSD: lstDupl.c,v 1.8 2000/06/10 01:32:23 espie Exp $ */
/* $NetBSD: lstDupl.c,v 1.6 1996/11/06 17:59:37 christos Exp $ */
/*
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)lstDupl.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: lstDupl.c,v 1.7 1999/12/18 21:58:08 espie Exp $";
+static char rcsid[] = "$OpenBSD: lstDupl.c,v 1.8 2000/06/10 01:32:23 espie Exp $";
#endif
#endif /* not lint */
@@ -67,10 +67,9 @@ static char rcsid[] = "$OpenBSD: lstDupl.c,v 1.7 1999/12/18 21:58:08 espie Exp $
*-----------------------------------------------------------------------
*/
Lst
-Lst_Duplicate (l, copyProc)
- Lst l; /* the list to duplicate */
- /* A function to duplicate each ClientData */
- ClientData (*copyProc) __P((ClientData));
+Lst_Duplicate(l, copyProc)
+ Lst l;
+ DuplicateProc copyProc;
{
register Lst nl;
register ListNode ln;
diff --git a/usr.bin/make/lst.lib/lstForEachFrom.c b/usr.bin/make/lst.lib/lstForEachFrom.c
index 5fe2dc3ec9b..563d6023fee 100644
--- a/usr.bin/make/lst.lib/lstForEachFrom.c
+++ b/usr.bin/make/lst.lib/lstForEachFrom.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lstForEachFrom.c,v 1.5 1999/12/18 21:53:33 espie Exp $ */
+/* $OpenBSD: lstForEachFrom.c,v 1.6 2000/06/10 01:32:23 espie Exp $ */
/* $NetBSD: lstForEachFrom.c,v 1.5 1996/11/06 17:59:42 christos Exp $ */
/*
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)lstForEachFrom.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: lstForEachFrom.c,v 1.5 1999/12/18 21:53:33 espie Exp $";
+static char rcsid[] = "$OpenBSD: lstForEachFrom.c,v 1.6 2000/06/10 01:32:23 espie Exp $";
#endif
#endif /* not lint */
@@ -56,64 +56,32 @@ static char rcsid[] = "$OpenBSD: lstForEachFrom.c,v 1.5 1999/12/18 21:53:33 espi
/*-
*-----------------------------------------------------------------------
* Lst_ForEachFrom --
- * Apply the given function to each element of the given list. The
- * function should return 0 if traversal should continue and non-
- * zero if it should abort.
- *
- * Results:
- * None.
+ * Apply the given function to each element of the given list.
*
* Side Effects:
* Only those created by the passed-in function.
*
*-----------------------------------------------------------------------
*/
-/*VARARGS2*/
void
-Lst_ForEachFrom (l, ln, proc, d)
- Lst l;
+Lst_ForEachFrom(ln, proc, d)
LstNode ln;
- register int (*proc) __P((ClientData, ClientData));
- register ClientData d;
+ ForEachProc proc;
+ ClientData d;
{
- register ListNode tln = (ListNode)ln;
- register List list = (List)l;
- register ListNode next;
- Boolean done;
- int result;
-
- if (!LstValid (list) || LstIsEmpty (list)) {
- return;
- }
-
- do {
- /*
- * Take care of having the current element deleted out from under
- * us.
- */
-
- next = tln->nextPtr;
-
- (void) tln->useCount++;
- result = (*proc) (tln->datum, d);
- (void) tln->useCount--;
+ ListNode tln;
- /*
- * We're done with the traversal if
- * - nothing's been added after the current node and
- * - the next node to examine is the first in the queue or
- * doesn't exist.
- */
- done = (next == tln->nextPtr &&
- (next == NULL || next == list->firstPtr));
-
- next = tln->nextPtr;
+ for (tln = (ListNode)ln; tln != NULL; tln = tln->nextPtr)
+ (*proc)(tln->datum, d);
+}
- if (tln->flags & LN_DELETED) {
- free((char *)tln);
- }
- tln = next;
- } while (!result && !LstIsEmpty(list) && !done);
+void
+Lst_Every(l, proc)
+ Lst l;
+ SimpleProc proc;
+{
+ ListNode tln;
+ for (tln = (ListNode)Lst_First(l); tln != NULL; tln = tln->nextPtr)
+ (*proc)(tln->datum);
}
-
diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c
index 22d15056940..1806e58fb15 100644
--- a/usr.bin/make/main.c
+++ b/usr.bin/make/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.30 2000/04/03 02:58:46 espie Exp $ */
+/* $OpenBSD: main.c,v 1.31 2000/06/10 01:32:23 espie Exp $ */
/* $NetBSD: main.c,v 1.34 1997/03/24 20:56:36 gwr Exp $ */
/*
@@ -49,7 +49,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94";
#else
-static char rcsid[] = "$OpenBSD: main.c,v 1.30 2000/04/03 02:58:46 espie Exp $";
+static char rcsid[] = "$OpenBSD: main.c,v 1.31 2000/06/10 01:32:23 espie Exp $";
#endif
#endif /* not lint */
@@ -834,7 +834,7 @@ main(argc, argv)
Lst_Destroy(targs, NOFREE);
Lst_Destroy(variables, NOFREE);
Lst_Destroy(makefiles, NOFREE);
- Lst_Destroy(create, (void (*) __P((ClientData))) free);
+ Lst_Destroy(create, (SimpleProc)free);
/* print the graph now it's been processed if the user requested it */
if (DEBUG(GRAPH2))
@@ -1211,11 +1211,9 @@ usage()
}
-int
-PrintAddr(a, b)
+void
+PrintAddr(a)
ClientData a;
- ClientData b;
{
printf("%lx ", (unsigned long) a);
- return b ? 0 : 0;
}
diff --git a/usr.bin/make/make.c b/usr.bin/make/make.c
index 9d24b39e530..e45a0e550ef 100644
--- a/usr.bin/make/make.c
+++ b/usr.bin/make/make.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: make.c,v 1.14 2000/03/26 16:21:32 espie Exp $ */
+/* $OpenBSD: make.c,v 1.15 2000/06/10 01:32:23 espie Exp $ */
/* $NetBSD: make.c,v 1.10 1996/11/06 17:59:15 christos Exp $ */
/*
@@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)make.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: make.c,v 1.14 2000/03/26 16:21:32 espie Exp $";
+static char rcsid[] = "$OpenBSD: make.c,v 1.15 2000/06/10 01:32:23 espie Exp $";
#endif
#endif /* not lint */
@@ -93,12 +93,12 @@ static int numNodes; /* Number of nodes to be processed. If this
* is non-zero when Job_Empty() returns
* TRUE, there's a cycle in the graph */
-static int MakeAddChild __P((ClientData, ClientData));
-static int MakeAddAllSrc __P((ClientData, ClientData));
-static int MakeTimeStamp __P((ClientData, ClientData));
-static int MakeHandleUse __P((ClientData, ClientData));
+static void MakeAddChild __P((ClientData, ClientData));
+static void MakeAddAllSrc __P((ClientData, ClientData));
+static void MakeTimeStamp __P((ClientData, ClientData));
+static void MakeHandleUse __P((ClientData, ClientData));
static Boolean MakeStartJobs __P((void));
-static int MakePrintStatus __P((ClientData, ClientData));
+static void MakePrintStatus __P((ClientData, ClientData));
/*-
*-----------------------------------------------------------------------
* Make_TimeStamp --
@@ -113,23 +113,21 @@ static int MakePrintStatus __P((ClientData, ClientData));
* field of the child is greater than it.
*-----------------------------------------------------------------------
*/
-int
-Make_TimeStamp (pgn, cgn)
+void
+Make_TimeStamp(pgn, cgn)
GNode *pgn; /* the current parent */
GNode *cgn; /* the child we've just examined */
{
- if (cgn->mtime > pgn->cmtime) {
+ if (cgn->mtime > pgn->cmtime)
pgn->cmtime = cgn->mtime;
- }
- return (0);
}
-static int
-MakeTimeStamp (pgn, cgn)
+static void
+MakeTimeStamp(pgn, cgn)
ClientData pgn; /* the current parent */
ClientData cgn; /* the child we've just examined */
{
- return Make_TimeStamp((GNode *) pgn, (GNode *) cgn);
+ Make_TimeStamp((GNode *)pgn, (GNode *)cgn);
}
/*-
@@ -269,9 +267,8 @@ Make_OODate (gn)
* have their mtime stay below their children's mtime to keep parents from
* thinking they're out-of-date.
*/
- if (!oodate) {
+ if (!oodate)
Lst_ForEach(gn->parents, MakeTimeStamp, gn);
- }
return (oodate);
}
@@ -282,25 +279,20 @@ Make_OODate (gn)
* Function used by Make_Run to add a child to the list l.
* It will only add the child if its make field is FALSE.
*
- * Results:
- * Always returns 0
- *
* Side Effects:
* The given list is extended
*-----------------------------------------------------------------------
*/
-static int
-MakeAddChild (gnp, lp)
+static void
+MakeAddChild(gnp, lp)
ClientData gnp; /* the node to add */
ClientData lp; /* the list to which to add it */
{
- GNode *gn = (GNode *) gnp;
- Lst l = (Lst) lp;
+ GNode *gn = (GNode *)gnp;
+ Lst l = (Lst)lp;
- if (!gn->make && !(gn->type & OP_USE)) {
+ if (!gn->make && !(gn->type & OP_USE))
Lst_EnQueue(l, gn);
- }
- return (0);
}
/*-
@@ -317,22 +309,19 @@ MakeAddChild (gnp, lp)
* its commands are always added to the target node, even if the
* target already has commands.
*
- * Results:
- * returns 0.
- *
* Side Effects:
* Children and commands may be added to the parent and the parent's
* type may be changed.
*
*-----------------------------------------------------------------------
*/
-int
-Make_HandleUse (cgn, pgn)
- register GNode *cgn; /* The .USE node */
- register GNode *pgn; /* The target of the .USE node */
+void
+Make_HandleUse(cgn, pgn)
+ GNode *cgn; /* The .USE node */
+ GNode *pgn; /* The target of the .USE node */
{
- register GNode *gn; /* A child of the .USE node */
- register LstNode ln; /* An element in the children list */
+ GNode *gn; /* A child of the .USE node */
+ LstNode ln; /* An element in the children list */
if (cgn->type & (OP_USE|OP_TRANSFORM)) {
if ((cgn->type & OP_USE) || Lst_IsEmpty(pgn->commands)) {
@@ -369,14 +358,13 @@ Make_HandleUse (cgn, pgn)
pgn->unmade--;
}
}
- return (0);
}
-static int
-MakeHandleUse (pgn, cgn)
+static void
+MakeHandleUse(pgn, cgn)
ClientData pgn; /* the current parent */
ClientData cgn; /* the child we've just examined */
{
- return Make_HandleUse((GNode *) pgn, (GNode *) cgn);
+ Make_HandleUse((GNode *)pgn, (GNode *)cgn);
}
/*-
@@ -557,15 +545,12 @@ Make_Update (cgn)
* variable if it was actually made (since .JOIN nodes don't have
* modification times, the comparison is rather unfair...)..
*
- * Results:
- * Always returns 0
- *
* Side Effects:
* The ALLSRC variable for the given node is extended.
*-----------------------------------------------------------------------
*/
-static int
-MakeAddAllSrc (cgnp, pgnp)
+static void
+MakeAddAllSrc(cgnp, pgnp)
ClientData cgnp; /* The child to add */
ClientData pgnp; /* The parent to whose ALLSRC variable it should be */
/* added */
@@ -610,7 +595,6 @@ MakeAddAllSrc (cgnp, pgnp)
Var_Append(OODATE, child, pgn);
}
}
- return (0);
}
/*-
@@ -742,16 +726,9 @@ MakeStartJobs ()
* Print the status of a top-level node, viz. it being up-to-date
* already or not created due to an error in a lower level.
* Callback function for Make_Run via Lst_ForEach.
- *
- * Results:
- * Always returns 0.
- *
- * Side Effects:
- * A message may be printed.
- *
*-----------------------------------------------------------------------
*/
-static int
+static void
MakePrintStatus(gnp, cyclep)
ClientData gnp; /* Node to examine */
ClientData cyclep; /* True if gn->unmade being non-zero implies
@@ -788,7 +765,6 @@ MakePrintStatus(gnp, cyclep)
printf ("`%s' not remade because of errors.\n", gn->name);
}
}
- return (0);
}
@@ -855,7 +831,7 @@ Make_Run (targs)
}
}
- Lst_Destroy (examine, NOFREE);
+ Lst_Destroy(examine, NOFREE);
if (queryFlag) {
/*
diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c
index a70335207e4..04576113cba 100644
--- a/usr.bin/make/parse.c
+++ b/usr.bin/make/parse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.c,v 1.40 2000/06/10 01:26:37 espie Exp $ */
+/* $OpenBSD: parse.c,v 1.41 2000/06/10 01:32:23 espie Exp $ */
/* $NetBSD: parse.c,v 1.29 1997/03/10 21:20:04 christos Exp $ */
/*
@@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94";
#else
-static char rcsid[] = "$OpenBSD: parse.c,v 1.40 2000/06/10 01:26:37 espie Exp $";
+static char rcsid[] = "$OpenBSD: parse.c,v 1.41 2000/06/10 01:32:23 espie Exp $";
#endif
#endif /* not lint */
@@ -248,15 +248,15 @@ static struct {
static void ParseErrorInternal __P((char *, unsigned long, int, char *, ...));
static void ParseVErrorInternal __P((char *, unsigned long, int, char *, va_list));
static int ParseFindKeyword __P((char *));
-static int ParseLinkSrc __P((ClientData, ClientData));
+static void ParseLinkSrc __P((ClientData, ClientData));
static int ParseDoOp __P((ClientData, ClientData));
static int ParseAddDep __P((ClientData, ClientData));
static void ParseDoSrc __P((int, char *, Lst));
static int ParseFindMain __P((ClientData, ClientData));
-static int ParseAddDir __P((ClientData, ClientData));
-static int ParseClearPath __P((ClientData, ClientData));
+static void ParseAddDir __P((ClientData, ClientData));
+static void ParseClearPath __P((ClientData));
static void ParseDoDependency __P((char *));
-static int ParseAddCmd __P((ClientData, ClientData));
+static void ParseAddCmd __P((ClientData, ClientData));
static int __inline ParseReadc __P((void));
static void ParseUnreadc __P((int));
static void ParseHasCommands __P((ClientData));
@@ -422,37 +422,32 @@ Parse_Error(va_alist)
* ParseDoDependency. If the specType isn't 'Not', the parent
* isn't linked as a parent of the child.
*
- * Results:
- * Always = 0
- *
* Side Effects:
* New elements are added to the parents list of cgn and the
* children list of cgn. the unmade field of pgn is updated
* to reflect the additional child.
*---------------------------------------------------------------------
*/
-static int
-ParseLinkSrc (pgnp, cgnp)
+static void
+ParseLinkSrc(pgnp, cgnp)
ClientData pgnp; /* The parent node */
ClientData cgnp; /* The child node */
{
- GNode *pgn = (GNode *) pgnp;
- GNode *cgn = (GNode *) cgnp;
+ GNode *pgn = (GNode *)pgnp;
+ GNode *cgn = (GNode *)cgnp;
if (Lst_Member(pgn->children, cgn) == NULL) {
Lst_AtEnd(pgn->children, cgn);
- if (specType == Not) {
+ if (specType == Not)
Lst_AtEnd(cgn->parents, pgn);
- }
pgn->unmade += 1;
}
- return (0);
}
/*-
*---------------------------------------------------------------------
* ParseDoOp --
* Apply the parsed operator to the given target node. Used in a
- * Lst_ForEach call by ParseDoDependency once all targets have
+ * Lst_Find call by ParseDoDependency once all targets have
* been found and their operator parsed. If the previous and new
* operators are incompatible, a major error is taken.
*
@@ -714,21 +709,17 @@ ParseFindMain(gnp, dummy)
* ParseAddDir --
* Front-end for Dir_AddDir to make sure Lst_ForEach keeps going
*
- * Results:
- * === 0
- *
* Side Effects:
* See Dir_AddDir.
*
*-----------------------------------------------------------------------
*/
-static int
+static void
ParseAddDir(path, name)
ClientData path;
ClientData name;
{
- Dir_AddDir((Lst) path, (char *) name);
- return(0);
+ Dir_AddDir((Lst)path, (char *)name);
}
/*-
@@ -736,21 +727,16 @@ ParseAddDir(path, name)
* ParseClearPath --
* Front-end for Dir_ClearPath to make sure Lst_ForEach keeps going
*
- * Results:
- * === 0
- *
* Side Effects:
* See Dir_ClearPath
*
*-----------------------------------------------------------------------
*/
-static int
-ParseClearPath(path, dummy)
+static void
+ParseClearPath(path)
ClientData path;
- ClientData dummy;
{
- Dir_ClearPath((Lst) path);
- return(dummy ? 0 : 0);
+ Dir_ClearPath((Lst)path);
}
/*-
@@ -1152,7 +1138,7 @@ ParseDoDependency (line)
beSilent = TRUE;
break;
case ExPath:
- Lst_ForEach(paths, ParseClearPath, NULL);
+ Lst_Every(paths, ParseClearPath);
break;
default:
break;
@@ -1277,7 +1263,7 @@ ParseDoDependency (line)
while ((gn = (GNode *)Lst_DeQueue(sources)) != NULL)
ParseDoSrc(tOp, gn->name, curSrcs);
- Lst_Destroy (sources, NOFREE);
+ Lst_Destroy(sources, NOFREE);
cp = line;
} else {
if (*cp) {
@@ -1577,18 +1563,15 @@ Parse_DoVar (line, ctxt)
* ParseAddCmd --
* Lst_ForEach function to add a command line to all targets
*
- * Results:
- * Always 0
- *
* Side Effects:
* A new element is added to the commands list of the node.
*/
-static int
+static void
ParseAddCmd(gnp, cmd)
ClientData gnp; /* the node to which the command is to be added */
ClientData cmd; /* the command to add */
{
- GNode *gn = (GNode *) gnp;
+ GNode *gn = (GNode *)gnp;
/* if target already supplied, ignore commands */
if (!(gn->type & OP_HAS_COMMANDS)) {
Lst_AtEnd(gn->commands, cmd);
@@ -1597,7 +1580,6 @@ ParseAddCmd(gnp, cmd)
gn->fname = Parse_Getfilename();
}
}
- return(0);
}
/*-
@@ -2422,9 +2404,6 @@ test_char:
* ParseFinishLine --
* Handle the end of a dependency group.
*
- * Results:
- * Nothing.
- *
* Side Effects:
* inLine set FALSE. 'targets' list destroyed.
*
@@ -2434,8 +2413,8 @@ static void
ParseFinishLine()
{
if (inLine) {
- Lst_ForEach(targets, Suff_EndTransform, NULL);
- Lst_Destroy (targets, ParseHasCommands);
+ Lst_Every(targets, Suff_EndTransform);
+ Lst_Destroy(targets, ParseHasCommands);
targets = NULL;
inLine = FALSE;
}
@@ -2527,7 +2506,7 @@ Parse_File(name, stream)
* in a dependency spec, add the command to the list of
* commands of all targets in the dependency spec
*/
- Lst_ForEach (targets, ParseAddCmd, cp);
+ Lst_ForEach(targets, ParseAddCmd, cp);
#ifdef CLEANUP
Lst_AtEnd(targCmds, line);
#endif
@@ -2663,7 +2642,7 @@ void
Parse_End()
{
#ifdef CLEANUP
- Lst_Destroy(targCmds, (void (*) __P((ClientData))) free);
+ Lst_Destroy(targCmds, (SimpleProc)free);
Lst_Destroy(fileNames, (void (*) __P((ClientData))) free);
if (targets)
Lst_Destroy(targets, NOFREE);
diff --git a/usr.bin/make/suff.c b/usr.bin/make/suff.c
index 53b85cb3fba..4a6c8984cbb 100644
--- a/usr.bin/make/suff.c
+++ b/usr.bin/make/suff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: suff.c,v 1.26 2000/06/10 01:26:37 espie Exp $ */
+/* $OpenBSD: suff.c,v 1.27 2000/06/10 01:32:23 espie Exp $ */
/* $NetBSD: suff.c,v 1.13 1996/11/06 17:59:25 christos Exp $ */
/*
@@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)suff.c 8.4 (Berkeley) 3/21/94";
#else
-static char rcsid[] = "$OpenBSD: suff.c,v 1.26 2000/06/10 01:26:37 espie Exp $";
+static char rcsid[] = "$OpenBSD: suff.c,v 1.27 2000/06/10 01:32:23 espie Exp $";
#endif
#endif /* not lint */
@@ -171,20 +171,20 @@ static void SuffFree __P((ClientData));
static void SuffInsert __P((Lst, Suff *));
static void SuffRemove __P((Lst, Suff *));
static Boolean SuffParseTransform __P((char *, Suff **, Suff **));
-static int SuffRebuildGraph __P((ClientData, ClientData));
-static int SuffAddSrc __P((ClientData, ClientData));
+static void SuffRebuildGraph __P((ClientData, ClientData));
+static void SuffAddSrc __P((ClientData, ClientData));
static int SuffRemoveSrc __P((Lst));
static void SuffAddLevel __P((Lst, Src *));
static Src *SuffFindThem __P((Lst, Lst));
static Src *SuffFindCmds __P((Src *, Lst));
-static int SuffExpandChildren __P((ClientData, ClientData));
+static void SuffExpandChildren __P((ClientData, ClientData));
static Boolean SuffApplyTransform __P((GNode *, GNode *, Suff *, Suff *));
static void SuffFindDeps __P((GNode *, Lst));
static void SuffFindArchiveDeps __P((GNode *, Lst));
static void SuffFindNormalDeps __P((GNode *, Lst));
-static int SuffPrintName __P((ClientData, ClientData));
-static int SuffPrintSuff __P((ClientData, ClientData));
-static int SuffPrintTrans __P((ClientData, ClientData));
+static void SuffPrintName __P((ClientData));
+static void SuffPrintSuff __P((ClientData));
+static void SuffPrintTrans __P((ClientData));
/*************** Lst Predicates ****************/
/*-
@@ -369,10 +369,10 @@ SuffFree (sp)
if (s == emptySuff)
emptySuff = NULL;
- Lst_Destroy (s->ref, NOFREE);
- Lst_Destroy (s->children, NOFREE);
- Lst_Destroy (s->parents, NOFREE);
- Lst_Destroy (s->searchPath, Dir_Destroy);
+ Lst_Destroy(s->ref, NOFREE);
+ Lst_Destroy(s->children, NOFREE);
+ Lst_Destroy(s->parents, NOFREE);
+ Lst_Destroy(s->searchPath, Dir_Destroy);
free ((Address)s->name);
free ((Address)s);
@@ -614,8 +614,8 @@ Suff_AddTransform (line)
* attached to several different transformations.
*/
gn = (GNode *) Lst_Datum (ln);
- Lst_Destroy (gn->commands, NOFREE);
- Lst_Destroy (gn->children, NOFREE);
+ Lst_Destroy(gn->commands, NOFREE);
+ Lst_Destroy(gn->children, NOFREE);
gn->commands = Lst_Init();
gn->children = Lst_Init();
}
@@ -645,21 +645,17 @@ Suff_AddTransform (line)
* sources. This is a callback procedure for the Parse module via
* Lst_ForEach
*
- * Results:
- * === 0
- *
* Side Effects:
* If the node has no commands or children, the children and parents
* lists of the affected suffices are altered.
*
*-----------------------------------------------------------------------
*/
-int
-Suff_EndTransform(gnp, dummy)
+void
+Suff_EndTransform(gnp)
ClientData gnp; /* Node for transformation */
- ClientData dummy; /* Node for transformation */
{
- GNode *gn = (GNode *) gnp;
+ GNode *gn = (GNode *)gnp;
if ((gn->type & OP_TRANSFORM) && Lst_IsEmpty(gn->commands) &&
Lst_IsEmpty(gn->children))
@@ -688,8 +684,6 @@ Suff_EndTransform(gnp, dummy)
} else if ((gn->type & OP_TRANSFORM) && DEBUG(SUFF)) {
printf("transformation %s complete\n", gn->name);
}
-
- return(dummy ? 0 : 0);
}
/*-
@@ -702,22 +696,19 @@ Suff_EndTransform(gnp, dummy)
* existing suffix, the proper relationship is established between
* the two.
*
- * Results:
- * Always 0.
- *
* Side Effects:
* The appropriate links will be made between this suffix and
* others if transformation rules exist for it.
*
*-----------------------------------------------------------------------
*/
-static int
+static void
SuffRebuildGraph(transformp, sp)
ClientData transformp; /* Transformation to test */
ClientData sp; /* Suffix to rebuild */
{
- GNode *transform = (GNode *) transformp;
- Suff *s = (Suff *) sp;
+ GNode *transform = (GNode *)transformp;
+ Suff *s = (Suff *)sp;
char *cp;
LstNode ln;
Suff *s2;
@@ -726,7 +717,7 @@ SuffRebuildGraph(transformp, sp)
* First see if it is a transformation from this suffix.
*/
cp = SuffStrIsPrefix(s->name, transform->name);
- if (cp != (char *)NULL) {
+ if (cp != NULL) {
ln = Lst_Find(sufflist, SuffSuffHasNameP, cp);
if (ln != NULL) {
/*
@@ -736,7 +727,7 @@ SuffRebuildGraph(transformp, sp)
s2 = (Suff *)Lst_Datum(ln);
SuffInsert(s2->children, s);
SuffInsert(s->parents, s2);
- return(0);
+ return;
}
}
@@ -744,7 +735,7 @@ SuffRebuildGraph(transformp, sp)
* Not from, maybe to?
*/
cp = SuffSuffIsSuffix(s, transform->name + strlen(transform->name));
- if (cp != (char *)NULL) {
+ if (cp != NULL) {
/*
* Null-terminate the source suffix in order to find it.
*/
@@ -763,7 +754,6 @@ SuffRebuildGraph(transformp, sp)
SuffInsert(s2->parents, s);
}
}
- return(0);
}
/*-
@@ -887,7 +877,7 @@ Suff_DoPaths()
#endif /* LIBRARIES */
Dir_Concat(s->searchPath, dirSearchPath);
} else {
- Lst_Destroy (s->searchPath, Dir_Destroy);
+ Lst_Destroy(s->searchPath, Dir_Destroy);
s->searchPath = Lst_Duplicate(dirSearchPath, Dir_CopyDir);
}
}
@@ -971,20 +961,17 @@ Suff_AddLib (sname)
* being the given Src structure. If the suffix is the null suffix,
* the prefix is used unaltered as the file name in the Src structure.
*
- * Results:
- * always returns 0
- *
* Side Effects:
* A Src structure is created and tacked onto the end of the list
*-----------------------------------------------------------------------
*/
-static int
-SuffAddSrc (sp, lsp)
+static void
+SuffAddSrc(sp, lsp)
ClientData sp; /* suffix for which to create a Src structure */
ClientData lsp; /* list and parent for the new Src */
{
- Suff *s = (Suff *) sp;
- LstSrc *ls = (LstSrc *) lsp;
+ Suff *s = (Suff *)sp;
+ LstSrc *ls = (LstSrc *)lsp;
Src *s2; /* new Src structure */
Src *targ; /* Target structure */
@@ -1009,7 +996,7 @@ SuffAddSrc (sp, lsp)
s2->cp = Lst_Init();
Lst_AtEnd(targ->cp, s2);
printf("1 add %x %x to %x:", targ, s2, ls->l);
- Lst_ForEach(ls->l, PrintAddr, NULL);
+ Lst_Every(ls->l, PrintAddr);
printf("\n");
#endif
}
@@ -1026,11 +1013,9 @@ SuffAddSrc (sp, lsp)
s2->cp = Lst_Init();
Lst_AtEnd(targ->cp, s2);
printf("2 add %x %x to %x:", targ, s2, ls->l);
- Lst_ForEach(ls->l, PrintAddr, NULL);
+ Lst_Every(ls->l, PrintAddr);
printf("\n");
#endif
-
- return(0);
}
/*-
@@ -1055,7 +1040,7 @@ SuffAddLevel (l, targ)
ls.s = targ;
ls.l = l;
- Lst_ForEach (targ->suff->children, SuffAddSrc, &ls);
+ Lst_ForEach(targ->suff->children, SuffAddSrc, &ls);
}
/*-
@@ -1083,7 +1068,7 @@ SuffRemoveSrc (l)
}
#ifdef DEBUG_SRC
printf("cleaning %lx: ", (unsigned long) l);
- Lst_ForEach(l, PrintAddr, NULL);
+ Lst_Every(l, PrintAddr);
printf("\n");
#endif
@@ -1115,7 +1100,7 @@ SuffRemoveSrc (l)
#ifdef DEBUG_SRC
else {
printf("keep: [l=%x] p=%x %d: ", l, s, s->children);
- Lst_ForEach(s->cp, PrintAddr, NULL);
+ Lst_Every(s->cp, PrintAddr);
printf("\n");
}
#endif
@@ -1285,9 +1270,6 @@ SuffFindCmds (targ, slst)
* Expand the names of any children of a given node that contain
* variable invocations or file wildcards into actual targets.
*
- * Results:
- * === 0 (continue)
- *
* Side Effects:
* The expanded node is removed from the parent's list of children,
* and the parent's unmade counter is decremented, but other nodes
@@ -1295,13 +1277,13 @@ SuffFindCmds (targ, slst)
*
*-----------------------------------------------------------------------
*/
-static int
+static void
SuffExpandChildren(cgnp, pgnp)
ClientData cgnp; /* Child to examine */
ClientData pgnp; /* Parent node being processed */
{
- GNode *cgn = (GNode *) cgnp;
- GNode *pgn = (GNode *) pgnp;
+ GNode *cgn = (GNode *)cgnp;
+ GNode *pgn = (GNode *)pgnp;
GNode *gn; /* New source 8) */
LstNode prevLN; /* Node after which new source should be put */
LstNode ln; /* List element for old source */
@@ -1319,13 +1301,12 @@ SuffExpandChildren(cgnp, pgnp)
* to later since the resulting words are tacked on to the end of
* the children list.
*/
- if (strchr(cgn->name, '$') != (char *)NULL) {
- if (DEBUG(SUFF)) {
+ if (strchr(cgn->name, '$') != NULL) {
+ if (DEBUG(SUFF))
printf("Expanding \"%s\"...", cgn->name);
- }
cp = Var_Subst(cgn->name, pgn, TRUE);
- if (cp != (char *)NULL) {
+ if (cp != NULL) {
Lst members = Lst_Init();
if (cgn->type & OP_ARCHV) {
@@ -1377,13 +1358,11 @@ SuffExpandChildren(cgnp, pgnp)
Boolean doFree;
junk = Var_Parse(cp, pgn, TRUE, &len, &doFree);
- if (junk != var_Error) {
+ if (junk != var_Error)
cp += len - 1;
- }
- if (doFree) {
+ if (doFree)
free(junk);
- }
} else if (*cp == '\\' && *cp != '\0') {
/*
* Escaped something -- skip over it
@@ -1409,9 +1388,8 @@ SuffExpandChildren(cgnp, pgnp)
* Add all elements of the members list to the parent node.
*/
while((gn = (GNode *)Lst_DeQueue(members)) != NULL) {
- if (DEBUG(SUFF)) {
+ if (DEBUG(SUFF))
printf("%s...", gn->name);
- }
if (Lst_Member(pgn->children, gn) == NULL) {
Lst_Append(pgn->children, prevLN, gn);
prevLN = Lst_Succ(prevLN);
@@ -1423,7 +1401,7 @@ SuffExpandChildren(cgnp, pgnp)
/*
* Free the result
*/
- free((char *)cp);
+ free(cp);
}
/*
* Now the source is expanded, remove it from the list of children to
@@ -1432,9 +1410,8 @@ SuffExpandChildren(cgnp, pgnp)
ln = Lst_Member(pgn->children, cgn);
pgn->unmade--;
Lst_Remove(pgn->children, ln);
- if (DEBUG(SUFF)) {
+ if (DEBUG(SUFF))
printf("\n");
- }
} else if (Dir_HasWildcards(cgn->name)) {
Lst exp; /* List of expansions */
Lst path; /* Search path along which to expand */
@@ -1450,16 +1427,14 @@ SuffExpandChildren(cgnp, pgnp)
cp = cgn->name + strlen(cgn->name);
ln = Lst_Find(sufflist, SuffSuffIsSuffixP, cp);
- if (DEBUG(SUFF)) {
+ if (DEBUG(SUFF))
printf("Wildcard expanding \"%s\"...", cgn->name);
- }
if (ln != NULL) {
Suff *s = (Suff *)Lst_Datum(ln);
- if (DEBUG(SUFF)) {
+ if (DEBUG(SUFF))
printf("suffix is \"%s\"...", s->name);
- }
path = s->searchPath;
} else {
/*
@@ -1476,9 +1451,8 @@ SuffExpandChildren(cgnp, pgnp)
/* Fetch next expansion off the list and find its GNode. */
while ((cp = (char *)Lst_DeQueue(exp)) != NULL) {
- if (DEBUG(SUFF)) {
+ if (DEBUG(SUFF))
printf("%s...", cp);
- }
gn = Targ_FindNode(cp, TARG_CREATE);
/*
@@ -1505,12 +1479,9 @@ SuffExpandChildren(cgnp, pgnp)
ln = Lst_Member(pgn->children, cgn);
pgn->unmade--;
Lst_Remove(pgn->children, ln);
- if (DEBUG(SUFF)) {
+ if (DEBUG(SUFF))
printf("\n");
- }
}
-
- return(0);
}
/*-
@@ -1609,8 +1580,7 @@ SuffApplyTransform(tGn, sGn, t, s)
* Deal with wildcards and variables in any acquired sources
*/
ln = Lst_Succ(ln);
- if (ln != NULL)
- Lst_ForEachFrom(tGn->children, ln, SuffExpandChildren, tGn);
+ Lst_ForEachFrom(ln, SuffExpandChildren, tGn);
/*
* Keep track of another parent to which this beast is transformed so
@@ -2328,79 +2298,70 @@ Suff_End()
/********************* DEBUGGING FUNCTIONS **********************/
-static int SuffPrintName(s, dummy)
+static void SuffPrintName(s)
ClientData s;
- ClientData dummy;
{
- printf ("%s ", ((Suff *) s)->name);
- return (dummy ? 0 : 0);
+ printf("%s ", ((Suff *)s)->name);
}
-static int
-SuffPrintSuff (sp, dummy)
+static void
+SuffPrintSuff(sp)
ClientData sp;
- ClientData dummy;
{
- Suff *s = (Suff *) sp;
+ Suff *s = (Suff *)sp;
int flags;
int flag;
- printf ("# `%s' ", s->name);
+ printf("# `%s' ", s->name);
flags = s->flags;
if (flags) {
- fputs (" (", stdout);
+ fputs(" (", stdout);
while (flags) {
flag = 1 << (ffs(flags) - 1);
flags &= ~flag;
switch (flag) {
case SUFF_NULL:
- printf ("NULL");
+ printf("NULL");
break;
case SUFF_INCLUDE:
- printf ("INCLUDE");
+ printf("INCLUDE");
break;
case SUFF_LIBRARY:
- printf ("LIBRARY");
+ printf("LIBRARY");
break;
}
fputc(flags ? '|' : ')', stdout);
}
}
- fputc ('\n', stdout);
- printf ("#\tTo: ");
- Lst_ForEach(s->parents, SuffPrintName, NULL);
- fputc ('\n', stdout);
- printf ("#\tFrom: ");
- Lst_ForEach(s->children, SuffPrintName, NULL);
- fputc ('\n', stdout);
- printf ("#\tSearch Path: ");
- Dir_PrintPath (s->searchPath);
- fputc ('\n', stdout);
- return (dummy ? 0 : 0);
+ printf("\n#\tTo: ");
+ Lst_Every(s->parents, SuffPrintName);
+ printf("\n#\tFrom: ");
+ Lst_Every(s->children, SuffPrintName);
+ printf("\n#\tSearch Path: ");
+ Dir_PrintPath(s->searchPath);
+ fputc('\n', stdout);
}
-static int
-SuffPrintTrans (tp, dummy)
+static void
+SuffPrintTrans(tp)
ClientData tp;
- ClientData dummy;
{
- GNode *t = (GNode *) tp;
-
- printf ("%-16s: ", t->name);
- Targ_PrintType (t->type);
- fputc ('\n', stdout);
- Lst_ForEach(t->commands, Targ_PrintCmd, NULL);
- fputc ('\n', stdout);
- return(dummy ? 0 : 0);
+ GNode *t = (GNode *)tp;
+
+ printf("%-16s: ", t->name);
+ Targ_PrintType(t->type);
+ fputc('\n', stdout);
+ Lst_Every(t->commands, Targ_PrintCmd);
+ fputc('\n', stdout);
}
void
Suff_PrintAll()
{
- printf ("#*** Suffixes:\n");
- Lst_ForEach(sufflist, SuffPrintSuff, NULL);
+ printf("#*** Suffixes:\n");
+ Lst_Every(sufflist, SuffPrintSuff);
- printf ("#*** Transformations:\n");
- Lst_ForEach(transforms, SuffPrintTrans, NULL);
+ printf("#*** Transformations:\n");
+ Lst_Every(transforms, SuffPrintTrans);
}
diff --git a/usr.bin/make/targ.c b/usr.bin/make/targ.c
index a01597c21fa..f7bc0b65b62 100644
--- a/usr.bin/make/targ.c
+++ b/usr.bin/make/targ.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: targ.c,v 1.16 2000/04/17 23:57:46 espie Exp $ */
+/* $OpenBSD: targ.c,v 1.17 2000/06/10 01:32:23 espie Exp $ */
/* $NetBSD: targ.c,v 1.11 1997/02/20 16:51:50 christos Exp $ */
/*
@@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)targ.c 8.2 (Berkeley) 3/19/94";
#else
-static char *rcsid = "$OpenBSD: targ.c,v 1.16 2000/04/17 23:57:46 espie Exp $";
+static char *rcsid = "$OpenBSD: targ.c,v 1.17 2000/06/10 01:32:23 espie Exp $";
#endif
#endif /* not lint */
@@ -102,9 +102,9 @@ static Hash_Table targets; /* a hash table of same */
#define HTSIZE 191 /* initial size of hash table */
-static int TargPrintOnlySrc __P((ClientData, ClientData));
-static int TargPrintName __P((ClientData, ClientData));
-static int TargPrintNode __P((ClientData, ClientData));
+static void TargPrintOnlySrc __P((ClientData));
+static void TargPrintName __P((ClientData));
+static void TargPrintNode __P((ClientData, ClientData));
#ifdef CLEANUP
static void TargFreeGN __P((ClientData));
#endif
@@ -429,34 +429,21 @@ Targ_SetMain (gn)
mainTarg = gn;
}
-static int
-TargPrintName (gnp, ppath)
+static void
+TargPrintName(gnp)
ClientData gnp;
- ClientData ppath;
{
- GNode *gn = (GNode *) gnp;
- printf ("%s ", gn->name);
-#ifdef notdef
- if (ppath) {
- if (gn->path) {
- printf ("[%s] ", gn->path);
- }
- if (gn == mainTarg) {
- printf ("(MAIN NAME) ");
- }
- }
-#endif /* notdef */
- return (ppath ? 0 : 0);
+ GNode *gn = (GNode *)gnp;
+
+ printf("%s ", gn->name);
}
-int
-Targ_PrintCmd (cmd, dummy)
+void
+Targ_PrintCmd(cmd)
ClientData cmd;
- ClientData dummy;
{
- printf ("\t%s\n", (char *) cmd);
- return (dummy ? 0 : 0);
+ printf("\t%s\n", (char *)cmd);
}
/*-
@@ -543,51 +530,48 @@ Targ_PrintType (type)
* print the contents of a node
*-----------------------------------------------------------------------
*/
-static int
-TargPrintNode (gnp, passp)
+static void
+TargPrintNode(gnp, passp)
ClientData gnp;
ClientData passp;
{
- GNode *gn = (GNode *) gnp;
- int pass = *(int *) passp;
+ GNode *gn = (GNode *)gnp;
+ int pass = *(int *)passp;
if (!OP_NOP(gn->type)) {
printf("#\n");
- if (gn == mainTarg) {
+ if (gn == mainTarg)
printf("# *** MAIN TARGET ***\n");
- }
if (pass == 2) {
- if (gn->unmade) {
+ if (gn->unmade)
printf("# %d unmade children\n", gn->unmade);
- } else {
+ else
printf("# No unmade children\n");
- }
if (! (gn->type & (OP_JOIN|OP_USE|OP_EXEC))) {
- if (gn->mtime != OUT_OF_DATE) {
+ if (gn->mtime != OUT_OF_DATE)
printf("# last modified %s: %s\n",
Targ_FmtTime(gn->mtime),
(gn->made == UNMADE ? "unmade" :
(gn->made == MADE ? "made" :
(gn->made == UPTODATE ? "up-to-date" :
"error when made"))));
- } else if (gn->made != UNMADE) {
+ else if (gn->made != UNMADE)
printf("# non-existent (maybe): %s\n",
(gn->made == MADE ? "made" :
(gn->made == UPTODATE ? "up-to-date" :
(gn->made == ERROR ? "error when made" :
"aborted"))));
- } else {
+ else
printf("# unmade\n");
- }
}
if (!Lst_IsEmpty (gn->iParents)) {
printf("# implicit parents: ");
- Lst_ForEach(gn->iParents, TargPrintName, NULL);
- fputc ('\n', stdout);
+ Lst_Every(gn->iParents, TargPrintName);
+ fputc('\n', stdout);
}
}
if (!Lst_IsEmpty (gn->parents)) {
printf("# parents: ");
- Lst_ForEach(gn->parents, TargPrintName, NULL);
+ Lst_Every(gn->parents, TargPrintName);
fputc ('\n', stdout);
}
@@ -600,16 +584,14 @@ TargPrintNode (gnp, passp)
case OP_DOUBLEDEP:
printf(":: "); break;
}
- Targ_PrintType (gn->type);
- Lst_ForEach(gn->children, TargPrintName, NULL);
- fputc ('\n', stdout);
- Lst_ForEach(gn->commands, Targ_PrintCmd, NULL);
+ Targ_PrintType(gn->type);
+ Lst_Every(gn->children, TargPrintName);
+ fputc('\n', stdout);
+ Lst_Every(gn->commands, Targ_PrintCmd);
printf("\n\n");
- if (gn->type & OP_DOUBLEDEP) {
+ if (gn->type & OP_DOUBLEDEP)
Lst_ForEach(gn->cohorts, TargPrintNode, &pass);
- }
}
- return (0);
}
/*-
@@ -617,24 +599,19 @@ TargPrintNode (gnp, passp)
* TargPrintOnlySrc --
* Print only those targets that are just a source.
*
- * Results:
- * 0.
- *
* Side Effects:
* The name of each file is printed preceeded by #\t
*
*-----------------------------------------------------------------------
*/
-static int
-TargPrintOnlySrc(gnp, dummy)
+static void
+TargPrintOnlySrc(gnp)
ClientData gnp;
- ClientData dummy;
{
- GNode *gn = (GNode *) gnp;
+ GNode *gn = (GNode *)gnp;
+
if (OP_NOP(gn->type))
printf("#\t%s [%s]\n", gn->name, gn->path ? gn->path : gn->name);
-
- return (dummy ? 0 : 0);
}
/*-
@@ -658,7 +635,7 @@ Targ_PrintGraph (pass)
Lst_ForEach(allTargets, TargPrintNode, &pass);
printf("\n\n");
printf("#\n# Files that are only sources:\n");
- Lst_ForEach(allTargets, TargPrintOnlySrc, NULL);
+ Lst_Every(allTargets, TargPrintOnlySrc);
printf("#*** Global Variables:\n");
Var_Dump (VAR_GLOBAL);
printf("#*** Command-line Variables:\n");
diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c
index a7b5610b2fb..baf2662bea2 100644
--- a/usr.bin/make/var.c
+++ b/usr.bin/make/var.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: var.c,v 1.30 2000/03/26 16:21:33 espie Exp $ */
+/* $OpenBSD: var.c,v 1.31 2000/06/10 01:32:23 espie Exp $ */
/* $NetBSD: var.c,v 1.18 1997/03/18 19:24:46 christos Exp $ */
/*
@@ -70,7 +70,7 @@
#if 0
static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94";
#else
-static char rcsid[] = "$OpenBSD: var.c,v 1.30 2000/03/26 16:21:33 espie Exp $";
+static char rcsid[] = "$OpenBSD: var.c,v 1.31 2000/06/10 01:32:23 espie Exp $";
#endif
#endif /* not lint */
@@ -227,7 +227,7 @@ static char *VarQuote __P((char *));
static char *VarModify __P((char *, Boolean (*)(char *, Boolean, Buffer,
ClientData),
ClientData));
-static int VarPrintVar __P((ClientData, ClientData));
+static void VarPrintVar __P((ClientData));
static Boolean VarUppercase __P((char *word, Boolean addSpace, Buffer buf, ClientData dummy));
static Boolean VarLowercase __P((char *word, Boolean addSpace, Buffer buf, ClientData dummy));
@@ -2330,14 +2330,13 @@ Var_End ()
/****************** PRINT DEBUGGING INFO *****************/
-static int
-VarPrintVar(vp, dummy)
+static void
+VarPrintVar(vp)
ClientData vp;
- ClientData dummy;
{
- Var *v = (Var *) vp;
+ Var *v = (Var *)vp;
+
printf("%-16s = %s\n", v->name, VarValue(v));
- return (dummy ? 0 : 0);
}
/*-
@@ -2350,5 +2349,5 @@ void
Var_Dump (ctxt)
GNode *ctxt;
{
- Lst_ForEach(ctxt->context, VarPrintVar, NULL);
+ Lst_Every(ctxt->context, VarPrintVar);
}