diff --git a/usr.bin/make/for.c b/usr.bin/make/for.c index 650240179458..16c8ebfc5a7d 100644 --- a/usr.bin/make/for.c +++ b/usr.bin/make/for.c @@ -293,6 +293,6 @@ For_Run(int lineno) Lst_ForEach(arg.lst, ForExec, (void *) &arg); free(arg.var); - Lst_Destroy(arg.lst, (void (*)(void *)) free); + Lst_Destroy(arg.lst, free); Buf_Destroy(arg.buf, TRUE); } diff --git a/usr.bin/make/lst.h b/usr.bin/make/lst.h index 184206156b48..1accf25bea0d 100644 --- a/usr.bin/make/lst.h +++ b/usr.bin/make/lst.h @@ -93,13 +93,18 @@ struct Lst { }; typedef struct Lst *Lst; +typedef int CompareProc(void *, void *); +typedef int DoProc(void *, void *); +typedef void *DuplicateProc(void *); +typedef void FreeProc(void *); + /* * 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 (*)(void *)) 0) -#define NOCOPY ((void * (*)(void *)) 0) +#define NOFREE ((FreeProc *)NULL) +#define NOCOPY ((DuplicateProc *)NULL) #define LST_CONCNEW 0 /* create new LstNode's when using Lst_Concat */ #define LST_CONCLINK 1 /* relink LstNode's when using Lst_Concat */ @@ -110,9 +115,9 @@ typedef struct Lst *Lst; /* Create a new list */ Lst Lst_Init(Boolean); /* Duplicate an existing list */ -Lst Lst_Duplicate(Lst, void * (*)(void *)); +Lst Lst_Duplicate(Lst, DuplicateProc *); /* Destroy an old one */ -void Lst_Destroy(Lst, void (*)(void *)); +void Lst_Destroy(Lst, FreeProc *); /* * Functions to modify a list @@ -148,22 +153,22 @@ void * Lst_Datum(LstNode); * Functions for entire lists */ /* Find an element in a list */ -LstNode Lst_Find(Lst, void *, int (*)(void *, void *)); +LstNode Lst_Find(Lst, void *, CompareProc *); /* Find an element starting from somewhere */ -LstNode Lst_FindFrom(Lst, LstNode, void *, int (*cProc)(void *, void *)); +LstNode Lst_FindFrom(Lst, LstNode, void *, CompareProc *); /* * See if the given datum is on the list. Returns the LstNode containing * the datum */ LstNode Lst_Member(Lst, void *); /* Apply a function to all elements of a lst */ -void Lst_ForEach(Lst, int (*)(void *, void *), void *); +void Lst_ForEach(Lst, DoProc *, void *); /* * 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(Lst, LstNode, int (*)(void *, void *), void *); +void Lst_ForEachFrom(Lst, LstNode, DoProc *, void *); /* * 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/lstDestroy.c b/usr.bin/make/lst.lib/lstDestroy.c index 8942ddf6ba82..2a43c1de0648 100644 --- a/usr.bin/make/lst.lib/lstDestroy.c +++ b/usr.bin/make/lst.lib/lstDestroy.c @@ -65,7 +65,7 @@ __FBSDID("$FreeBSD$"); *----------------------------------------------------------------------- */ void -Lst_Destroy(Lst list, void (*freeProc)(void *)) +Lst_Destroy(Lst list, FreeProc *freeProc) { LstNode ln; LstNode tln = NULL; diff --git a/usr.bin/make/lst.lib/lstDupl.c b/usr.bin/make/lst.lib/lstDupl.c index 4c1842d40590..58f3f5605d90 100644 --- a/usr.bin/make/lst.lib/lstDupl.c +++ b/usr.bin/make/lst.lib/lstDupl.c @@ -68,7 +68,7 @@ __FBSDID("$FreeBSD$"); *----------------------------------------------------------------------- */ Lst -Lst_Duplicate(Lst list, void *(*copyProc)(void *)) +Lst_Duplicate(Lst list, DuplicateProc *copyProc) { Lst nl; LstNode ln; diff --git a/usr.bin/make/lst.lib/lstFind.c b/usr.bin/make/lst.lib/lstFind.c index d27907cfa92b..f0c114119b71 100644 --- a/usr.bin/make/lst.lib/lstFind.c +++ b/usr.bin/make/lst.lib/lstFind.c @@ -64,7 +64,7 @@ __FBSDID("$FreeBSD$"); *----------------------------------------------------------------------- */ LstNode -Lst_Find(Lst l, void *d, int (*cProc)(void *, void *)) +Lst_Find(Lst l, void *d, CompareProc *cProc) { return (Lst_FindFrom (l, Lst_First(l), d, cProc)); diff --git a/usr.bin/make/lst.lib/lstFindFrom.c b/usr.bin/make/lst.lib/lstFindFrom.c index 25b8c13762e6..557048bd72f4 100644 --- a/usr.bin/make/lst.lib/lstFindFrom.c +++ b/usr.bin/make/lst.lib/lstFindFrom.c @@ -65,7 +65,7 @@ __FBSDID("$FreeBSD$"); *----------------------------------------------------------------------- */ LstNode -Lst_FindFrom(Lst l, LstNode ln, void *d, int (*cProc)(void *, void *)) +Lst_FindFrom(Lst l, LstNode ln, void *d, CompareProc *cProc) { LstNode tln; Boolean found = FALSE; diff --git a/usr.bin/make/lst.lib/lstForEach.c b/usr.bin/make/lst.lib/lstForEach.c index ee3e0415265c..0d73cd05c02f 100644 --- a/usr.bin/make/lst.lib/lstForEach.c +++ b/usr.bin/make/lst.lib/lstForEach.c @@ -65,7 +65,7 @@ __FBSDID("$FreeBSD$"); *----------------------------------------------------------------------- */ void -Lst_ForEach(Lst l, int (*proc)(void *, void *), void *d) +Lst_ForEach(Lst l, DoProc *proc, void *d) { Lst_ForEachFrom(l, Lst_First(l), proc, d); diff --git a/usr.bin/make/lst.lib/lstForEachFrom.c b/usr.bin/make/lst.lib/lstForEachFrom.c index 26c585893579..69742d07df88 100644 --- a/usr.bin/make/lst.lib/lstForEachFrom.c +++ b/usr.bin/make/lst.lib/lstForEachFrom.c @@ -66,7 +66,7 @@ __FBSDID("$FreeBSD$"); *----------------------------------------------------------------------- */ void -Lst_ForEachFrom(Lst list, LstNode ln, int (*proc)(void *, void *), void *d) +Lst_ForEachFrom(Lst list, LstNode ln, DoProc *proc, void *d) { LstNode next; Boolean done; diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c index 32e7feaa9055..19f00b6ad3a7 100644 --- a/usr.bin/make/main.c +++ b/usr.bin/make/main.c @@ -874,7 +874,7 @@ main(int argc, char **argv) Lst_Destroy(variables, NOFREE); Lst_Destroy(makefiles, NOFREE); - Lst_Destroy(create, (void (*)(void *)) free); + Lst_Destroy(create, free); /* print the graph now it's been processed if the user requested it */ if (DEBUG(GRAPH2)) diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c index 52a1bc3097f1..9803e7d543f8 100644 --- a/usr.bin/make/parse.c +++ b/usr.bin/make/parse.c @@ -2536,7 +2536,7 @@ Parse_Init (void) void Parse_End (void) { - Lst_Destroy(targCmds, (void (*)(void *)) free); + Lst_Destroy(targCmds, free); if (targets) Lst_Destroy(targets, NOFREE); Lst_Destroy(sysIncPath, Dir_Destroy);