summaryrefslogtreecommitdiffstats
path: root/usr.bin/make/targ.c
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2004-12-01 10:29:20 +0000
committerharti <harti@FreeBSD.org>2004-12-01 10:29:20 +0000
commitcf2c3cae344e2c0fd2316b579a8e3698105b58d1 (patch)
treed8d62254033c89332ede3fdf3277528114f7a6b5 /usr.bin/make/targ.c
parenta50f0bcbfd79a523bed7c5e00964a797edad9ff7 (diff)
downloadFreeBSD-src-cf2c3cae344e2c0fd2316b579a8e3698105b58d1.zip
FreeBSD-src-cf2c3cae344e2c0fd2316b579a8e3698105b58d1.tar.gz
Style: remove a lot of unnecessary casts, add some and spell the null
pointer constant as NULL. Checked by: diff -r on the object files before and after
Diffstat (limited to 'usr.bin/make/targ.c')
-rw-r--r--usr.bin/make/targ.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/usr.bin/make/targ.c b/usr.bin/make/targ.c
index cddf34a6..725bf44 100644
--- a/usr.bin/make/targ.c
+++ b/usr.bin/make/targ.c
@@ -159,9 +159,9 @@ Targ_NewGN(char *name)
{
GNode *gn;
- gn = (GNode *)emalloc(sizeof(GNode));
+ gn = emalloc(sizeof(GNode));
gn->name = estrdup(name);
- gn->path = (char *)0;
+ gn->path = NULL;
if (name[0] == '-' && name[1] == 'l') {
gn->type = OP_LIB;
} else {
@@ -205,7 +205,7 @@ Targ_NewGN(char *name)
static void
TargFreeGN(void *gnp)
{
- GNode *gn = (GNode *) gnp;
+ GNode *gn = gnp;
free(gn->name);
free(gn->path);
@@ -221,7 +221,6 @@ TargFreeGN(void *gnp)
free(gn);
}
-
/*-
*-----------------------------------------------------------------------
* Targ_FindNode --
@@ -249,16 +248,16 @@ Targ_FindNode(char *name, int flags)
if (isNew) {
gn = Targ_NewGN(name);
Hash_SetValue (he, gn);
- Lst_AtEnd(allTargets, (void *)gn);
+ Lst_AtEnd(allTargets, gn);
}
} else {
he = Hash_FindEntry(&targets, name);
}
- if (he == (Hash_Entry *) NULL) {
+ if (he == NULL) {
return (NULL);
} else {
- return ((GNode *)Hash_GetValue(he));
+ return (Hash_GetValue(he));
}
}
@@ -291,7 +290,7 @@ Targ_FindList(Lst names, int flags)
return (nodes);
}
while ((ln = Lst_Next(names)) != NULL) {
- name = (char *)Lst_Datum(ln);
+ name = Lst_Datum(ln);
gn = Targ_FindNode(name, flags);
if (gn != NULL) {
/*
@@ -299,7 +298,7 @@ Targ_FindList(Lst names, int flags)
* are added to the list in the order in which they were
* encountered in the makefile.
*/
- Lst_AtEnd(nodes, (void *)gn);
+ Lst_AtEnd(nodes, gn);
if (gn->type & OP_DOUBLEDEP) {
Lst_Concat(nodes, gn->cohorts, LST_CONCNEW);
}
@@ -513,7 +512,7 @@ Targ_PrintType(int type)
static int
TargPrintNode(void *gnp, void *passp)
{
- GNode *gn = (GNode *)gnp;
+ GNode *gn = gnp;
int pass = *(int *)passp;
if (!OP_NOP(gn->type)) {
@@ -527,7 +526,7 @@ TargPrintNode(void *gnp, void *passp)
} else {
printf("# No unmade children\n");
}
- if (! (gn->type & (OP_JOIN|OP_USE|OP_EXEC))) {
+ if (!(gn->type & (OP_JOIN | OP_USE | OP_EXEC))) {
if (gn->mtime != 0) {
printf("# last modified %s: %s\n",
Targ_FmtTime(gn->mtime),
@@ -547,13 +546,13 @@ TargPrintNode(void *gnp, void *passp)
}
if (!Lst_IsEmpty (gn->iParents)) {
printf("# implicit parents: ");
- Lst_ForEach(gn->iParents, TargPrintName, (void *)0);
+ Lst_ForEach(gn->iParents, TargPrintName, (void *)NULL);
fputc('\n', stdout);
}
}
if (!Lst_IsEmpty (gn->parents)) {
printf("# parents: ");
- Lst_ForEach(gn->parents, TargPrintName, (void *)0);
+ Lst_ForEach(gn->parents, TargPrintName, (void *)NULL);
fputc('\n', stdout);
}
@@ -569,12 +568,12 @@ TargPrintNode(void *gnp, void *passp)
break;
}
Targ_PrintType(gn->type);
- Lst_ForEach(gn->children, TargPrintName, (void *)0);
+ Lst_ForEach(gn->children, TargPrintName, (void *)NULL);
fputc('\n', stdout);
- Lst_ForEach(gn->commands, Targ_PrintCmd, (void *)0);
+ Lst_ForEach(gn->commands, Targ_PrintCmd, (void *)NULL);
printf("\n\n");
if (gn->type & OP_DOUBLEDEP) {
- Lst_ForEach(gn->cohorts, TargPrintNode, (void *)&pass);
+ Lst_ForEach(gn->cohorts, TargPrintNode, &pass);
}
}
return (0);
@@ -596,7 +595,7 @@ TargPrintNode(void *gnp, void *passp)
static int
TargPrintOnlySrc(void *gnp, void *dummy __unused)
{
- GNode *gn = (GNode *)gnp;
+ GNode *gn = gnp;
if (OP_NOP(gn->type))
printf("#\t%s [%s]\n", gn->name, gn->path ? gn->path : gn->name);
@@ -619,11 +618,12 @@ TargPrintOnlySrc(void *gnp, void *dummy __unused)
void
Targ_PrintGraph(int pass)
{
+
printf("#*** Input graph:\n");
- Lst_ForEach(allTargets, TargPrintNode, (void *)&pass);
+ Lst_ForEach(allTargets, TargPrintNode, &pass);
printf("\n\n");
printf("#\n# Files that are only sources:\n");
- Lst_ForEach(allTargets, TargPrintOnlySrc, (void *)0);
+ Lst_ForEach(allTargets, TargPrintOnlySrc, (void *)NULL);
printf("#*** Global Variables:\n");
Var_Dump(VAR_GLOBAL);
printf("#*** Command-line Variables:\n");
OpenPOWER on IntegriCloud