summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2005-02-07 16:27:19 +0000
committerharti <harti@FreeBSD.org>2005-02-07 16:27:19 +0000
commit15f29409bafcde8687bea33781ffe84ebc47e35a (patch)
tree4e118e98459eb3f1c332d959a111b1fb8865b0d6
parentc300f771987ddaa4c16a5f9d17b2387b55afe1e7 (diff)
downloadFreeBSD-src-15f29409bafcde8687bea33781ffe84ebc47e35a.zip
FreeBSD-src-15f29409bafcde8687bea33781ffe84ebc47e35a.tar.gz
Introduce a typedef for variable value modifation functions and use it
where appropriate. Submitted by: Max Okumoto <okumoto@ucsd.edu>
-rw-r--r--usr.bin/make/var.c6
-rw-r--r--usr.bin/make/var.h20
2 files changed, 12 insertions, 14 deletions
diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c
index ad322b2..e1b1b71 100644
--- a/usr.bin/make/var.c
+++ b/usr.bin/make/var.c
@@ -139,9 +139,6 @@ GNode *VAR_CMD; /* variables defined on the command-line */
static void VarDelete(void *);
static char *VarGetPattern(GNode *, int, char **, int, int *, size_t *,
VarPattern *);
-static char *VarModify(char *,
- Boolean (*)(const char *, Boolean, Buffer *, void *),
- void *);
static int VarPrintVar(void *, void *);
/*-
@@ -584,8 +581,7 @@ Var_Value(const char *name, GNode *ctxt, char **frp)
*-----------------------------------------------------------------------
*/
static char *
-VarModify(char *str, Boolean (*modProc)(const char *, Boolean, Buffer *, void *),
- void *datum)
+VarModify(char *str, VarModifyProc *modProc, void *datum)
{
Buffer *buf; /* Buffer for the new string */
Boolean addSpace; /* TRUE if need to add a space to the
diff --git a/usr.bin/make/var.h b/usr.bin/make/var.h
index b2832cc..bdffd5d 100644
--- a/usr.bin/make/var.h
+++ b/usr.bin/make/var.h
@@ -89,6 +89,8 @@ typedef struct {
int flags;
} VarREPattern;
+typedef Boolean VarModifyProc(const char *, Boolean, struct Buffer *, void *);
+
/*
* var.c
*/
@@ -97,17 +99,17 @@ void VarREError(int, regex_t *, const char *);
/*
* var_modify.c
*/
-Boolean VarHead(const char *, Boolean, struct Buffer *, void *);
-Boolean VarTail(const char *, Boolean, struct Buffer *, void *);
-Boolean VarSuffix(const char *, Boolean, struct Buffer *, void *);
-Boolean VarRoot(const char *, Boolean, struct Buffer *, void *);
-Boolean VarMatch(const char *, Boolean, struct Buffer *, void *);
+VarModifyProc VarHead;
+VarModifyProc VarTail;
+VarModifyProc VarSuffix;
+VarModifyProc VarRoot;
+VarModifyProc VarMatch;
#ifdef SYSVVARSUB
-Boolean VarSYSVMatch(const char *, Boolean, struct Buffer *, void *);
+VarModifyProc VarSYSVMatch;
#endif
-Boolean VarNoMatch(const char *, Boolean, struct Buffer *, void *);
-Boolean VarRESubstitute(const char *, Boolean, struct Buffer *, void *);
-Boolean VarSubstitute(const char *, Boolean, struct Buffer *, void *);
+VarModifyProc VarNoMatch;
+VarModifyProc VarRESubstitute;
+VarModifyProc VarSubstitute;
void Var_Delete(const char *, struct GNode *);
void Var_Set(const char *, const char *, struct GNode *);
OpenPOWER on IntegriCloud