diff options
author | harti <harti@FreeBSD.org> | 2005-03-10 15:38:01 +0000 |
---|---|---|
committer | harti <harti@FreeBSD.org> | 2005-03-10 15:38:01 +0000 |
commit | 751b56b1640c3c71f79b457e827617e01fbf775a (patch) | |
tree | 4990e374fd80966a747f37fb9a6ed20407f1d097 | |
parent | e98f139ac2d2edfb3832c2f571b7afe71eba04de (diff) | |
download | FreeBSD-src-751b56b1640c3c71f79b457e827617e01fbf775a.zip FreeBSD-src-751b56b1640c3c71f79b457e827617e01fbf775a.tar.gz |
Constify Var_Dump and simplify it by inlining VarPrintVar.
-rw-r--r-- | usr.bin/make/var.c | 22 | ||||
-rw-r--r-- | usr.bin/make/var.h | 2 |
2 files changed, 9 insertions, 15 deletions
diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c index 7014c5a..2e82e92 100644 --- a/usr.bin/make/var.c +++ b/usr.bin/make/var.c @@ -142,8 +142,6 @@ GNode *VAR_CMD; /* variables defined on the command-line */ #define OPEN_BRACE '{' #define CLOSE_BRACE '}' -static int VarPrintVar(void *, void *); - /* * Create a Var object. * @@ -2098,16 +2096,6 @@ Var_Init(void) VAR_CMD = Targ_NewGN("Command"); } -/****************** PRINT DEBUGGING INFO *****************/ -static int -VarPrintVar(void *vp, void *dummy __unused) -{ - Var *v = (Var *) vp; - - printf("%-16s = %s\n", v->name, (char *)Buf_GetAll(v->val, (size_t *)NULL)); - return (0); -} - /*- *----------------------------------------------------------------------- * Var_Dump -- @@ -2115,8 +2103,14 @@ VarPrintVar(void *vp, void *dummy __unused) *----------------------------------------------------------------------- */ void -Var_Dump(GNode *ctxt) +Var_Dump(const GNode *ctxt) { + const LstNode *ln; + const Var *v; - Lst_ForEach(&ctxt->context, VarPrintVar, (void *)NULL); + LST_FOREACH(ln, &ctxt->context) { + v = Lst_Datum(ln); + printf("%-16s = %s\n", v->name, + (const char *)Buf_GetAll(v->val, NULL)); + } } diff --git a/usr.bin/make/var.h b/usr.bin/make/var.h index fe59e9c..c1a0fb6 100644 --- a/usr.bin/make/var.h +++ b/usr.bin/make/var.h @@ -122,6 +122,6 @@ struct Buffer *Var_Subst(const char *, const char *, struct GNode *, Boolean); char *Var_GetTail(char *); char *Var_GetHead(char *); void Var_Init(void); -void Var_Dump(struct GNode *); +void Var_Dump(const struct GNode *); #endif /* var_h_9cccafce */ |