summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2005-05-24 15:58:35 +0000
committerharti <harti@FreeBSD.org>2005-05-24 15:58:35 +0000
commit79613308dce9cef12aa10cea972360bae9c444f3 (patch)
tree0da9d886dad87a41f07234fde57509940807459f
parent910dc606b98c3d428364a2e4a51431f0cc14bcce (diff)
downloadFreeBSD-src-79613308dce9cef12aa10cea972360bae9c444f3.zip
FreeBSD-src-79613308dce9cef12aa10cea972360bae9c444f3.tar.gz
Get rid of the third argument to Var_Value() the pointer it pointed
to has always been set to NULL for some time now. Obtained from: DragonFlyBSD
-rw-r--r--usr.bin/make/arch.c14
-rw-r--r--usr.bin/make/cond.c4
-rw-r--r--usr.bin/make/job.c22
-rw-r--r--usr.bin/make/main.c5
-rw-r--r--usr.bin/make/make.c16
-rw-r--r--usr.bin/make/suff.c7
-rw-r--r--usr.bin/make/var.c21
-rw-r--r--usr.bin/make/var.h2
8 files changed, 26 insertions, 65 deletions
diff --git a/usr.bin/make/arch.c b/usr.bin/make/arch.c
index 716c1d8..2b81c7f 100644
--- a/usr.bin/make/arch.c
+++ b/usr.bin/make/arch.c
@@ -993,12 +993,9 @@ void
Arch_Touch(GNode *gn)
{
struct arfile *ar;
- char *p1, *p2;
- ar = ArchFindMember(Var_Value(ARCHIVE, gn, &p1),
- Var_Value(TARGET, gn, &p2), "r+");
- free(p1);
- free(p2);
+ ar = ArchFindMember(Var_Value(ARCHIVE, gn),
+ Var_Value(TARGET, gn), "r+");
if (ar != NULL) {
ArchArchiveTouch(ar, (int64_t)now);
@@ -1057,12 +1054,9 @@ int
Arch_MTime(GNode *gn)
{
int64_t mtime;
- char *p1, *p2;
- mtime = ArchStatMember(Var_Value(ARCHIVE, gn, &p1),
- Var_Value(TARGET, gn, &p2), TRUE);
- free(p1);
- free(p2);
+ mtime = ArchStatMember(Var_Value(ARCHIVE, gn),
+ Var_Value(TARGET, gn), TRUE);
if (mtime == INT_MIN) {
mtime = 0;
diff --git a/usr.bin/make/cond.c b/usr.bin/make/cond.c
index bed2c57..1066ae4 100644
--- a/usr.bin/make/cond.c
+++ b/usr.bin/make/cond.c
@@ -283,16 +283,14 @@ static Boolean
CondDoDefined(int argLen, char *arg)
{
char savec = arg[argLen];
- char *p1;
Boolean result;
arg[argLen] = '\0';
- if (Var_Value(arg, VAR_CMD, &p1) != NULL) {
+ if (Var_Value(arg, VAR_CMD) != NULL) {
result = TRUE;
} else {
result = FALSE;
}
- free(p1);
arg[argLen] = savec;
return (result);
}
diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c
index 71e4136..ba877c4 100644
--- a/usr.bin/make/job.c
+++ b/usr.bin/make/job.c
@@ -1236,7 +1236,6 @@ Job_CheckCommands(GNode *gn, void (*abortProc)(const char *, ...))
* commands.
*/
if (DEFAULT != NULL && !Lst_IsEmpty(&DEFAULT->commands)) {
- char *p1;
/*
* Make only looks for a .DEFAULT if the node was
* never the target of an operator, so that's what we
@@ -1248,8 +1247,7 @@ Job_CheckCommands(GNode *gn, void (*abortProc)(const char *, ...))
* .DEFAULT itself.
*/
Make_HandleUse(DEFAULT, gn);
- Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), gn);
- free(p1);
+ Var_Set(IMPSRC, Var_Value(TARGET, gn), gn);
} else if (Dir_MTime(gn) == 0) {
/*
@@ -2788,13 +2786,11 @@ CompatInterrupt(int signo)
interrupted = 0;
if (curTarg != NULL && !Targ_Precious(curTarg)) {
- char *p1;
- char *file = Var_Value(TARGET, curTarg, &p1);
+ char *file = Var_Value(TARGET, curTarg);
if (!noExecute && eunlink(file) != -1) {
printf("*** %s removed\n", file);
}
- free(p1);
}
/*
@@ -3109,9 +3105,7 @@ CompatMake(GNode *gn, GNode *pgn)
}
if (Lst_Member(&gn->iParents, pgn) != NULL) {
- char *p1;
- Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn);
- free(p1);
+ Var_Set(IMPSRC, Var_Value(TARGET, gn), pgn);
}
/*
@@ -3254,11 +3248,7 @@ CompatMake(GNode *gn, GNode *pgn)
pgn->make = FALSE;
} else {
- char *p1;
-
- printf("\n\nStop in %s.\n",
- Var_Value(".CURDIR", gn, &p1));
- free(p1);
+ printf("\n\nStop in %s.\n", Var_Value(".CURDIR", gn));
exit(1);
}
} else if (gn->made == ERROR) {
@@ -3269,9 +3259,7 @@ CompatMake(GNode *gn, GNode *pgn)
pgn->make = FALSE;
} else {
if (Lst_Member(&gn->iParents, pgn) != NULL) {
- char *p1;
- Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn);
- free(p1);
+ Var_Set(IMPSRC, Var_Value(TARGET, gn), pgn);
}
switch(gn->made) {
case BEINGMADE:
diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c
index f2eb77c..70b8484 100644
--- a/usr.bin/make/main.c
+++ b/usr.bin/make/main.c
@@ -663,7 +663,7 @@ main(int argc, char **argv)
const char *machine_arch;
const char *machine_cpu;
Boolean outOfDate = TRUE; /* FALSE if all targets up to date */
- char *p, *p1;
+ char *p;
const char *pathp;
const char *path;
char mdpath[MAXPATHLEN];
@@ -973,9 +973,8 @@ main(int argc, char **argv)
ReadMakefile(".depend");
/* Install all the flags into the MAKE envariable. */
- if (((p = Var_Value(".MAKEFLAGS", VAR_GLOBAL, &p1)) != NULL) && *p)
+ if (((p = Var_Value(".MAKEFLAGS", VAR_GLOBAL)) != NULL) && *p)
setenv("MAKEFLAGS", p, 1);
- free(p1);
/*
* For compatibility, look at the directories in the VPATH variable
diff --git a/usr.bin/make/make.c b/usr.bin/make/make.c
index 5402db6..8a460f1 100644
--- a/usr.bin/make/make.c
+++ b/usr.bin/make/make.c
@@ -341,12 +341,9 @@ Make_Update(GNode *cgn)
GNode *pgn; /* the parent node */
char *cname; /* the child's name */
LstNode *ln; /* Element in parents and iParents lists */
- char *p1;
- char *ptr;
char *cpref;
- cname = Var_Value(TARGET, cgn, &p1);
- free(p1);
+ cname = Var_Value(TARGET, cgn);
/*
* If the child was actually made, see what its modification time is
@@ -464,7 +461,7 @@ Make_Update(GNode *cgn)
* Set the .PREFIX and .IMPSRC variables for all the implied parents
* of this node.
*/
- cpref = Var_Value(PREFIX, cgn, &ptr);
+ cpref = Var_Value(PREFIX, cgn);
for (ln = Lst_First(&cgn->iParents); ln != NULL; ln = Lst_Succ(ln)) {
pgn = Lst_Datum(ln);
if (pgn->make) {
@@ -472,7 +469,6 @@ Make_Update(GNode *cgn)
Var_Set(PREFIX, cpref, pgn);
}
}
- free(ptr);
}
/**
@@ -498,7 +494,6 @@ Make_DoAllVar(GNode *gn)
LstNode *ln;
GNode *cgn;
char *child;
- char *p1;
LST_FOREACH(ln, &gn->children) {
/*
@@ -517,7 +512,6 @@ Make_DoAllVar(GNode *gn)
cgn = Lst_Datum(ln);
if ((cgn->type & (OP_EXEC | OP_USE | OP_INVISIBLE)) == 0) {
- p1 = NULL;
if (OP_NOP(cgn->type)) {
/*
* this node is only source; use the specific
@@ -525,7 +519,7 @@ Make_DoAllVar(GNode *gn)
*/
child = cgn->path ? cgn->path : cgn->name;
} else
- child = Var_Value(TARGET, cgn, &p1);
+ child = Var_Value(TARGET, cgn);
Var_Append(ALLSRC, child, gn);
if (gn->type & OP_JOIN) {
if (cgn->made == MADE) {
@@ -554,7 +548,6 @@ Make_DoAllVar(GNode *gn)
*/
Var_Append(OODATE, child, gn);
}
- free(p1);
}
}
@@ -566,8 +559,7 @@ Make_DoAllVar(GNode *gn)
}
if (gn->type & OP_JOIN) {
- Var_Set(TARGET, Var_Value(ALLSRC, gn, &p1), gn);
- free(p1);
+ Var_Set(TARGET, Var_Value(ALLSRC, gn), gn);
}
}
diff --git a/usr.bin/make/suff.c b/usr.bin/make/suff.c
index 6b75493..7aa96f6 100644
--- a/usr.bin/make/suff.c
+++ b/usr.bin/make/suff.c
@@ -1504,7 +1504,6 @@ SuffFindArchiveDeps(GNode *gn, Lst *slst)
char *eoarch; /* End of archive portion */
char *eoname; /* End of member portion */
char *name; /* Start of member's name */
- char *p1;
GNode *mem; /* Node for member */
Suff *ms; /* Suffix descriptor for member */
@@ -1547,10 +1546,8 @@ SuffFindArchiveDeps(GNode *gn, Lst *slst)
/*
* Copy in the variables from the member node to this one.
*/
- Var_Set(copy[1], Var_Value(copy[1], mem, &p1), gn);
- free(p1);
- Var_Set(copy[0], Var_Value(copy[0], mem, &p1), gn);
- free(p1);
+ Var_Set(copy[1], Var_Value(copy[1], mem), gn);
+ Var_Set(copy[0], Var_Value(copy[0], mem), gn);
ms = mem->suffix;
if (ms == NULL) {
diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c
index cb40a49..9300770 100644
--- a/usr.bin/make/var.c
+++ b/usr.bin/make/var.c
@@ -1142,26 +1142,22 @@ Var_Exists(const char *name, GNode *ctxt)
* Return the value of the named variable in the given context
*
* Results:
- * The value if the variable exists, NULL if it doesn't
+ * The value if the variable exists, NULL if it doesn't.
*/
char *
-Var_Value(const char *name, GNode *ctxt, char **frp)
+Var_Value(const char name[], GNode *ctxt)
{
Var *v;
char *n;
- char *p;
n = VarPossiblyExpand(name, ctxt);
v = VarFindAny(n, ctxt);
+ free(n);
if (v == NULL) {
- p = NULL;
- *frp = NULL;
+ return (NULL);
} else {
- p = Buf_Data(v->val);
- *frp = NULL;
+ return (Buf_Data(v->val));
}
- free(n);
- return (p);
}
/**
@@ -2558,17 +2554,14 @@ Var_Print(Lst *vlist, Boolean expandVars)
v = emalloc(strlen(name) + 1 + 3);
sprintf(v, "${%s}", name);
- value = Buf_Peel(Var_Subst(v,
- VAR_GLOBAL, FALSE));
+ value = Buf_Peel(Var_Subst(v, VAR_GLOBAL, FALSE));
printf("%s\n", value);
free(v);
free(value);
} else {
- value = Var_Value(name, VAR_GLOBAL, &v);
+ value = Var_Value(name, VAR_GLOBAL);
printf("%s\n", value != NULL ? value : "");
- if (v != NULL)
- free(v);
}
}
}
diff --git a/usr.bin/make/var.h b/usr.bin/make/var.h
index bd65ce6..8b436dd 100644
--- a/usr.bin/make/var.h
+++ b/usr.bin/make/var.h
@@ -80,6 +80,6 @@ void Var_SetGlobal(const char *, const char *);
void Var_SetEnv(const char *, struct GNode *);
struct Buffer *Var_Subst(const char *, struct GNode *, Boolean);
struct Buffer *Var_SubstOnly(const char *, const char *, Boolean);
-char *Var_Value(const char *, struct GNode *, char **);
+char *Var_Value(const char *, struct GNode *);
#endif /* var_h_9cccafce */
OpenPOWER on IntegriCloud