Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make make(1): define aliases for function types in l...
details: https://anonhg.NetBSD.org/src/rev/33837cfd5811
branches: trunk
changeset: 937687:33837cfd5811
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Aug 23 16:43:34 2020 +0000
description:
make(1): define aliases for function types in list processing
This makes the prototypes of the functions clearer.
diffstat:
usr.bin/make/lst.c | 10 +++++-----
usr.bin/make/lst.h | 22 +++++++++++-----------
usr.bin/make/meta.c | 4 ++--
3 files changed, 18 insertions(+), 18 deletions(-)
diffs (118 lines):
diff -r eae60a39af75 -r 33837cfd5811 usr.bin/make/lst.c
--- a/usr.bin/make/lst.c Sun Aug 23 16:39:06 2020 +0000
+++ b/usr.bin/make/lst.c Sun Aug 23 16:43:34 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.c,v 1.39 2020/08/23 16:18:12 rillig Exp $ */
+/* $NetBSD: lst.c,v 1.40 2020/08/23 16:43:34 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -37,11 +37,11 @@
#include "make.h"
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: lst.c,v 1.39 2020/08/23 16:18:12 rillig Exp $";
+static char rcsid[] = "$NetBSD: lst.c,v 1.40 2020/08/23 16:43:34 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: lst.c,v 1.39 2020/08/23 16:18:12 rillig Exp $");
+__RCSID("$NetBSD: lst.c,v 1.40 2020/08/23 16:43:34 rillig Exp $");
#endif /* not lint */
#endif
@@ -125,7 +125,7 @@
* If copyProc is given, that function is used to create the new datum from the
* old datum, usually by creating a copy of it. */
Lst
-Lst_CopyS(Lst list, DuplicateProc *copyProc)
+Lst_CopyS(Lst list, LstCopyProc copyProc)
{
Lst newList;
LstNode node;
@@ -145,7 +145,7 @@
/* Destroy a list and free all its resources. If the freeProc is given, it is
* called with the datum from each node in turn before the node is freed. */
void
-Lst_Destroy(Lst list, FreeProc *freeProc)
+Lst_Destroy(Lst list, LstFreeProc freeProc)
{
LstNode node;
LstNode next = NULL;
diff -r eae60a39af75 -r 33837cfd5811 usr.bin/make/lst.h
--- a/usr.bin/make/lst.h Sun Aug 23 16:39:06 2020 +0000
+++ b/usr.bin/make/lst.h Sun Aug 23 16:43:34 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.h,v 1.39 2020/08/23 10:53:27 rillig Exp $ */
+/* $NetBSD: lst.h,v 1.40 2020/08/23 16:43:34 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -92,8 +92,10 @@
typedef struct List *Lst;
typedef struct ListNode *LstNode;
-typedef void *DuplicateProc(void *);
-typedef void FreeProc(void *);
+typedef void *LstCopyProc(void *);
+typedef void LstFreeProc(void *);
+typedef int LstFindProc(const void *, const void *);
+typedef int LstActionProc(void *, void *);
/*
* Creation/destruction functions
@@ -101,9 +103,9 @@
/* Create a new list */
Lst Lst_Init(void);
/* Duplicate an existing list */
-Lst Lst_CopyS(Lst, DuplicateProc *);
+Lst Lst_CopyS(Lst, LstCopyProc);
/* Destroy an old one */
-void Lst_Destroy(Lst, FreeProc *);
+void Lst_Destroy(Lst, LstFreeProc);
/* True if list is empty */
Boolean Lst_IsEmpty(Lst);
@@ -144,20 +146,18 @@
* Functions for entire lists
*/
/* Find an element in a list */
-LstNode Lst_Find(Lst, const void *, int (*)(const void *, const void *));
+LstNode Lst_Find(Lst, const void *, LstFindProc);
/* Find an element starting from somewhere */
-LstNode Lst_FindFrom(Lst, LstNode, const void *,
- int (*cmp)(const void *, const void *));
+LstNode Lst_FindFrom(Lst, LstNode, const void *, LstFindProc);
/*
* See if the given datum is on the list. Returns the LstNode containing
* the datum
*/
LstNode Lst_MemberS(Lst, void *);
/* Apply a function to all elements of a lst */
-int Lst_ForEach(Lst, int (*)(void *, void *), void *);
+int Lst_ForEach(Lst, LstActionProc, void *);
/* Apply a function to all elements of a lst starting from a certain point. */
-int Lst_ForEachFrom(Lst, LstNode, int (*)(void *, void *),
- void *);
+int Lst_ForEachFrom(Lst, LstNode, LstActionProc, 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 -r eae60a39af75 -r 33837cfd5811 usr.bin/make/meta.c
--- a/usr.bin/make/meta.c Sun Aug 23 16:39:06 2020 +0000
+++ b/usr.bin/make/meta.c Sun Aug 23 16:43:34 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: meta.c,v 1.97 2020/08/22 17:34:25 rillig Exp $ */
+/* $NetBSD: meta.c,v 1.98 2020/08/23 16:43:34 rillig Exp $ */
/*
* Implement 'meta' mode.
@@ -1623,7 +1623,7 @@
}
}
- Lst_Destroy(missingFiles, (FreeProc *)free);
+ Lst_Destroy(missingFiles, free);
if (oodate && needOODATE) {
/*
Home |
Main Index |
Thread Index |
Old Index