Use NULL instead of -1 cast to the relavant type (usually via NIL).
This was a suggestion from christos - so blame him if there is a deep reason for using -1 :-)
This commit is contained in:
parent
40e0ab7a8f
commit
8a143811b9
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: arch.c,v 1.56 2008/10/06 22:09:21 joerg Exp $ */
|
||||
/* $NetBSD: arch.c,v 1.57 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -69,14 +69,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: arch.c,v 1.56 2008/10/06 22:09:21 joerg Exp $";
|
||||
static char rcsid[] = "$NetBSD: arch.c,v 1.57 2008/12/13 15:19:29 dsl Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)arch.c 8.2 (Berkeley) 1/2/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: arch.c,v 1.56 2008/10/06 22:09:21 joerg Exp $");
|
||||
__RCSID("$NetBSD: arch.c,v 1.57 2008/12/13 15:19:29 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -375,7 +375,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode *ctxt)
|
||||
*/
|
||||
gn = Targ_FindNode(buf, TARG_CREATE);
|
||||
|
||||
if (gn == NILGNODE) {
|
||||
if (gn == NULL) {
|
||||
free(buf);
|
||||
return(FAILURE);
|
||||
} else {
|
||||
@ -410,7 +410,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode *ctxt)
|
||||
snprintf(nameBuf, sz, "%s(%s)", libName, member);
|
||||
free(member);
|
||||
gn = Targ_FindNode(nameBuf, TARG_CREATE);
|
||||
if (gn == NILGNODE) {
|
||||
if (gn == NULL) {
|
||||
free(nameBuf);
|
||||
return (FAILURE);
|
||||
} else {
|
||||
@ -425,7 +425,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode *ctxt)
|
||||
(void)Lst_AtEnd(nodeLst, gn);
|
||||
}
|
||||
}
|
||||
Lst_Destroy(members, NOFREE);
|
||||
Lst_Destroy(members, NULL);
|
||||
free(nameBuf);
|
||||
} else {
|
||||
size_t sz = strlen(libName) + strlen(memName) + 3;
|
||||
@ -433,7 +433,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode *ctxt)
|
||||
snprintf(nameBuf, sz, "%s(%s)", libName, memName);
|
||||
gn = Targ_FindNode(nameBuf, TARG_CREATE);
|
||||
free(nameBuf);
|
||||
if (gn == NILGNODE) {
|
||||
if (gn == NULL) {
|
||||
return (FAILURE);
|
||||
} else {
|
||||
/*
|
||||
@ -548,7 +548,7 @@ ArchStatMember(char *archive, char *member, Boolean hash)
|
||||
}
|
||||
|
||||
ln = Lst_Find(archives, archive, ArchFindArchive);
|
||||
if (ln != NILLNODE) {
|
||||
if (ln != NULL) {
|
||||
ar = (Arch *)Lst_Datum(ln);
|
||||
|
||||
he = Hash_FindEntry(&ar->members, member);
|
||||
@ -567,7 +567,7 @@ ArchStatMember(char *archive, char *member, Boolean hash)
|
||||
}
|
||||
if ((he = Hash_FindEntry(&ar->members, copy)) != NULL)
|
||||
return ((struct ar_hdr *)Hash_GetValue(he));
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -584,7 +584,7 @@ ArchStatMember(char *archive, char *member, Boolean hash)
|
||||
arch = ArchFindMember(archive, member, &sarh, "r");
|
||||
|
||||
if (arch == NULL) {
|
||||
return (NULL);
|
||||
return NULL;
|
||||
} else {
|
||||
fclose(arch);
|
||||
return (&sarh);
|
||||
@ -597,7 +597,7 @@ ArchStatMember(char *archive, char *member, Boolean hash)
|
||||
*/
|
||||
arch = fopen(archive, "r");
|
||||
if (arch == NULL) {
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -607,7 +607,7 @@ ArchStatMember(char *archive, char *member, Boolean hash)
|
||||
if ((fread(magic, SARMAG, 1, arch) != 1) ||
|
||||
(strncmp(magic, ARMAG, SARMAG) != 0)) {
|
||||
fclose(arch);
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ar = bmake_malloc(sizeof(Arch));
|
||||
@ -705,7 +705,7 @@ ArchStatMember(char *archive, char *member, Boolean hash)
|
||||
if (he != NULL) {
|
||||
return ((struct ar_hdr *)Hash_GetValue(he));
|
||||
} else {
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
badarch:
|
||||
@ -714,7 +714,7 @@ badarch:
|
||||
if (ar->fnametab)
|
||||
free(ar->fnametab);
|
||||
free(ar);
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef SVR4ARCHIVES
|
||||
@ -855,7 +855,7 @@ ArchFindMember(char *archive, char *member, struct ar_hdr *arhPtr,
|
||||
|
||||
arch = fopen(archive, mode);
|
||||
if (arch == NULL) {
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -865,7 +865,7 @@ ArchFindMember(char *archive, char *member, struct ar_hdr *arhPtr,
|
||||
if ((fread(magic, SARMAG, 1, arch) != 1) ||
|
||||
(strncmp(magic, ARMAG, SARMAG) != 0)) {
|
||||
fclose(arch);
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -890,7 +890,7 @@ ArchFindMember(char *archive, char *member, struct ar_hdr *arhPtr,
|
||||
* and there's no way we can recover...
|
||||
*/
|
||||
fclose(arch);
|
||||
return (NULL);
|
||||
return NULL;
|
||||
} else if (strncmp(member, arhPtr->ar_name, tlen) == 0) {
|
||||
/*
|
||||
* If the member's name doesn't take up the entire 'name' field,
|
||||
@ -966,7 +966,7 @@ skip:
|
||||
* archive and return NULL -- an error.
|
||||
*/
|
||||
fclose(arch);
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*-
|
||||
@ -1120,7 +1120,7 @@ Arch_MemMTime(GNode *gn)
|
||||
gn->mtime = 0;
|
||||
return (0);
|
||||
}
|
||||
while ((ln = Lst_Next(gn->parents)) != NILLNODE) {
|
||||
while ((ln = Lst_Next(gn->parents)) != NULL) {
|
||||
pgn = (GNode *)Lst_Datum(ln);
|
||||
|
||||
if (pgn->type & OP_ARCHV) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: compat.c,v 1.71 2008/02/15 21:29:50 christos Exp $ */
|
||||
/* $NetBSD: compat.c,v 1.72 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
@ -70,14 +70,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: compat.c,v 1.71 2008/02/15 21:29:50 christos Exp $";
|
||||
static char rcsid[] = "$NetBSD: compat.c,v 1.72 2008/12/13 15:19:29 dsl Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: compat.c,v 1.71 2008/02/15 21:29:50 christos Exp $");
|
||||
__RCSID("$NetBSD: compat.c,v 1.72 2008/12/13 15:19:29 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -119,7 +119,7 @@ __RCSID("$NetBSD: compat.c,v 1.71 2008/02/15 21:29:50 christos Exp $");
|
||||
|
||||
static char meta[256];
|
||||
|
||||
static GNode *curTarg = NILGNODE;
|
||||
static GNode *curTarg = NULL;
|
||||
static GNode *ENDNode;
|
||||
static void CompatInterrupt(int);
|
||||
|
||||
@ -159,7 +159,7 @@ CompatInterrupt(int signo)
|
||||
{
|
||||
GNode *gn;
|
||||
|
||||
if ((curTarg != NILGNODE) && !Targ_Precious (curTarg)) {
|
||||
if ((curTarg != NULL) && !Targ_Precious (curTarg)) {
|
||||
char *p1;
|
||||
char *file = Var_Value(TARGET, curTarg, &p1);
|
||||
|
||||
@ -174,7 +174,7 @@ CompatInterrupt(int signo)
|
||||
*/
|
||||
if (signo == SIGINT) {
|
||||
gn = Targ_FindNode(".INTERRUPT", TARG_NOCREATE);
|
||||
if (gn != NILGNODE) {
|
||||
if (gn != NULL) {
|
||||
Compat_Make(gn, gn);
|
||||
}
|
||||
}
|
||||
@ -483,7 +483,7 @@ Compat_Make(ClientData gnp, ClientData pgnp)
|
||||
goto cohorts;
|
||||
}
|
||||
|
||||
if (Lst_Member(gn->iParents, pgn) != NILLNODE) {
|
||||
if (Lst_Member(gn->iParents, pgn) != NULL) {
|
||||
char *p1;
|
||||
Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn, 0);
|
||||
if (p1)
|
||||
@ -543,7 +543,7 @@ Compat_Make(ClientData gnp, ClientData pgnp)
|
||||
if (!touchFlag || (gn->type & OP_MAKE)) {
|
||||
curTarg = gn;
|
||||
Lst_ForEach(gn->commands, CompatRunCommand, gn);
|
||||
curTarg = NILGNODE;
|
||||
curTarg = NULL;
|
||||
} else {
|
||||
Job_Touch(gn, gn->type & OP_SILENT);
|
||||
}
|
||||
@ -577,7 +577,7 @@ Compat_Make(ClientData gnp, ClientData pgnp)
|
||||
*/
|
||||
pgn->flags &= ~REMAKE;
|
||||
} else {
|
||||
if (Lst_Member(gn->iParents, pgn) != NILLNODE) {
|
||||
if (Lst_Member(gn->iParents, pgn) != NULL) {
|
||||
char *p1;
|
||||
Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn, 0);
|
||||
if (p1)
|
||||
@ -655,7 +655,7 @@ Compat_Run(Lst targs)
|
||||
*/
|
||||
if (!queryFlag) {
|
||||
gn = Targ_FindNode(".BEGIN", TARG_NOCREATE);
|
||||
if (gn != NILGNODE) {
|
||||
if (gn != NULL) {
|
||||
Compat_Make(gn, gn);
|
||||
if (gn->made == ERROR) {
|
||||
PrintOnError("\n\nStop.");
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cond.c,v 1.48 2008/11/29 14:42:21 dsl Exp $ */
|
||||
/* $NetBSD: cond.c,v 1.49 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
@ -70,14 +70,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: cond.c,v 1.48 2008/11/29 14:42:21 dsl Exp $";
|
||||
static char rcsid[] = "$NetBSD: cond.c,v 1.49 2008/12/13 15:19:29 dsl Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)cond.c 8.2 (Berkeley) 1/2/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: cond.c,v 1.48 2008/11/29 14:42:21 dsl Exp $");
|
||||
__RCSID("$NetBSD: cond.c,v 1.49 2008/12/13 15:19:29 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -377,7 +377,7 @@ CondDoMake(int argLen, char *arg)
|
||||
Boolean result;
|
||||
|
||||
arg[argLen] = '\0';
|
||||
if (Lst_Find(create, arg, CondStrMatch) == NILLNODE) {
|
||||
if (Lst_Find(create, arg, CondStrMatch) == NULL) {
|
||||
result = FALSE;
|
||||
} else {
|
||||
result = TRUE;
|
||||
@ -444,7 +444,7 @@ CondDoTarget(int argLen, char *arg)
|
||||
|
||||
arg[argLen] = '\0';
|
||||
gn = Targ_FindNode(arg, TARG_NOCREATE);
|
||||
if ((gn != NILGNODE) && !OP_NOP(gn->type)) {
|
||||
if ((gn != NULL) && !OP_NOP(gn->type)) {
|
||||
result = TRUE;
|
||||
} else {
|
||||
result = FALSE;
|
||||
@ -477,7 +477,7 @@ CondDoCommands(int argLen, char *arg)
|
||||
|
||||
arg[argLen] = '\0';
|
||||
gn = Targ_FindNode(arg, TARG_NOCREATE);
|
||||
if ((gn != NILGNODE) && !OP_NOP(gn->type) && !Lst_IsEmpty(gn->commands)) {
|
||||
if ((gn != NULL) && !OP_NOP(gn->type) && !Lst_IsEmpty(gn->commands)) {
|
||||
result = TRUE;
|
||||
} else {
|
||||
result = FALSE;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dir.c,v 1.56 2008/10/06 22:09:21 joerg Exp $ */
|
||||
/* $NetBSD: dir.c,v 1.57 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
@ -70,14 +70,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: dir.c,v 1.56 2008/10/06 22:09:21 joerg Exp $";
|
||||
static char rcsid[] = "$NetBSD: dir.c,v 1.57 2008/12/13 15:19:29 dsl Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: dir.c,v 1.56 2008/10/06 22:09:21 joerg Exp $");
|
||||
__RCSID("$NetBSD: dir.c,v 1.57 2008/12/13 15:19:29 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -373,9 +373,9 @@ Dir_End(void)
|
||||
Dir_Destroy(dotLast);
|
||||
Dir_Destroy(dot);
|
||||
Dir_ClearPath(dirSearchPath);
|
||||
Lst_Destroy(dirSearchPath, NOFREE);
|
||||
Lst_Destroy(dirSearchPath, NULL);
|
||||
Dir_ClearPath(openDirectories);
|
||||
Lst_Destroy(openDirectories, NOFREE);
|
||||
Lst_Destroy(openDirectories, NULL);
|
||||
Hash_DeleteTable(&mtimes);
|
||||
#endif
|
||||
}
|
||||
@ -395,7 +395,7 @@ Dir_SetPATH(void)
|
||||
Var_Delete(".PATH", VAR_GLOBAL);
|
||||
|
||||
if (Lst_Open(dirSearchPath) == SUCCESS) {
|
||||
if ((ln = Lst_First(dirSearchPath)) != NILLNODE) {
|
||||
if ((ln = Lst_First(dirSearchPath)) != NULL) {
|
||||
p = (Path *)Lst_Datum(ln);
|
||||
if (p == dotLast) {
|
||||
hasLastDot = TRUE;
|
||||
@ -410,7 +410,7 @@ Dir_SetPATH(void)
|
||||
Var_Append(".PATH", cur->name, VAR_GLOBAL);
|
||||
}
|
||||
|
||||
while ((ln = Lst_Next(dirSearchPath)) != NILLNODE) {
|
||||
while ((ln = Lst_Next(dirSearchPath)) != NULL) {
|
||||
p = (Path *)Lst_Datum(ln);
|
||||
if (p == dotLast)
|
||||
continue;
|
||||
@ -701,7 +701,7 @@ DirExpandInt(const char *word, Lst path, Lst expansions)
|
||||
Path *p; /* Directory in the node */
|
||||
|
||||
if (Lst_Open(path) == SUCCESS) {
|
||||
while ((ln = Lst_Next(path)) != NILLNODE) {
|
||||
while ((ln = Lst_Next(path)) != NULL) {
|
||||
p = (Path *)Lst_Datum(ln);
|
||||
DirMatchFiles(word, p, expansions);
|
||||
}
|
||||
@ -814,7 +814,7 @@ Dir_Expand(const char *word, Lst path, Lst expansions)
|
||||
path = Lst_Init(FALSE);
|
||||
(void)Dir_AddDir(path, dirpath);
|
||||
DirExpandInt(cp+1, path, expansions);
|
||||
Lst_Destroy(path, NOFREE);
|
||||
Lst_Destroy(path, NULL);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
@ -1082,10 +1082,10 @@ Dir_FindFile(const char *name, Lst path)
|
||||
fprintf(debug_file, "couldn't open path, file not found\n");
|
||||
}
|
||||
misses += 1;
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((ln = Lst_First(path)) != NILLNODE) {
|
||||
if ((ln = Lst_First(path)) != NULL) {
|
||||
p = (Path *)Lst_Datum(ln);
|
||||
if (p == dotLast) {
|
||||
hasLastDot = TRUE;
|
||||
@ -1123,7 +1123,7 @@ Dir_FindFile(const char *name, Lst path)
|
||||
return file;
|
||||
}
|
||||
|
||||
while ((ln = Lst_Next(path)) != NILLNODE) {
|
||||
while ((ln = Lst_Next(path)) != NULL) {
|
||||
p = (Path *)Lst_Datum(ln);
|
||||
if (p == dotLast)
|
||||
continue;
|
||||
@ -1160,7 +1160,7 @@ Dir_FindFile(const char *name, Lst path)
|
||||
fprintf(debug_file, " failed.\n");
|
||||
}
|
||||
misses += 1;
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (name[0] != '/') {
|
||||
@ -1181,7 +1181,7 @@ Dir_FindFile(const char *name, Lst path)
|
||||
}
|
||||
|
||||
(void)Lst_Open(path);
|
||||
while ((ln = Lst_Next(path)) != NILLNODE) {
|
||||
while ((ln = Lst_Next(path)) != NULL) {
|
||||
p = (Path *)Lst_Datum(ln);
|
||||
if (p == dotLast)
|
||||
continue;
|
||||
@ -1215,7 +1215,7 @@ Dir_FindFile(const char *name, Lst path)
|
||||
if (DEBUG(DIR)) {
|
||||
fprintf(debug_file, " Checked . already, returning NULL\n");
|
||||
}
|
||||
return(NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
} else { /* name[0] == '/' */
|
||||
@ -1237,7 +1237,7 @@ Dir_FindFile(const char *name, Lst path)
|
||||
return *file?file:NULL;
|
||||
|
||||
(void)Lst_Open(path);
|
||||
while ((ln = Lst_Next(path)) != NILLNODE) {
|
||||
while ((ln = Lst_Next(path)) != NULL) {
|
||||
p = (Path *)Lst_Datum(ln);
|
||||
if (p == dotLast)
|
||||
continue;
|
||||
@ -1276,8 +1276,8 @@ Dir_FindFile(const char *name, Lst path)
|
||||
|
||||
bigmisses += 1;
|
||||
ln = Lst_Last(path);
|
||||
if (ln == NILLNODE) {
|
||||
return (NULL);
|
||||
if (ln == NULL) {
|
||||
return NULL;
|
||||
} else {
|
||||
p = (Path *)Lst_Datum(ln);
|
||||
}
|
||||
@ -1285,7 +1285,7 @@ Dir_FindFile(const char *name, Lst path)
|
||||
if (Hash_FindEntry(&p->files, cp) != NULL) {
|
||||
return (bmake_strdup(name));
|
||||
} else {
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
#else /* !notdef */
|
||||
if (DEBUG(DIR)) {
|
||||
@ -1311,7 +1311,7 @@ Dir_FindFile(const char *name, Lst path)
|
||||
if (DEBUG(DIR)) {
|
||||
fprintf(debug_file, " failed. Returning NULL\n");
|
||||
}
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
#endif /* notdef */
|
||||
}
|
||||
@ -1495,14 +1495,14 @@ Dir_MTime(GNode *gn)
|
||||
Path *
|
||||
Dir_AddDir(Lst path, const char *name)
|
||||
{
|
||||
LstNode ln = NILLNODE; /* node in case Path structure is found */
|
||||
LstNode ln = NULL; /* node in case Path structure is found */
|
||||
Path *p = NULL; /* pointer to new Path structure */
|
||||
DIR *d; /* for reading directory */
|
||||
struct dirent *dp; /* entry in directory */
|
||||
|
||||
if (strcmp(name, ".DOTLAST") == 0) {
|
||||
ln = Lst_Find(path, UNCONST(name), DirFindName);
|
||||
if (ln != NILLNODE)
|
||||
if (ln != NULL)
|
||||
return (Path *)Lst_Datum(ln);
|
||||
else {
|
||||
dotLast->refCount += 1;
|
||||
@ -1512,9 +1512,9 @@ Dir_AddDir(Lst path, const char *name)
|
||||
|
||||
if (path)
|
||||
ln = Lst_Find(openDirectories, UNCONST(name), DirFindName);
|
||||
if (ln != NILLNODE) {
|
||||
if (ln != NULL) {
|
||||
p = (Path *)Lst_Datum(ln);
|
||||
if (path && Lst_Member(path, p) == NILLNODE) {
|
||||
if (path && Lst_Member(path, p) == NULL) {
|
||||
p->refCount += 1;
|
||||
(void)Lst_AtEnd(path, p);
|
||||
}
|
||||
@ -1609,7 +1609,7 @@ Dir_MakeFlags(const char *flag, Lst path)
|
||||
str = bmake_strdup("");
|
||||
|
||||
if (Lst_Open(path) == SUCCESS) {
|
||||
while ((ln = Lst_Next(path)) != NILLNODE) {
|
||||
while ((ln = Lst_Next(path)) != NULL) {
|
||||
p = (Path *)Lst_Datum(ln);
|
||||
s2 = str_concat(flag, p->name, 0);
|
||||
str = str_concat(s1 = str, s2, STR_ADDSPACE);
|
||||
@ -1710,9 +1710,9 @@ Dir_Concat(Lst path1, Lst path2)
|
||||
LstNode ln;
|
||||
Path *p;
|
||||
|
||||
for (ln = Lst_First(path2); ln != NILLNODE; ln = Lst_Succ(ln)) {
|
||||
for (ln = Lst_First(path2); ln != NULL; ln = Lst_Succ(ln)) {
|
||||
p = (Path *)Lst_Datum(ln);
|
||||
if (Lst_Member(path1, p) == NILLNODE) {
|
||||
if (Lst_Member(path1, p) == NULL) {
|
||||
p->refCount += 1;
|
||||
(void)Lst_AtEnd(path1, p);
|
||||
}
|
||||
@ -1733,7 +1733,7 @@ Dir_PrintDirectories(void)
|
||||
hits * 100 / (hits + bigmisses + nearmisses) : 0));
|
||||
fprintf(debug_file, "# %-20s referenced\thits\n", "directory");
|
||||
if (Lst_Open(openDirectories) == SUCCESS) {
|
||||
while ((ln = Lst_Next(openDirectories)) != NILLNODE) {
|
||||
while ((ln = Lst_Next(openDirectories)) != NULL) {
|
||||
p = (Path *)Lst_Datum(ln);
|
||||
fprintf(debug_file, "# %-20s %10d\t%4d\n", p->name, p->refCount, p->hits);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: for.c,v 1.35 2008/12/01 21:05:21 dsl Exp $ */
|
||||
/* $NetBSD: for.c,v 1.36 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, The Regents of the University of California.
|
||||
@ -30,14 +30,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: for.c,v 1.35 2008/12/01 21:05:21 dsl Exp $";
|
||||
static char rcsid[] = "$NetBSD: for.c,v 1.36 2008/12/13 15:19:29 dsl Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)for.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: for.c,v 1.35 2008/12/01 21:05:21 dsl Exp $");
|
||||
__RCSID("$NetBSD: for.c,v 1.36 2008/12/13 15:19:29 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -317,7 +317,7 @@ For_Run(int lineno)
|
||||
*/
|
||||
for (i = arg.nvars - 1; i >= 0; i--) {
|
||||
ln = Lst_Next(arg.lst);
|
||||
if (ln == NILLNODE) {
|
||||
if (ln == NULL) {
|
||||
done = 1;
|
||||
break;
|
||||
} else {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: hash.c,v 1.17 2008/10/06 22:09:21 joerg Exp $ */
|
||||
/* $NetBSD: hash.c,v 1.18 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
@ -70,14 +70,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: hash.c,v 1.17 2008/10/06 22:09:21 joerg Exp $";
|
||||
static char rcsid[] = "$NetBSD: hash.c,v 1.18 2008/12/13 15:19:29 dsl Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)hash.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: hash.c,v 1.17 2008/10/06 22:09:21 joerg Exp $");
|
||||
__RCSID("$NetBSD: hash.c,v 1.18 2008/12/13 15:19:29 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -227,7 +227,7 @@ Hash_FindEntry(Hash_Table *t, const char *key)
|
||||
for (e = t->bucketPtr[h & t->mask]; e != NULL; e = e->next)
|
||||
if (e->namehash == h && strcmp(e->name, p) == 0)
|
||||
return (e);
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -411,7 +411,7 @@ Hash_EnumNext(Hash_Search *searchPtr)
|
||||
*/
|
||||
while (e == NULL) {
|
||||
if (searchPtr->nextIndex >= t->size)
|
||||
return (NULL);
|
||||
return NULL;
|
||||
e = t->bucketPtr[searchPtr->nextIndex++];
|
||||
}
|
||||
searchPtr->hashEntryPtr = e;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: job.c,v 1.141 2008/10/29 15:37:08 sjg Exp $ */
|
||||
/* $NetBSD: job.c,v 1.142 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
@ -70,14 +70,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: job.c,v 1.141 2008/10/29 15:37:08 sjg Exp $";
|
||||
static char rcsid[] = "$NetBSD: job.c,v 1.142 2008/12/13 15:19:29 dsl Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: job.c,v 1.141 2008/10/29 15:37:08 sjg Exp $");
|
||||
__RCSID("$NetBSD: job.c,v 1.142 2008/12/13 15:19:29 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -184,7 +184,7 @@ int not_parallel = 0; /* set if .NOT_PARALLEL */
|
||||
* .END target but we keep it around to avoid having to search for it
|
||||
* all the time.
|
||||
*/
|
||||
static GNode *postCommands = NILGNODE;
|
||||
static GNode *postCommands = NULL;
|
||||
/* node containing commands to execute when
|
||||
* everything else is done */
|
||||
static int numCommands; /* The number of commands actually printed
|
||||
@ -1058,7 +1058,7 @@ JobFinish(Job *job, int status)
|
||||
* the parents. In addition, any saved commands for the node are placed
|
||||
* on the .END target.
|
||||
*/
|
||||
if (job->tailCmds != NILLNODE) {
|
||||
if (job->tailCmds != NULL) {
|
||||
Lst_ForEachFrom(job->node->commands, job->tailCmds,
|
||||
JobSaveCommand,
|
||||
job->node);
|
||||
@ -1196,7 +1196,7 @@ Job_CheckCommands(GNode *gn, void (*abortProc)(const char *, ...))
|
||||
* No commands. Look for .DEFAULT rule from which we might infer
|
||||
* commands
|
||||
*/
|
||||
if ((DEFAULT != NILGNODE) && !Lst_IsEmpty(DEFAULT->commands) &&
|
||||
if ((DEFAULT != NULL) && !Lst_IsEmpty(DEFAULT->commands) &&
|
||||
(gn->type & OP_SPECIAL) == 0) {
|
||||
char *p1;
|
||||
/*
|
||||
@ -1505,7 +1505,7 @@ JobStart(GNode *gn, int flags)
|
||||
flags |= JOB_SPECIAL;
|
||||
|
||||
job->node = gn;
|
||||
job->tailCmds = NILLNODE;
|
||||
job->tailCmds = NULL;
|
||||
|
||||
/*
|
||||
* Set the initial value of the flags for this job based on the global
|
||||
@ -1641,7 +1641,7 @@ JobStart(GNode *gn, int flags)
|
||||
* the commands for the job were no good.
|
||||
*/
|
||||
if (cmdsOK && aborting == 0) {
|
||||
if (job->tailCmds != NILLNODE) {
|
||||
if (job->tailCmds != NULL) {
|
||||
Lst_ForEachFrom(job->node->commands, job->tailCmds,
|
||||
JobSaveCommand,
|
||||
job->node);
|
||||
@ -1883,7 +1883,7 @@ JobRun(GNode *targ)
|
||||
Lst lst = Lst_Init(FALSE);
|
||||
Lst_AtEnd(lst, targ);
|
||||
(void)Make_Run(lst);
|
||||
Lst_Destroy(lst, NOFREE);
|
||||
Lst_Destroy(lst, NULL);
|
||||
JobStart(targ, JOB_SPECIAL);
|
||||
while (jobTokensRunning) {
|
||||
Job_CatchOutput();
|
||||
@ -2126,7 +2126,7 @@ Job_Init(void)
|
||||
aborting = 0;
|
||||
errors = 0;
|
||||
|
||||
lastNode = NILGNODE;
|
||||
lastNode = NULL;
|
||||
|
||||
if (maxJobs == 1) {
|
||||
/*
|
||||
@ -2204,7 +2204,7 @@ Job_Init(void)
|
||||
|
||||
begin = Targ_FindNode(".BEGIN", TARG_NOCREATE);
|
||||
|
||||
if (begin != NILGNODE) {
|
||||
if (begin != NULL) {
|
||||
JobRun(begin);
|
||||
if (begin->made == ERROR) {
|
||||
PrintOnError("\n\nStop.");
|
||||
@ -2256,7 +2256,7 @@ JobMatchShell(const char *name)
|
||||
if (strcmp(name, sh->name) == 0)
|
||||
return (sh);
|
||||
}
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*-
|
||||
@ -2505,7 +2505,7 @@ JobInterrupt(int runINTERRUPT, int signo)
|
||||
|
||||
if (runINTERRUPT && !touchFlag) {
|
||||
interrupt = Targ_FindNode(".INTERRUPT", TARG_NOCREATE);
|
||||
if (interrupt != NILGNODE) {
|
||||
if (interrupt != NULL) {
|
||||
ignoreErrors = FALSE;
|
||||
JobRun(interrupt);
|
||||
}
|
||||
@ -2530,7 +2530,7 @@ JobInterrupt(int runINTERRUPT, int signo)
|
||||
int
|
||||
Job_Finish(void)
|
||||
{
|
||||
if (postCommands != NILGNODE &&
|
||||
if (postCommands != NULL &&
|
||||
(!Lst_IsEmpty(postCommands->commands) ||
|
||||
!Lst_IsEmpty(postCommands->children))) {
|
||||
if (errors) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: job.h,v 1.37 2008/02/15 21:29:50 christos Exp $ */
|
||||
/* $NetBSD: job.h,v 1.38 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
@ -118,7 +118,7 @@ emul_poll(struct pollfd *fd, int nfd, int timeout);
|
||||
* 1) The process id of the child shell
|
||||
* 2) The graph node describing the target being made by this job
|
||||
* 3) A LstNode for the first command to be saved after the job
|
||||
* completes. This is NILLNODE if there was no "..." in the job's
|
||||
* completes. This is NULL if there was no "..." in the job's
|
||||
* commands.
|
||||
* 4) An FILE* for writing out the commands. This is only
|
||||
* used before the job is actually started.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lst.h,v 1.15 2006/11/11 21:23:36 dsl Exp $ */
|
||||
/* $NetBSD: lst.h,v 1.16 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
@ -95,17 +95,6 @@ typedef struct ListNode *LstNode;
|
||||
typedef ClientData DuplicateProc(ClientData);
|
||||
typedef void FreeProc(ClientData);
|
||||
|
||||
#define NILLST ((Lst)NIL)
|
||||
#define NILLNODE ((LstNode)NIL)
|
||||
|
||||
/*
|
||||
* NOFREE can be used as the freeProc to Lst_Destroy when the elements are
|
||||
* not to be freed.
|
||||
* NOCOPY performs similarly when given as the copyProc to Lst_Duplicate.
|
||||
*/
|
||||
#define NOFREE ((FreeProc *)NULL)
|
||||
#define NOCOPY ((DuplicateProc *)NULL)
|
||||
|
||||
#define LST_CONCNEW 0 /* create new LstNode's when using Lst_Concat */
|
||||
#define LST_CONCLINK 1 /* relink LstNode's when using Lst_Concat */
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lstAppend.c,v 1.12 2006/10/27 21:37:25 dsl Exp $ */
|
||||
/* $NetBSD: lstAppend.c,v 1.13 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -33,14 +33,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: lstAppend.c,v 1.12 2006/10/27 21:37:25 dsl Exp $";
|
||||
static char rcsid[] = "$NetBSD: lstAppend.c,v 1.13 2008/12/13 15:19:29 dsl Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)lstAppend.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: lstAppend.c,v 1.12 2006/10/27 21:37:25 dsl Exp $");
|
||||
__RCSID("$NetBSD: lstAppend.c,v 1.13 2008/12/13 15:19:29 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -69,7 +69,7 @@ __RCSID("$NetBSD: lstAppend.c,v 1.12 2006/10/27 21:37:25 dsl Exp $");
|
||||
* A new ListNode is created and linked in to the List. The lastPtr
|
||||
* field of the List will be altered if ln is the last node in the
|
||||
* list. lastPtr and firstPtr will alter if the list was empty and
|
||||
* ln was NILLNODE.
|
||||
* ln was NULL.
|
||||
*
|
||||
*-----------------------------------------------------------------------
|
||||
*/
|
||||
@ -80,7 +80,7 @@ Lst_InsertAfter(Lst l, LstNode ln, ClientData d)
|
||||
ListNode lNode;
|
||||
ListNode nLNode;
|
||||
|
||||
if (LstValid (l) && (ln == NILLNODE && LstIsEmpty (l))) {
|
||||
if (LstValid (l) && (ln == NULL && LstIsEmpty (l))) {
|
||||
goto ok;
|
||||
}
|
||||
|
||||
@ -96,11 +96,11 @@ Lst_InsertAfter(Lst l, LstNode ln, ClientData d)
|
||||
nLNode->datum = d;
|
||||
nLNode->useCount = nLNode->flags = 0;
|
||||
|
||||
if (lNode == NilListNode) {
|
||||
if (lNode == NULL) {
|
||||
if (list->isCirc) {
|
||||
nLNode->nextPtr = nLNode->prevPtr = nLNode;
|
||||
} else {
|
||||
nLNode->nextPtr = nLNode->prevPtr = NilListNode;
|
||||
nLNode->nextPtr = nLNode->prevPtr = NULL;
|
||||
}
|
||||
list->firstPtr = list->lastPtr = nLNode;
|
||||
} else {
|
||||
@ -108,7 +108,7 @@ Lst_InsertAfter(Lst l, LstNode ln, ClientData d)
|
||||
nLNode->nextPtr = lNode->nextPtr;
|
||||
|
||||
lNode->nextPtr = nLNode;
|
||||
if (nLNode->nextPtr != NilListNode) {
|
||||
if (nLNode->nextPtr != NULL) {
|
||||
nLNode->nextPtr->prevPtr = nLNode;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lstConcat.c,v 1.15 2006/10/27 21:37:25 dsl Exp $ */
|
||||
/* $NetBSD: lstConcat.c,v 1.16 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -33,14 +33,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: lstConcat.c,v 1.15 2006/10/27 21:37:25 dsl Exp $";
|
||||
static char rcsid[] = "$NetBSD: lstConcat.c,v 1.16 2008/12/13 15:19:29 dsl Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)lstConcat.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: lstConcat.c,v 1.15 2006/10/27 21:37:25 dsl Exp $");
|
||||
__RCSID("$NetBSD: lstConcat.c,v 1.16 2008/12/13 15:19:29 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -90,7 +90,7 @@ Lst_Concat(Lst l1, Lst l2, int flags)
|
||||
}
|
||||
|
||||
if (flags == LST_CONCLINK) {
|
||||
if (list2->firstPtr != NilListNode) {
|
||||
if (list2->firstPtr != NULL) {
|
||||
/*
|
||||
* We set the nextPtr of the
|
||||
* last element of list two to be NIL to make the loop easier and
|
||||
@ -99,7 +99,7 @@ Lst_Concat(Lst l1, Lst l2, int flags)
|
||||
* to NIL space and the first element will be untouched if it
|
||||
* existed before and will also point to NIL space if it didn't.
|
||||
*/
|
||||
list2->lastPtr->nextPtr = NilListNode;
|
||||
list2->lastPtr->nextPtr = NULL;
|
||||
/*
|
||||
* So long as the second list isn't empty, we just link the
|
||||
* first element of the second list to the last element of the
|
||||
@ -109,14 +109,14 @@ Lst_Concat(Lst l1, Lst l2, int flags)
|
||||
* the last element of the first list.
|
||||
*/
|
||||
list2->firstPtr->prevPtr = list1->lastPtr;
|
||||
if (list1->lastPtr != NilListNode) {
|
||||
if (list1->lastPtr != NULL) {
|
||||
list1->lastPtr->nextPtr = list2->firstPtr;
|
||||
} else {
|
||||
list1->firstPtr = list2->firstPtr;
|
||||
}
|
||||
list1->lastPtr = list2->lastPtr;
|
||||
}
|
||||
if (list1->isCirc && list1->firstPtr != NilListNode) {
|
||||
if (list1->isCirc && list1->firstPtr != NULL) {
|
||||
/*
|
||||
* If the first list is supposed to be circular and it is (now)
|
||||
* non-empty, we must make sure it's circular by linking the
|
||||
@ -126,7 +126,7 @@ Lst_Concat(Lst l1, Lst l2, int flags)
|
||||
list1->lastPtr->nextPtr = list1->firstPtr;
|
||||
}
|
||||
free(l2);
|
||||
} else if (list2->firstPtr != NilListNode) {
|
||||
} else if (list2->firstPtr != NULL) {
|
||||
/*
|
||||
* We set the nextPtr of the last element of list 2 to be nil to make
|
||||
* the loop less difficult. The loop simply goes through the entire
|
||||
@ -139,14 +139,14 @@ Lst_Concat(Lst l1, Lst l2, int flags)
|
||||
* the first list must have been empty so the newly-created node is
|
||||
* made the first node of the list.
|
||||
*/
|
||||
list2->lastPtr->nextPtr = NilListNode;
|
||||
list2->lastPtr->nextPtr = NULL;
|
||||
for (last = list1->lastPtr, ln = list2->firstPtr;
|
||||
ln != NilListNode;
|
||||
ln != NULL;
|
||||
ln = ln->nextPtr)
|
||||
{
|
||||
PAlloc (nln, ListNode);
|
||||
nln->datum = ln->datum;
|
||||
if (last != NilListNode) {
|
||||
if (last != NULL) {
|
||||
last->nextPtr = nln;
|
||||
} else {
|
||||
list1->firstPtr = nln;
|
||||
@ -172,7 +172,7 @@ Lst_Concat(Lst l1, Lst l2, int flags)
|
||||
list1->lastPtr->nextPtr = list1->firstPtr;
|
||||
list1->firstPtr->prevPtr = list1->lastPtr;
|
||||
} else {
|
||||
last->nextPtr = NilListNode;
|
||||
last->nextPtr = NULL;
|
||||
}
|
||||
|
||||
if (list2->isCirc) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lstDatum.c,v 1.11 2006/10/27 21:37:25 dsl Exp $ */
|
||||
/* $NetBSD: lstDatum.c,v 1.12 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -33,14 +33,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: lstDatum.c,v 1.11 2006/10/27 21:37:25 dsl Exp $";
|
||||
static char rcsid[] = "$NetBSD: lstDatum.c,v 1.12 2008/12/13 15:19:29 dsl Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)lstDatum.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: lstDatum.c,v 1.11 2006/10/27 21:37:25 dsl Exp $");
|
||||
__RCSID("$NetBSD: lstDatum.c,v 1.12 2008/12/13 15:19:29 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -58,7 +58,7 @@ __RCSID("$NetBSD: lstDatum.c,v 1.11 2006/10/27 21:37:25 dsl Exp $");
|
||||
* Return the datum stored in the given node.
|
||||
*
|
||||
* Results:
|
||||
* The datum or (ick!) NIL if the node is invalid.
|
||||
* The datum or NULL if the node is invalid.
|
||||
*
|
||||
* Side Effects:
|
||||
* None.
|
||||
@ -68,10 +68,10 @@ __RCSID("$NetBSD: lstDatum.c,v 1.11 2006/10/27 21:37:25 dsl Exp $");
|
||||
ClientData
|
||||
Lst_Datum(LstNode ln)
|
||||
{
|
||||
if (ln != NILLNODE) {
|
||||
if (ln != NULL) {
|
||||
return ((ln)->datum);
|
||||
} else {
|
||||
return ((ClientData) NIL);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lstDeQueue.c,v 1.12 2006/10/27 21:37:25 dsl Exp $ */
|
||||
/* $NetBSD: lstDeQueue.c,v 1.13 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -33,14 +33,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: lstDeQueue.c,v 1.12 2006/10/27 21:37:25 dsl Exp $";
|
||||
static char rcsid[] = "$NetBSD: lstDeQueue.c,v 1.13 2008/12/13 15:19:29 dsl Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)lstDeQueue.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: lstDeQueue.c,v 1.12 2006/10/27 21:37:25 dsl Exp $");
|
||||
__RCSID("$NetBSD: lstDeQueue.c,v 1.13 2008/12/13 15:19:29 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -58,7 +58,7 @@ __RCSID("$NetBSD: lstDeQueue.c,v 1.12 2006/10/27 21:37:25 dsl Exp $");
|
||||
* Remove and return the datum at the head of the given list.
|
||||
*
|
||||
* Results:
|
||||
* The datum in the node at the head or (ick) NIL if the list
|
||||
* The datum in the node at the head or NULL if the list
|
||||
* is empty.
|
||||
*
|
||||
* Side Effects:
|
||||
@ -73,13 +73,13 @@ Lst_DeQueue(Lst l)
|
||||
ListNode tln;
|
||||
|
||||
tln = Lst_First(l);
|
||||
if (tln == NilListNode) {
|
||||
return ((ClientData) NIL);
|
||||
if (tln == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rd = tln->datum;
|
||||
if (Lst_Remove(l, tln) == FAILURE) {
|
||||
return ((ClientData) NIL);
|
||||
return NULL;
|
||||
} else {
|
||||
return (rd);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lstDestroy.c,v 1.15 2006/10/27 21:37:25 dsl Exp $ */
|
||||
/* $NetBSD: lstDestroy.c,v 1.16 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -33,14 +33,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: lstDestroy.c,v 1.15 2006/10/27 21:37:25 dsl Exp $";
|
||||
static char rcsid[] = "$NetBSD: lstDestroy.c,v 1.16 2008/12/13 15:19:29 dsl Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)lstDestroy.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: lstDestroy.c,v 1.15 2006/10/27 21:37:25 dsl Exp $");
|
||||
__RCSID("$NetBSD: lstDestroy.c,v 1.16 2008/12/13 15:19:29 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -68,40 +68,34 @@ __RCSID("$NetBSD: lstDestroy.c,v 1.15 2006/10/27 21:37:25 dsl Exp $");
|
||||
*-----------------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
Lst_Destroy(Lst l, FreeProc *freeProc)
|
||||
Lst_Destroy(Lst list, FreeProc *freeProc)
|
||||
{
|
||||
ListNode ln;
|
||||
ListNode tln = NilListNode;
|
||||
List list = l;
|
||||
ListNode tln = NULL;
|
||||
|
||||
if (l == NILLST || ! l) {
|
||||
/*
|
||||
* Note the check for l == (Lst)0 to catch uninitialized static Lst's.
|
||||
* Gross, but useful.
|
||||
*/
|
||||
if (list == NULL)
|
||||
return;
|
||||
}
|
||||
|
||||
/* To ease scanning */
|
||||
if (list->lastPtr != NilListNode)
|
||||
list->lastPtr->nextPtr = NilListNode;
|
||||
if (list->lastPtr != NULL)
|
||||
list->lastPtr->nextPtr = NULL;
|
||||
else {
|
||||
free(l);
|
||||
free(list);
|
||||
return;
|
||||
}
|
||||
|
||||
if (freeProc) {
|
||||
for (ln = list->firstPtr; ln != NilListNode; ln = tln) {
|
||||
for (ln = list->firstPtr; ln != NULL; ln = tln) {
|
||||
tln = ln->nextPtr;
|
||||
freeProc(ln->datum);
|
||||
free(ln);
|
||||
}
|
||||
} else {
|
||||
for (ln = list->firstPtr; ln != NilListNode; ln = tln) {
|
||||
for (ln = list->firstPtr; ln != NULL; ln = tln) {
|
||||
tln = ln->nextPtr;
|
||||
free(ln);
|
||||
}
|
||||
}
|
||||
|
||||
free(l);
|
||||
free(list);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lstDupl.c,v 1.14 2006/10/27 21:37:25 dsl Exp $ */
|
||||
/* $NetBSD: lstDupl.c,v 1.15 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -33,14 +33,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: lstDupl.c,v 1.14 2006/10/27 21:37:25 dsl Exp $";
|
||||
static char rcsid[] = "$NetBSD: lstDupl.c,v 1.15 2008/12/13 15:19:29 dsl Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)lstDupl.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: lstDupl.c,v 1.14 2006/10/27 21:37:25 dsl Exp $");
|
||||
__RCSID("$NetBSD: lstDupl.c,v 1.15 2008/12/13 15:19:29 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -64,7 +64,7 @@ __RCSID("$NetBSD: lstDupl.c,v 1.14 2006/10/27 21:37:25 dsl Exp $");
|
||||
* copyProc A function to duplicate each ClientData
|
||||
*
|
||||
* Results:
|
||||
* The new Lst structure or NILLST if failure.
|
||||
* The new Lst structure or NULL if failure.
|
||||
*
|
||||
* Side Effects:
|
||||
* A new list is created.
|
||||
@ -78,26 +78,26 @@ Lst_Duplicate(Lst l, DuplicateProc *copyProc)
|
||||
List list = l;
|
||||
|
||||
if (!LstValid (l)) {
|
||||
return (NILLST);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
nl = Lst_Init(list->isCirc);
|
||||
if (nl == NILLST) {
|
||||
return (NILLST);
|
||||
if (nl == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ln = list->firstPtr;
|
||||
while (ln != NilListNode) {
|
||||
if (copyProc != NOCOPY) {
|
||||
while (ln != NULL) {
|
||||
if (copyProc != NULL) {
|
||||
if (Lst_AtEnd(nl, copyProc(ln->datum)) == FAILURE) {
|
||||
return (NILLST);
|
||||
return NULL;
|
||||
}
|
||||
} else if (Lst_AtEnd(nl, ln->datum) == FAILURE) {
|
||||
return (NILLST);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (list->isCirc && ln == list->lastPtr) {
|
||||
ln = NilListNode;
|
||||
ln = NULL;
|
||||
} else {
|
||||
ln = ln->nextPtr;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lstFind.c,v 1.12 2005/02/16 15:11:53 christos Exp $ */
|
||||
/* $NetBSD: lstFind.c,v 1.13 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -33,14 +33,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: lstFind.c,v 1.12 2005/02/16 15:11:53 christos Exp $";
|
||||
static char rcsid[] = "$NetBSD: lstFind.c,v 1.13 2008/12/13 15:19:29 dsl Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)lstFind.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: lstFind.c,v 1.12 2005/02/16 15:11:53 christos Exp $");
|
||||
__RCSID("$NetBSD: lstFind.c,v 1.13 2008/12/13 15:19:29 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -59,7 +59,7 @@ __RCSID("$NetBSD: lstFind.c,v 1.12 2005/02/16 15:11:53 christos Exp $");
|
||||
* and the given datum.
|
||||
*
|
||||
* Results:
|
||||
* The found node or NILLNODE if none matches.
|
||||
* The found node or NULL if none matches.
|
||||
*
|
||||
* Side Effects:
|
||||
* None.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lstFindFrom.c,v 1.12 2006/10/27 21:37:25 dsl Exp $ */
|
||||
/* $NetBSD: lstFindFrom.c,v 1.13 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -33,14 +33,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: lstFindFrom.c,v 1.12 2006/10/27 21:37:25 dsl Exp $";
|
||||
static char rcsid[] = "$NetBSD: lstFindFrom.c,v 1.13 2008/12/13 15:19:29 dsl Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)lstFindFrom.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: lstFindFrom.c,v 1.12 2006/10/27 21:37:25 dsl Exp $");
|
||||
__RCSID("$NetBSD: lstFindFrom.c,v 1.13 2008/12/13 15:19:29 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -60,7 +60,7 @@ __RCSID("$NetBSD: lstFindFrom.c,v 1.12 2006/10/27 21:37:25 dsl Exp $");
|
||||
* determine when it has been found.
|
||||
*
|
||||
* Results:
|
||||
* The found node or NILLNODE
|
||||
* The found node or NULL
|
||||
*
|
||||
* Side Effects:
|
||||
* None.
|
||||
@ -75,7 +75,7 @@ Lst_FindFrom(Lst l, LstNode ln, ClientData d,
|
||||
Boolean found = FALSE;
|
||||
|
||||
if (!LstValid (l) || LstIsEmpty (l) || !LstNodeValid (ln, l)) {
|
||||
return (NILLNODE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
tln = ln;
|
||||
@ -87,12 +87,12 @@ Lst_FindFrom(Lst l, LstNode ln, ClientData d,
|
||||
} else {
|
||||
tln = tln->nextPtr;
|
||||
}
|
||||
} while (tln != ln && tln != NilListNode);
|
||||
} while (tln != ln && tln != NULL);
|
||||
|
||||
if (found) {
|
||||
return (tln);
|
||||
} else {
|
||||
return (NILLNODE);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lstFirst.c,v 1.11 2006/10/27 21:37:25 dsl Exp $ */
|
||||
/* $NetBSD: lstFirst.c,v 1.12 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -33,14 +33,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: lstFirst.c,v 1.11 2006/10/27 21:37:25 dsl Exp $";
|
||||
static char rcsid[] = "$NetBSD: lstFirst.c,v 1.12 2008/12/13 15:19:29 dsl Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)lstFirst.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: lstFirst.c,v 1.11 2006/10/27 21:37:25 dsl Exp $");
|
||||
__RCSID("$NetBSD: lstFirst.c,v 1.12 2008/12/13 15:19:29 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -58,7 +58,7 @@ __RCSID("$NetBSD: lstFirst.c,v 1.11 2006/10/27 21:37:25 dsl Exp $");
|
||||
* Return the first node on the given list.
|
||||
*
|
||||
* Results:
|
||||
* The first node or NILLNODE if the list is empty.
|
||||
* The first node or NULL if the list is empty.
|
||||
*
|
||||
* Side Effects:
|
||||
* None.
|
||||
@ -69,7 +69,7 @@ LstNode
|
||||
Lst_First(Lst l)
|
||||
{
|
||||
if (!LstValid (l) || LstIsEmpty (l)) {
|
||||
return (NILLNODE);
|
||||
return NULL;
|
||||
} else {
|
||||
return (l->firstPtr);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lstForEachFrom.c,v 1.15 2008/02/15 21:29:50 christos Exp $ */
|
||||
/* $NetBSD: lstForEachFrom.c,v 1.16 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -33,14 +33,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: lstForEachFrom.c,v 1.15 2008/02/15 21:29:50 christos Exp $";
|
||||
static char rcsid[] = "$NetBSD: lstForEachFrom.c,v 1.16 2008/12/13 15:19:29 dsl Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)lstForEachFrom.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: lstForEachFrom.c,v 1.15 2008/02/15 21:29:50 christos Exp $");
|
||||
__RCSID("$NetBSD: lstForEachFrom.c,v 1.16 2008/12/13 15:19:29 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -98,7 +98,7 @@ Lst_ForEachFrom(Lst l, LstNode ln, int (*proc)(ClientData, ClientData),
|
||||
* - nothing's been added after the current node (check this
|
||||
* after proc() has been called).
|
||||
*/
|
||||
done = (next == NilListNode || next == list->firstPtr);
|
||||
done = (next == NULL || next == list->firstPtr);
|
||||
|
||||
(void) tln->useCount++;
|
||||
result = (*proc) (tln->datum, d);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lstInit.c,v 1.11 2006/10/27 21:37:25 dsl Exp $ */
|
||||
/* $NetBSD: lstInit.c,v 1.12 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -33,14 +33,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: lstInit.c,v 1.11 2006/10/27 21:37:25 dsl Exp $";
|
||||
static char rcsid[] = "$NetBSD: lstInit.c,v 1.12 2008/12/13 15:19:29 dsl Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)lstInit.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: lstInit.c,v 1.11 2006/10/27 21:37:25 dsl Exp $");
|
||||
__RCSID("$NetBSD: lstInit.c,v 1.12 2008/12/13 15:19:29 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -75,8 +75,8 @@ Lst_Init(Boolean circ)
|
||||
|
||||
PAlloc (nList, List);
|
||||
|
||||
nList->firstPtr = NilListNode;
|
||||
nList->lastPtr = NilListNode;
|
||||
nList->firstPtr = NULL;
|
||||
nList->lastPtr = NULL;
|
||||
nList->isOpen = FALSE;
|
||||
nList->isCirc = circ;
|
||||
nList->atEnd = Unknown;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lstInsert.c,v 1.12 2006/10/27 21:37:25 dsl Exp $ */
|
||||
/* $NetBSD: lstInsert.c,v 1.13 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -33,14 +33,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: lstInsert.c,v 1.12 2006/10/27 21:37:25 dsl Exp $";
|
||||
static char rcsid[] = "$NetBSD: lstInsert.c,v 1.13 2008/12/13 15:19:29 dsl Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)lstInsert.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: lstInsert.c,v 1.12 2006/10/27 21:37:25 dsl Exp $");
|
||||
__RCSID("$NetBSD: lstInsert.c,v 1.13 2008/12/13 15:19:29 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -83,7 +83,7 @@ Lst_InsertBefore(Lst l, LstNode ln, ClientData d)
|
||||
/*
|
||||
* check validity of arguments
|
||||
*/
|
||||
if (LstValid (l) && (LstIsEmpty (l) && ln == NILLNODE))
|
||||
if (LstValid (l) && (LstIsEmpty (l) && ln == NULL))
|
||||
goto ok;
|
||||
|
||||
if (!LstValid (l) || LstIsEmpty (l) || !LstNodeValid (ln, l)) {
|
||||
@ -96,18 +96,18 @@ Lst_InsertBefore(Lst l, LstNode ln, ClientData d)
|
||||
nLNode->datum = d;
|
||||
nLNode->useCount = nLNode->flags = 0;
|
||||
|
||||
if (ln == NILLNODE) {
|
||||
if (ln == NULL) {
|
||||
if (list->isCirc) {
|
||||
nLNode->prevPtr = nLNode->nextPtr = nLNode;
|
||||
} else {
|
||||
nLNode->prevPtr = nLNode->nextPtr = NilListNode;
|
||||
nLNode->prevPtr = nLNode->nextPtr = NULL;
|
||||
}
|
||||
list->firstPtr = list->lastPtr = nLNode;
|
||||
} else {
|
||||
nLNode->prevPtr = lNode->prevPtr;
|
||||
nLNode->nextPtr = lNode;
|
||||
|
||||
if (nLNode->prevPtr != NilListNode) {
|
||||
if (nLNode->prevPtr != NULL) {
|
||||
nLNode->prevPtr->nextPtr = nLNode;
|
||||
}
|
||||
lNode->prevPtr = nLNode;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lstInt.h,v 1.16 2008/10/06 22:09:21 joerg Exp $ */
|
||||
/* $NetBSD: lstInt.h,v 1.17 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -58,8 +58,6 @@ typedef struct ListNode {
|
||||
*/
|
||||
#define LN_DELETED 0x0001 /* List node should be removed when done */
|
||||
|
||||
#define NilListNode ((ListNode)-1)
|
||||
|
||||
typedef enum {
|
||||
Head, Middle, Tail, Unknown
|
||||
} Where;
|
||||
@ -74,14 +72,12 @@ typedef struct List {
|
||||
*/
|
||||
Where atEnd; /* Where in the list the last access was */
|
||||
Boolean isOpen; /* true if list has been Lst_Open'ed */
|
||||
ListNode curPtr; /* current node, if open. NilListNode if
|
||||
ListNode curPtr; /* current node, if open. NULL if
|
||||
* *just* opened */
|
||||
ListNode prevPtr; /* Previous node, if open. Used by
|
||||
* Lst_Remove */
|
||||
} *List;
|
||||
|
||||
#define NilList ((List)-1)
|
||||
|
||||
/*
|
||||
* PAlloc (var, ptype) --
|
||||
* Allocate a pointer-typedef structure 'ptype' into the variable 'var'
|
||||
@ -92,18 +88,18 @@ typedef struct List {
|
||||
* LstValid (l) --
|
||||
* Return TRUE if the list l is valid
|
||||
*/
|
||||
#define LstValid(l) ((Lst)(l) != NILLST)
|
||||
#define LstValid(l) ((Lst)(l) != NULL)
|
||||
|
||||
/*
|
||||
* LstNodeValid (ln, l) --
|
||||
* Return TRUE if the LstNode ln is valid with respect to l
|
||||
*/
|
||||
#define LstNodeValid(ln, l) ((ln) != NILLNODE)
|
||||
#define LstNodeValid(ln, l) ((ln) != NULL)
|
||||
|
||||
/*
|
||||
* LstIsEmpty (l) --
|
||||
* TRUE if the list l is empty.
|
||||
*/
|
||||
#define LstIsEmpty(l) (((List)(l))->firstPtr == NilListNode)
|
||||
#define LstIsEmpty(l) (((List)(l))->firstPtr == NULL)
|
||||
|
||||
#endif /* _LSTINT_H_ */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lstIsEmpty.c,v 1.10 2004/05/07 00:04:41 ross Exp $ */
|
||||
/* $NetBSD: lstIsEmpty.c,v 1.11 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -33,14 +33,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: lstIsEmpty.c,v 1.10 2004/05/07 00:04:41 ross Exp $";
|
||||
static char rcsid[] = "$NetBSD: lstIsEmpty.c,v 1.11 2008/12/13 15:19:29 dsl Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)lstIsEmpty.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: lstIsEmpty.c,v 1.10 2004/05/07 00:04:41 ross Exp $");
|
||||
__RCSID("$NetBSD: lstIsEmpty.c,v 1.11 2008/12/13 15:19:29 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -63,8 +63,8 @@ __RCSID("$NetBSD: lstIsEmpty.c,v 1.10 2004/05/07 00:04:41 ross Exp $");
|
||||
* Side Effects:
|
||||
* None.
|
||||
*
|
||||
* A list is considered empty if its firstPtr == NilListNode (or if
|
||||
* the list itself is NILLIST).
|
||||
* A list is considered empty if its firstPtr == NULL (or if
|
||||
* the list itself is NULL).
|
||||
*-----------------------------------------------------------------------
|
||||
*/
|
||||
Boolean
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lstLast.c,v 1.11 2006/10/27 21:37:25 dsl Exp $ */
|
||||
/* $NetBSD: lstLast.c,v 1.12 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -33,14 +33,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: lstLast.c,v 1.11 2006/10/27 21:37:25 dsl Exp $";
|
||||
static char rcsid[] = "$NetBSD: lstLast.c,v 1.12 2008/12/13 15:19:29 dsl Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)lstLast.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: lstLast.c,v 1.11 2006/10/27 21:37:25 dsl Exp $");
|
||||
__RCSID("$NetBSD: lstLast.c,v 1.12 2008/12/13 15:19:29 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -58,7 +58,7 @@ __RCSID("$NetBSD: lstLast.c,v 1.11 2006/10/27 21:37:25 dsl Exp $");
|
||||
* Return the last node on the list l.
|
||||
*
|
||||
* Results:
|
||||
* The requested node or NILLNODE if the list is empty.
|
||||
* The requested node or NULL if the list is empty.
|
||||
*
|
||||
* Side Effects:
|
||||
* None.
|
||||
@ -69,7 +69,7 @@ LstNode
|
||||
Lst_Last(Lst l)
|
||||
{
|
||||
if (!LstValid(l) || LstIsEmpty (l)) {
|
||||
return (NILLNODE);
|
||||
return NULL;
|
||||
} else {
|
||||
return (l->lastPtr);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lstMember.c,v 1.11 2006/10/27 21:37:25 dsl Exp $ */
|
||||
/* $NetBSD: lstMember.c,v 1.12 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -33,14 +33,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: lstMember.c,v 1.11 2006/10/27 21:37:25 dsl Exp $";
|
||||
static char rcsid[] = "$NetBSD: lstMember.c,v 1.12 2008/12/13 15:19:29 dsl Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)lstMember.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: lstMember.c,v 1.11 2006/10/27 21:37:25 dsl Exp $");
|
||||
__RCSID("$NetBSD: lstMember.c,v 1.12 2008/12/13 15:19:29 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -59,8 +59,8 @@ Lst_Member(Lst l, ClientData d)
|
||||
ListNode lNode;
|
||||
|
||||
lNode = list->firstPtr;
|
||||
if (lNode == NilListNode) {
|
||||
return NILLNODE;
|
||||
if (lNode == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
do {
|
||||
@ -68,7 +68,7 @@ Lst_Member(Lst l, ClientData d)
|
||||
return lNode;
|
||||
}
|
||||
lNode = lNode->nextPtr;
|
||||
} while (lNode != NilListNode && lNode != list->firstPtr);
|
||||
} while (lNode != NULL && lNode != list->firstPtr);
|
||||
|
||||
return NILLNODE;
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lstNext.c,v 1.11 2006/10/27 21:37:25 dsl Exp $ */
|
||||
/* $NetBSD: lstNext.c,v 1.12 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -33,14 +33,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: lstNext.c,v 1.11 2006/10/27 21:37:25 dsl Exp $";
|
||||
static char rcsid[] = "$NetBSD: lstNext.c,v 1.12 2008/12/13 15:19:29 dsl Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)lstNext.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: lstNext.c,v 1.11 2006/10/27 21:37:25 dsl Exp $");
|
||||
__RCSID("$NetBSD: lstNext.c,v 1.12 2008/12/13 15:19:29 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -63,8 +63,8 @@ __RCSID("$NetBSD: lstNext.c,v 1.11 2006/10/27 21:37:25 dsl Exp $");
|
||||
* Return the next node for the given list.
|
||||
*
|
||||
* Results:
|
||||
* The next node or NILLNODE if the list has yet to be opened. Also
|
||||
* if the list is non-circular and the end has been reached, NILLNODE
|
||||
* The next node or NULL if the list has yet to be opened. Also
|
||||
* if the list is non-circular and the end has been reached, NULL
|
||||
* is returned.
|
||||
*
|
||||
* Side Effects:
|
||||
@ -80,12 +80,12 @@ Lst_Next(Lst l)
|
||||
|
||||
if ((LstValid (l) == FALSE) ||
|
||||
(list->isOpen == FALSE)) {
|
||||
return (NILLNODE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
list->prevPtr = list->curPtr;
|
||||
|
||||
if (list->curPtr == NilListNode) {
|
||||
if (list->curPtr == NULL) {
|
||||
if (list->atEnd == Unknown) {
|
||||
/*
|
||||
* If we're just starting out, atEnd will be Unknown.
|
||||
@ -95,14 +95,14 @@ Lst_Next(Lst l)
|
||||
list->curPtr = tln = list->firstPtr;
|
||||
list->atEnd = Middle;
|
||||
} else {
|
||||
tln = NilListNode;
|
||||
tln = NULL;
|
||||
list->atEnd = Tail;
|
||||
}
|
||||
} else {
|
||||
tln = list->curPtr->nextPtr;
|
||||
list->curPtr = tln;
|
||||
|
||||
if (tln == list->firstPtr || tln == NilListNode) {
|
||||
if (tln == list->firstPtr || tln == NULL) {
|
||||
/*
|
||||
* If back at the front, then we've hit the end...
|
||||
*/
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lstOpen.c,v 1.11 2006/10/27 21:37:25 dsl Exp $ */
|
||||
/* $NetBSD: lstOpen.c,v 1.12 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -33,14 +33,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: lstOpen.c,v 1.11 2006/10/27 21:37:25 dsl Exp $";
|
||||
static char rcsid[] = "$NetBSD: lstOpen.c,v 1.12 2008/12/13 15:19:29 dsl Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)lstOpen.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: lstOpen.c,v 1.11 2006/10/27 21:37:25 dsl Exp $");
|
||||
__RCSID("$NetBSD: lstOpen.c,v 1.12 2008/12/13 15:19:29 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -66,7 +66,7 @@ __RCSID("$NetBSD: lstOpen.c,v 1.11 2006/10/27 21:37:25 dsl Exp $");
|
||||
* SUCCESS or FAILURE.
|
||||
*
|
||||
* Side Effects:
|
||||
* isOpen is set TRUE and curPtr is set to NilListNode so the
|
||||
* isOpen is set TRUE and curPtr is set to NULL so the
|
||||
* other sequential functions no it was just opened and can choose
|
||||
* the first element accessed based on this.
|
||||
*
|
||||
@ -80,7 +80,7 @@ Lst_Open(Lst l)
|
||||
}
|
||||
(l)->isOpen = TRUE;
|
||||
(l)->atEnd = LstIsEmpty (l) ? Head : Unknown;
|
||||
(l)->curPtr = NilListNode;
|
||||
(l)->curPtr = NULL;
|
||||
|
||||
return (SUCCESS);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lstPrev.c,v 1.2 2006/10/27 21:37:25 dsl Exp $ */
|
||||
/* $NetBSD: lstPrev.c,v 1.3 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -33,14 +33,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: lstPrev.c,v 1.2 2006/10/27 21:37:25 dsl Exp $";
|
||||
static char rcsid[] = "$NetBSD: lstPrev.c,v 1.3 2008/12/13 15:19:29 dsl Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)lstSucc.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: lstPrev.c,v 1.2 2006/10/27 21:37:25 dsl Exp $");
|
||||
__RCSID("$NetBSD: lstPrev.c,v 1.3 2008/12/13 15:19:29 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -70,8 +70,8 @@ __RCSID("$NetBSD: lstPrev.c,v 1.2 2006/10/27 21:37:25 dsl Exp $");
|
||||
LstNode
|
||||
Lst_Prev(LstNode ln)
|
||||
{
|
||||
if (ln == NILLNODE) {
|
||||
return (NILLNODE);
|
||||
if (ln == NULL) {
|
||||
return NULL;
|
||||
} else {
|
||||
return (ln->prevPtr);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lstRemove.c,v 1.13 2006/10/27 21:37:25 dsl Exp $ */
|
||||
/* $NetBSD: lstRemove.c,v 1.14 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -33,14 +33,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: lstRemove.c,v 1.13 2006/10/27 21:37:25 dsl Exp $";
|
||||
static char rcsid[] = "$NetBSD: lstRemove.c,v 1.14 2008/12/13 15:19:29 dsl Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)lstRemove.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: lstRemove.c,v 1.13 2006/10/27 21:37:25 dsl Exp $");
|
||||
__RCSID("$NetBSD: lstRemove.c,v 1.14 2008/12/13 15:19:29 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -61,7 +61,7 @@ __RCSID("$NetBSD: lstRemove.c,v 1.13 2006/10/27 21:37:25 dsl Exp $");
|
||||
* SUCCESS or FAILURE.
|
||||
*
|
||||
* Side Effects:
|
||||
* The list's firstPtr will be set to NilListNode if ln is the last
|
||||
* The list's firstPtr will be set to NULL if ln is the last
|
||||
* node on the list. firsPtr and lastPtr will be altered if ln is
|
||||
* either the first or last node, respectively, on the list.
|
||||
*
|
||||
@ -81,10 +81,10 @@ Lst_Remove(Lst l, LstNode ln)
|
||||
/*
|
||||
* unlink it from the list
|
||||
*/
|
||||
if (lNode->nextPtr != NilListNode) {
|
||||
if (lNode->nextPtr != NULL) {
|
||||
lNode->nextPtr->prevPtr = lNode->prevPtr;
|
||||
}
|
||||
if (lNode->prevPtr != NilListNode) {
|
||||
if (lNode->prevPtr != NULL) {
|
||||
lNode->prevPtr->nextPtr = lNode->nextPtr;
|
||||
}
|
||||
|
||||
@ -102,12 +102,12 @@ Lst_Remove(Lst l, LstNode ln)
|
||||
/*
|
||||
* Sequential access stuff. If the node we're removing is the current
|
||||
* node in the list, reset the current node to the previous one. If the
|
||||
* previous one was non-existent (prevPtr == NilListNode), we set the
|
||||
* previous one was non-existent (prevPtr == NULL), we set the
|
||||
* end to be Unknown, since it is.
|
||||
*/
|
||||
if (list->isOpen && (list->curPtr == lNode)) {
|
||||
list->curPtr = list->prevPtr;
|
||||
if (list->curPtr == NilListNode) {
|
||||
if (list->curPtr == NULL) {
|
||||
list->atEnd = Unknown;
|
||||
}
|
||||
}
|
||||
@ -118,7 +118,7 @@ Lst_Remove(Lst l, LstNode ln)
|
||||
* this case). The list is, therefore, empty and is marked as such
|
||||
*/
|
||||
if (list->firstPtr == lNode) {
|
||||
list->firstPtr = NilListNode;
|
||||
list->firstPtr = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lstReplace.c,v 1.11 2006/10/27 21:37:25 dsl Exp $ */
|
||||
/* $NetBSD: lstReplace.c,v 1.12 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -33,14 +33,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: lstReplace.c,v 1.11 2006/10/27 21:37:25 dsl Exp $";
|
||||
static char rcsid[] = "$NetBSD: lstReplace.c,v 1.12 2008/12/13 15:19:29 dsl Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)lstReplace.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: lstReplace.c,v 1.11 2006/10/27 21:37:25 dsl Exp $");
|
||||
__RCSID("$NetBSD: lstReplace.c,v 1.12 2008/12/13 15:19:29 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -68,7 +68,7 @@ __RCSID("$NetBSD: lstReplace.c,v 1.11 2006/10/27 21:37:25 dsl Exp $");
|
||||
ReturnStatus
|
||||
Lst_Replace(LstNode ln, ClientData d)
|
||||
{
|
||||
if (ln == NILLNODE) {
|
||||
if (ln == NULL) {
|
||||
return (FAILURE);
|
||||
} else {
|
||||
(ln)->datum = d;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lstSucc.c,v 1.12 2006/10/27 21:37:25 dsl Exp $ */
|
||||
/* $NetBSD: lstSucc.c,v 1.13 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -33,14 +33,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: lstSucc.c,v 1.12 2006/10/27 21:37:25 dsl Exp $";
|
||||
static char rcsid[] = "$NetBSD: lstSucc.c,v 1.13 2008/12/13 15:19:29 dsl Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)lstSucc.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: lstSucc.c,v 1.12 2006/10/27 21:37:25 dsl Exp $");
|
||||
__RCSID("$NetBSD: lstSucc.c,v 1.13 2008/12/13 15:19:29 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -70,8 +70,8 @@ __RCSID("$NetBSD: lstSucc.c,v 1.12 2006/10/27 21:37:25 dsl Exp $");
|
||||
LstNode
|
||||
Lst_Succ(LstNode ln)
|
||||
{
|
||||
if (ln == NILLNODE) {
|
||||
return (NILLNODE);
|
||||
if (ln == NULL) {
|
||||
return NULL;
|
||||
} else {
|
||||
return (ln->nextPtr);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: main.c,v 1.156 2008/12/13 14:26:10 dsl Exp $ */
|
||||
/* $NetBSD: main.c,v 1.157 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -69,7 +69,7 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: main.c,v 1.156 2008/12/13 14:26:10 dsl Exp $";
|
||||
static char rcsid[] = "$NetBSD: main.c,v 1.157 2008/12/13 15:19:29 dsl Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: main.c,v 1.156 2008/12/13 14:26:10 dsl Exp $");
|
||||
__RCSID("$NetBSD: main.c,v 1.157 2008/12/13 15:19:29 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -921,7 +921,7 @@ main(int argc, char **argv)
|
||||
Suff_Init();
|
||||
Trace_Init(tracefile);
|
||||
|
||||
DEFAULT = NILGNODE;
|
||||
DEFAULT = NULL;
|
||||
(void)time(&now);
|
||||
|
||||
Trace_Log(MAKESTART, NULL);
|
||||
@ -934,7 +934,7 @@ main(int argc, char **argv)
|
||||
if (!Lst_IsEmpty(create)) {
|
||||
LstNode ln;
|
||||
|
||||
for (ln = Lst_First(create); ln != NILLNODE;
|
||||
for (ln = Lst_First(create); ln != NULL;
|
||||
ln = Lst_Succ(ln)) {
|
||||
char *name = (char *)Lst_Datum(ln);
|
||||
|
||||
@ -989,7 +989,7 @@ main(int argc, char **argv)
|
||||
Fatal("%s: no system rules (%s).", progname,
|
||||
_PATH_DEFSYSMK);
|
||||
ln = Lst_Find(sysMkPath, NULL, ReadMakefile);
|
||||
if (ln == NILLNODE)
|
||||
if (ln == NULL)
|
||||
Fatal("%s: cannot open %s.", progname,
|
||||
(char *)Lst_Datum(ln));
|
||||
}
|
||||
@ -998,7 +998,7 @@ main(int argc, char **argv)
|
||||
LstNode ln;
|
||||
|
||||
ln = Lst_Find(makefiles, NULL, ReadAllMakefiles);
|
||||
if (ln != NILLNODE)
|
||||
if (ln != NULL)
|
||||
Fatal("%s: cannot open %s.", progname,
|
||||
(char *)Lst_Datum(ln));
|
||||
} else if (ReadMakefile(UNCONST("makefile"), NULL) != 0)
|
||||
@ -1077,7 +1077,7 @@ main(int argc, char **argv)
|
||||
if (printVars) {
|
||||
LstNode ln;
|
||||
|
||||
for (ln = Lst_First(variables); ln != NILLNODE;
|
||||
for (ln = Lst_First(variables); ln != NULL;
|
||||
ln = Lst_Succ(ln)) {
|
||||
char *var = (char *)Lst_Datum(ln);
|
||||
char *value;
|
||||
@ -1128,9 +1128,9 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
#ifdef CLEANUP
|
||||
Lst_Destroy(targs, NOFREE);
|
||||
Lst_Destroy(variables, NOFREE);
|
||||
Lst_Destroy(makefiles, NOFREE);
|
||||
Lst_Destroy(targs, NULL);
|
||||
Lst_Destroy(variables, NULL);
|
||||
Lst_Destroy(makefiles, NULL);
|
||||
Lst_Destroy(create, (FreeProc *)free);
|
||||
#endif
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: make.c,v 1.76 2008/02/15 21:29:50 christos Exp $ */
|
||||
/* $NetBSD: make.c,v 1.77 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -69,14 +69,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: make.c,v 1.76 2008/02/15 21:29:50 christos Exp $";
|
||||
static char rcsid[] = "$NetBSD: make.c,v 1.77 2008/12/13 15:19:29 dsl Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)make.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: make.c,v 1.76 2008/02/15 21:29:50 christos Exp $");
|
||||
__RCSID("$NetBSD: make.c,v 1.77 2008/12/13 15:19:29 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -450,9 +450,9 @@ Make_HandleUse(GNode *cgn, GNode *pgn)
|
||||
* prepend the child's commands to the parent.
|
||||
*/
|
||||
Lst cmds = pgn->commands;
|
||||
pgn->commands = Lst_Duplicate(cgn->commands, NOCOPY);
|
||||
pgn->commands = Lst_Duplicate(cgn->commands, NULL);
|
||||
(void)Lst_Concat(pgn->commands, cmds, LST_CONCNEW);
|
||||
Lst_Destroy(cmds, NOFREE);
|
||||
Lst_Destroy(cmds, NULL);
|
||||
} else {
|
||||
/*
|
||||
* .USE or target has no commands --
|
||||
@ -463,7 +463,7 @@ Make_HandleUse(GNode *cgn, GNode *pgn)
|
||||
}
|
||||
|
||||
if (Lst_Open(cgn->children) == SUCCESS) {
|
||||
while ((ln = Lst_Next(cgn->children)) != NILLNODE) {
|
||||
while ((ln = Lst_Next(cgn->children)) != NULL) {
|
||||
GNode *tgn, *gn = (GNode *)Lst_Datum(ln);
|
||||
|
||||
/*
|
||||
@ -482,7 +482,7 @@ Make_HandleUse(GNode *cgn, GNode *pgn)
|
||||
if (gn->name && gn->uname && strcmp(gn->name, gn->uname) != 0) {
|
||||
/* See if we have a target for this node. */
|
||||
tgn = Targ_FindNode(gn->name, TARG_NOCREATE);
|
||||
if (tgn != NILGNODE)
|
||||
if (tgn != NULL)
|
||||
gn = tgn;
|
||||
}
|
||||
|
||||
@ -541,7 +541,7 @@ MakeHandleUse(ClientData cgnp, ClientData pgnp)
|
||||
* children the parent has. This is used by Make_Run to decide
|
||||
* whether to queue the parent or examine its children...
|
||||
*/
|
||||
if ((ln = Lst_Member(pgn->children, cgn)) != NILLNODE) {
|
||||
if ((ln = Lst_Member(pgn->children, cgn)) != NULL) {
|
||||
Lst_Remove(pgn->children, ln);
|
||||
pgn->unmade--;
|
||||
}
|
||||
@ -720,7 +720,7 @@ Make_Update(GNode *cgn)
|
||||
|
||||
/* Now mark all the parents as having one less unmade child */
|
||||
if (Lst_Open(parents) == SUCCESS) {
|
||||
while ((ln = Lst_Next(parents)) != NILLNODE) {
|
||||
while ((ln = Lst_Next(parents)) != NULL) {
|
||||
pgn = (GNode *)Lst_Datum(ln);
|
||||
if (DEBUG(MAKE))
|
||||
fprintf(debug_file, "inspect parent %s%s: flags %x, "
|
||||
@ -823,7 +823,7 @@ Make_Update(GNode *cgn)
|
||||
if (Lst_Open(cgn->iParents) == SUCCESS) {
|
||||
char *cpref = Var_Value(PREFIX, cgn, &p1);
|
||||
|
||||
while ((ln = Lst_Next(cgn->iParents)) != NILLNODE) {
|
||||
while ((ln = Lst_Next(cgn->iParents)) != NULL) {
|
||||
pgn = (GNode *)Lst_Datum(ln);
|
||||
if (pgn->flags & REMAKE) {
|
||||
Var_Set(IMPSRC, cname, pgn, 0);
|
||||
@ -1029,7 +1029,7 @@ MakeBuildChild(ClientData v_cn, ClientData toBeMade_next)
|
||||
cn->name, cn->cohort_num);
|
||||
|
||||
cn->made = REQUESTED;
|
||||
if (toBeMade_next == NILLNODE)
|
||||
if (toBeMade_next == NULL)
|
||||
Lst_AtEnd(toBeMade, cn);
|
||||
else
|
||||
Lst_InsertBefore(toBeMade, toBeMade_next, cn);
|
||||
@ -1276,7 +1276,7 @@ Make_ExpandUse(Lst targs)
|
||||
GNode *gn; /* a temporary pointer */
|
||||
Lst examine; /* List of targets to examine */
|
||||
|
||||
examine = Lst_Duplicate(targs, NOCOPY);
|
||||
examine = Lst_Duplicate(targs, NULL);
|
||||
|
||||
/*
|
||||
* Make an initial downward pass over the graph, marking nodes to be made
|
||||
@ -1300,7 +1300,7 @@ Make_ExpandUse(Lst targs)
|
||||
if ((gn->type & OP_DOUBLEDEP) && !Lst_IsEmpty (gn->cohorts)) {
|
||||
/* Append all the 'cohorts' to the list of things to examine */
|
||||
Lst new;
|
||||
new = Lst_Duplicate(gn->cohorts, NOCOPY);
|
||||
new = Lst_Duplicate(gn->cohorts, NULL);
|
||||
Lst_Concat(new, examine, LST_CONCLINK);
|
||||
examine = new;
|
||||
}
|
||||
@ -1344,7 +1344,7 @@ Make_ExpandUse(Lst targs)
|
||||
Lst_ForEach(gn->children, MakeAddChild, examine);
|
||||
}
|
||||
|
||||
Lst_Destroy(examine, NOFREE);
|
||||
Lst_Destroy(examine, NULL);
|
||||
}
|
||||
|
||||
/*-
|
||||
@ -1417,7 +1417,7 @@ Make_ProcessWait(Lst targs)
|
||||
Lst_ForEach(targs, link_parent, pgn);
|
||||
|
||||
/* Start building with the 'dummy' .MAIN' node */
|
||||
MakeBuildChild(pgn, NILLNODE);
|
||||
MakeBuildChild(pgn, NULL);
|
||||
|
||||
examine = Lst_Init(FALSE);
|
||||
Lst_AtEnd(examine, pgn);
|
||||
@ -1435,14 +1435,14 @@ Make_ProcessWait(Lst targs)
|
||||
if ((pgn->type & OP_DOUBLEDEP) && !Lst_IsEmpty (pgn->cohorts)) {
|
||||
/* Append all the 'cohorts' to the list of things to examine */
|
||||
Lst new;
|
||||
new = Lst_Duplicate(pgn->cohorts, NOCOPY);
|
||||
new = Lst_Duplicate(pgn->cohorts, NULL);
|
||||
Lst_Concat(new, examine, LST_CONCLINK);
|
||||
examine = new;
|
||||
}
|
||||
|
||||
owln = Lst_First(pgn->children);
|
||||
Lst_Open(pgn->children);
|
||||
for (; (ln = Lst_Next(pgn->children)) != NILLNODE; ) {
|
||||
for (; (ln = Lst_Next(pgn->children)) != NULL; ) {
|
||||
cgn = Lst_Datum(ln);
|
||||
if (cgn->type & OP_WAIT) {
|
||||
/* Make the .WAIT node depend on the previous children */
|
||||
@ -1455,7 +1455,7 @@ Make_ProcessWait(Lst targs)
|
||||
Lst_Close(pgn->children);
|
||||
}
|
||||
|
||||
Lst_Destroy(examine, NOFREE);
|
||||
Lst_Destroy(examine, NULL);
|
||||
}
|
||||
|
||||
/*-
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: make.h,v 1.75 2008/12/07 04:50:15 christos Exp $ */
|
||||
/* $NetBSD: make.h,v 1.76 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -213,11 +213,6 @@ typedef struct GNode {
|
||||
int lineno; /* line number where the GNode got defined */
|
||||
} GNode;
|
||||
|
||||
/*
|
||||
* Manifest constants
|
||||
*/
|
||||
#define NILGNODE ((GNode *) NIL)
|
||||
|
||||
/*
|
||||
* The OP_ constants are used when parsing a dependency line as a way of
|
||||
* communicating to other parts of the program the way in which a target
|
||||
@ -290,7 +285,7 @@ typedef struct GNode {
|
||||
* do if the desired node(s) is (are) not found. If the TARG_CREATE constant
|
||||
* is given, a new, empty node will be created for the target, placed in the
|
||||
* table of all targets and its address returned. If TARG_NOCREATE is given,
|
||||
* a NIL pointer will be returned.
|
||||
* a NULL pointer will be returned.
|
||||
*/
|
||||
#define TARG_NOCREATE 0x00 /* don't create it */
|
||||
#define TARG_CREATE 0x01 /* create node if not found */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: parse.c,v 1.151 2008/11/29 17:50:11 dsl Exp $ */
|
||||
/* $NetBSD: parse.c,v 1.152 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -69,14 +69,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: parse.c,v 1.151 2008/11/29 17:50:11 dsl Exp $";
|
||||
static char rcsid[] = "$NetBSD: parse.c,v 1.152 2008/12/13 15:19:29 dsl Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: parse.c,v 1.151 2008/11/29 17:50:11 dsl Exp $");
|
||||
__RCSID("$NetBSD: parse.c,v 1.152 2008/12/13 15:19:29 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -222,7 +222,7 @@ static ParseSpecial specType;
|
||||
#define LPAREN '('
|
||||
#define RPAREN ')'
|
||||
/*
|
||||
* Predecessor node for handling .ORDER. Initialized to NILGNODE when .ORDER
|
||||
* Predecessor node for handling .ORDER. Initialized to NULL when .ORDER
|
||||
* seen, then set to each successive source on the line.
|
||||
*/
|
||||
static GNode *predecessor;
|
||||
@ -474,7 +474,7 @@ Parse_Error(int type, const char *fmt, ...)
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
if (curFile == (IFile *)NIL) {
|
||||
if (curFile == NULL) {
|
||||
/* avoid segfault */
|
||||
static IFile intFile = {
|
||||
NULL, 0, /* fd */ -1, 0, NULL, NULL, NULL, 0
|
||||
@ -496,7 +496,7 @@ Parse_Error(int type, const char *fmt, ...)
|
||||
* pointing to our dummy one.
|
||||
*/
|
||||
if (curFile->fname == NULL) {
|
||||
curFile = (IFile *)NIL;
|
||||
curFile = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -698,7 +698,7 @@ ParseDoSrc(int tOp, const char *src)
|
||||
* source and the current one.
|
||||
*/
|
||||
gn = Targ_FindNode(src, TARG_CREATE);
|
||||
if (predecessor != NILGNODE) {
|
||||
if (predecessor != NULL) {
|
||||
(void)Lst_AtEnd(predecessor->order_succ, gn);
|
||||
(void)Lst_AtEnd(gn->order_pred, predecessor);
|
||||
if (DEBUG(PARSE)) {
|
||||
@ -979,7 +979,7 @@ ParseDoDependency(char *line)
|
||||
* main target.
|
||||
* .NOTPARALLEL Make only one target at a time.
|
||||
* .SINGLESHELL Create a shell for each command.
|
||||
* .ORDER Must set initial predecessor to NIL
|
||||
* .ORDER Must set initial predecessor to NULL
|
||||
*/
|
||||
switch (specType) {
|
||||
case ExPath:
|
||||
@ -1013,7 +1013,7 @@ ParseDoDependency(char *line)
|
||||
compatMake = TRUE;
|
||||
break;
|
||||
case Order:
|
||||
predecessor = NILGNODE;
|
||||
predecessor = NULL;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -1028,7 +1028,7 @@ ParseDoDependency(char *line)
|
||||
|
||||
specType = ExPath;
|
||||
path = Suff_GetPath(&line[5]);
|
||||
if (path == NILLST) {
|
||||
if (path == NULL) {
|
||||
Parse_Error(PARSE_FATAL,
|
||||
"Suffix '%s' not defined (yet)",
|
||||
&line[5]);
|
||||
@ -1113,7 +1113,7 @@ ParseDoDependency(char *line)
|
||||
/*
|
||||
* Don't need the list of target names anymore...
|
||||
*/
|
||||
Lst_Destroy(curTargs, NOFREE);
|
||||
Lst_Destroy(curTargs, NULL);
|
||||
curTargs = NULL;
|
||||
|
||||
if (!Lst_IsEmpty(targets)) {
|
||||
@ -1292,7 +1292,7 @@ ParseDoDependency(char *line)
|
||||
line = cp;
|
||||
}
|
||||
if (paths) {
|
||||
Lst_Destroy(paths, NOFREE);
|
||||
Lst_Destroy(paths, NULL);
|
||||
}
|
||||
if (specType == ExPath)
|
||||
Dir_SetPATH();
|
||||
@ -1327,7 +1327,7 @@ ParseDoDependency(char *line)
|
||||
gn = (GNode *)Lst_DeQueue(sources);
|
||||
ParseDoSrc(tOp, gn->name);
|
||||
}
|
||||
Lst_Destroy(sources, NOFREE);
|
||||
Lst_Destroy(sources, NULL);
|
||||
cp = line;
|
||||
} else {
|
||||
if (*cp) {
|
||||
@ -1344,7 +1344,7 @@ ParseDoDependency(char *line)
|
||||
}
|
||||
}
|
||||
|
||||
if (mainNode == NILGNODE) {
|
||||
if (mainNode == NULL) {
|
||||
/*
|
||||
* If we have yet to decide on a main target to make, in the
|
||||
* absence of any user input, we want the first target on
|
||||
@ -1356,7 +1356,7 @@ ParseDoDependency(char *line)
|
||||
|
||||
out:
|
||||
if (curTargs)
|
||||
Lst_Destroy(curTargs, NOFREE);
|
||||
Lst_Destroy(curTargs, NULL);
|
||||
}
|
||||
|
||||
/*-
|
||||
@ -1810,11 +1810,11 @@ Parse_include_file(char *file, Boolean isSystem, int silent)
|
||||
* If we have a suffix specific path we should use that.
|
||||
*/
|
||||
char *suff;
|
||||
Lst suffPath = NILLST;
|
||||
Lst suffPath = NULL;
|
||||
|
||||
if ((suff = strrchr(file, '.'))) {
|
||||
suffPath = Suff_GetPath(suff);
|
||||
if (suffPath != NILLST) {
|
||||
if (suffPath != NULL) {
|
||||
fullname = Dir_FindFile(file, suffPath);
|
||||
}
|
||||
}
|
||||
@ -2138,7 +2138,7 @@ ParseEOF(void)
|
||||
|
||||
curFile = Lst_DeQueue(includes);
|
||||
|
||||
if (curFile == (IFile *)NIL) {
|
||||
if (curFile == NULL) {
|
||||
/* We've run out of input */
|
||||
Var_Delete(".PARSEDIR", VAR_GLOBAL);
|
||||
Var_Delete(".PARSEFILE", VAR_GLOBAL);
|
||||
@ -2624,7 +2624,7 @@ Parse_File(const char *name, int fd)
|
||||
* Need a non-circular list for the target nodes
|
||||
*/
|
||||
if (targets)
|
||||
Lst_Destroy(targets, NOFREE);
|
||||
Lst_Destroy(targets, NULL);
|
||||
|
||||
targets = Lst_Init(FALSE);
|
||||
inLine = TRUE;
|
||||
@ -2666,7 +2666,7 @@ Parse_File(const char *name, int fd)
|
||||
void
|
||||
Parse_Init(void)
|
||||
{
|
||||
mainNode = NILGNODE;
|
||||
mainNode = NULL;
|
||||
parseIncPath = Lst_Init(FALSE);
|
||||
sysIncPath = Lst_Init(FALSE);
|
||||
defIncPath = Lst_Init(FALSE);
|
||||
@ -2682,11 +2682,11 @@ Parse_End(void)
|
||||
#ifdef CLEANUP
|
||||
Lst_Destroy(targCmds, (FreeProc *)free);
|
||||
if (targets)
|
||||
Lst_Destroy(targets, NOFREE);
|
||||
Lst_Destroy(targets, NULL);
|
||||
Lst_Destroy(defIncPath, Dir_Destroy);
|
||||
Lst_Destroy(sysIncPath, Dir_Destroy);
|
||||
Lst_Destroy(parseIncPath, Dir_Destroy);
|
||||
Lst_Destroy(includes, NOFREE); /* Should be empty now */
|
||||
Lst_Destroy(includes, NULL); /* Should be empty now */
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -2712,7 +2712,7 @@ Parse_MainName(void)
|
||||
|
||||
mainList = Lst_Init(FALSE);
|
||||
|
||||
if (mainNode == NILGNODE) {
|
||||
if (mainNode == NULL) {
|
||||
Punt("no target to make.");
|
||||
/*NOTREACHED*/
|
||||
} else if (mainNode->type & OP_DOUBLEDEP) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: suff.c,v 1.64 2008/10/06 22:09:21 joerg Exp $ */
|
||||
/* $NetBSD: suff.c,v 1.65 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -69,14 +69,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: suff.c,v 1.64 2008/10/06 22:09:21 joerg Exp $";
|
||||
static char rcsid[] = "$NetBSD: suff.c,v 1.65 2008/12/13 15:19:29 dsl Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)suff.c 8.4 (Berkeley) 3/21/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: suff.c,v 1.64 2008/10/06 22:09:21 joerg Exp $");
|
||||
__RCSID("$NetBSD: suff.c,v 1.65 2008/12/13 15:19:29 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -128,7 +128,7 @@ __RCSID("$NetBSD: suff.c,v 1.64 2008/10/06 22:09:21 joerg Exp $");
|
||||
*
|
||||
* Suff_FindDeps Find implicit sources for and the location of
|
||||
* a target based on its suffix. Returns the
|
||||
* bottom-most node added to the graph or NILGNODE
|
||||
* bottom-most node added to the graph or NULL
|
||||
* if the target had no implicit sources.
|
||||
*
|
||||
* Suff_FindPath Return the appropriate path to search in
|
||||
@ -404,7 +404,7 @@ SuffUnRef(ClientData lp, ClientData sp)
|
||||
Lst l = (Lst) lp;
|
||||
|
||||
LstNode ln = Lst_Member(l, sp);
|
||||
if (ln != NILLNODE) {
|
||||
if (ln != NULL) {
|
||||
Lst_Remove(l, ln);
|
||||
((Suff *)sp)->refCount--;
|
||||
}
|
||||
@ -440,9 +440,9 @@ SuffFree(ClientData sp)
|
||||
s->refCount);
|
||||
#endif
|
||||
|
||||
Lst_Destroy(s->ref, NOFREE);
|
||||
Lst_Destroy(s->children, NOFREE);
|
||||
Lst_Destroy(s->parents, NOFREE);
|
||||
Lst_Destroy(s->ref, NULL);
|
||||
Lst_Destroy(s->children, NULL);
|
||||
Lst_Destroy(s->parents, NULL);
|
||||
Lst_Destroy(s->searchPath, Dir_Destroy);
|
||||
|
||||
free(s->name);
|
||||
@ -498,7 +498,7 @@ SuffInsert(Lst l, Suff *s)
|
||||
if (Lst_Open(l) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
while ((ln = Lst_Next(l)) != NILLNODE) {
|
||||
while ((ln = Lst_Next(l)) != NULL) {
|
||||
s2 = (Suff *)Lst_Datum(ln);
|
||||
if (s2->sNum >= s->sNum) {
|
||||
break;
|
||||
@ -509,7 +509,7 @@ SuffInsert(Lst l, Suff *s)
|
||||
if (DEBUG(SUFF)) {
|
||||
fprintf(debug_file, "inserting %s(%d)...", s->name, s->sNum);
|
||||
}
|
||||
if (ln == NILLNODE) {
|
||||
if (ln == NULL) {
|
||||
if (DEBUG(SUFF)) {
|
||||
fprintf(debug_file, "at end of list\n");
|
||||
}
|
||||
@ -586,8 +586,8 @@ SuffParseTransform(char *str, Suff **srcPtr, Suff **targPtr)
|
||||
Suff *single = NULL;/* Source of possible transformation to
|
||||
* null suffix */
|
||||
|
||||
srcLn = NILLNODE;
|
||||
singleLn = NILLNODE;
|
||||
srcLn = NULL;
|
||||
singleLn = NULL;
|
||||
|
||||
/*
|
||||
* Loop looking first for a suffix that matches the start of the
|
||||
@ -596,17 +596,17 @@ SuffParseTransform(char *str, Suff **srcPtr, Suff **targPtr)
|
||||
* parsed the string.
|
||||
*/
|
||||
for (;;) {
|
||||
if (srcLn == NILLNODE) {
|
||||
if (srcLn == NULL) {
|
||||
srcLn = Lst_Find(sufflist, str, SuffSuffIsPrefix);
|
||||
} else {
|
||||
srcLn = Lst_FindFrom(sufflist, Lst_Succ(srcLn), str,
|
||||
SuffSuffIsPrefix);
|
||||
}
|
||||
if (srcLn == NILLNODE) {
|
||||
if (srcLn == NULL) {
|
||||
/*
|
||||
* Ran out of source suffixes -- no such rule
|
||||
*/
|
||||
if (singleLn != NILLNODE) {
|
||||
if (singleLn != NULL) {
|
||||
/*
|
||||
* Not so fast Mr. Smith! There was a suffix that encompassed
|
||||
* the entire string, so we assume it was a transformation
|
||||
@ -629,7 +629,7 @@ SuffParseTransform(char *str, Suff **srcPtr, Suff **targPtr)
|
||||
singleLn = srcLn;
|
||||
} else {
|
||||
targLn = Lst_Find(sufflist, str2, SuffSuffHasNameP);
|
||||
if (targLn != NILLNODE) {
|
||||
if (targLn != NULL) {
|
||||
*srcPtr = src;
|
||||
*targPtr = (Suff *)Lst_Datum(targLn);
|
||||
return (TRUE);
|
||||
@ -689,7 +689,7 @@ Suff_AddTransform(char *line)
|
||||
LstNode ln; /* Node for existing transformation */
|
||||
|
||||
ln = Lst_Find(transforms, line, SuffGNHasNameP);
|
||||
if (ln == NILLNODE) {
|
||||
if (ln == NULL) {
|
||||
/*
|
||||
* Make a new graph node for the transformation. It will be filled in
|
||||
* by the Parse module.
|
||||
@ -704,8 +704,8 @@ Suff_AddTransform(char *line)
|
||||
* attached to several different transformations.
|
||||
*/
|
||||
gn = (GNode *)Lst_Datum(ln);
|
||||
Lst_Destroy(gn->commands, NOFREE);
|
||||
Lst_Destroy(gn->children, NOFREE);
|
||||
Lst_Destroy(gn->commands, NULL);
|
||||
Lst_Destroy(gn->children, NULL);
|
||||
gn->commands = Lst_Init(FALSE);
|
||||
gn->children = Lst_Init(FALSE);
|
||||
}
|
||||
@ -838,7 +838,7 @@ SuffRebuildGraph(ClientData transformp, ClientData sp)
|
||||
cp = SuffStrIsPrefix(s->name, transform->name);
|
||||
if (cp != NULL) {
|
||||
ln = Lst_Find(sufflist, cp, SuffSuffHasNameP);
|
||||
if (ln != NILLNODE) {
|
||||
if (ln != NULL) {
|
||||
/*
|
||||
* Found target. Link in and return, since it can't be anything
|
||||
* else.
|
||||
@ -866,7 +866,7 @@ SuffRebuildGraph(ClientData transformp, ClientData sp)
|
||||
* Replace the start of the target suffix
|
||||
*/
|
||||
cp[1] = s->name[0];
|
||||
if (ln != NILLNODE) {
|
||||
if (ln != NULL) {
|
||||
/*
|
||||
* Found it -- establish the proper relationship
|
||||
*/
|
||||
@ -903,7 +903,7 @@ SuffScanTargets(ClientData targetp, ClientData gsp)
|
||||
Suff *s, *t;
|
||||
char *ptr;
|
||||
|
||||
if (*gs->gn == NILGNODE && gs->r && (target->type & OP_NOTARGET) == 0) {
|
||||
if (*gs->gn == NULL && gs->r && (target->type & OP_NOTARGET) == 0) {
|
||||
*gs->gn = target;
|
||||
Targ_SetMain(target);
|
||||
return 1;
|
||||
@ -919,10 +919,10 @@ SuffScanTargets(ClientData targetp, ClientData gsp)
|
||||
if (SuffParseTransform(target->name, &s, &t)) {
|
||||
if (*gs->gn == target) {
|
||||
gs->r = TRUE;
|
||||
*gs->gn = NILGNODE;
|
||||
Targ_SetMain(NILGNODE);
|
||||
*gs->gn = NULL;
|
||||
Targ_SetMain(NULL);
|
||||
}
|
||||
Lst_Destroy(target->children, NOFREE);
|
||||
Lst_Destroy(target->children, NULL);
|
||||
target->children = Lst_Init(FALSE);
|
||||
target->type = OP_TRANSFORM;
|
||||
/*
|
||||
@ -965,7 +965,7 @@ Suff_AddSuffix(char *str, GNode **gn)
|
||||
GNodeSuff gs;
|
||||
|
||||
ln = Lst_Find(sufflist, str, SuffSuffHasNameP);
|
||||
if (ln == NILLNODE) {
|
||||
if (ln == NULL) {
|
||||
s = bmake_malloc(sizeof(Suff));
|
||||
|
||||
s->name = bmake_strdup(str);
|
||||
@ -1003,7 +1003,7 @@ Suff_AddSuffix(char *str, GNode **gn)
|
||||
* Return the search path for the given suffix, if it's defined.
|
||||
*
|
||||
* Results:
|
||||
* The searchPath for the desired suffix or NILLST if the suffix isn't
|
||||
* The searchPath for the desired suffix or NULL if the suffix isn't
|
||||
* defined.
|
||||
*
|
||||
* Side Effects:
|
||||
@ -1017,8 +1017,8 @@ Suff_GetPath(char *sname)
|
||||
Suff *s;
|
||||
|
||||
ln = Lst_Find(sufflist, sname, SuffSuffHasNameP);
|
||||
if (ln == NILLNODE) {
|
||||
return (NILLST);
|
||||
if (ln == NULL) {
|
||||
return NULL;
|
||||
} else {
|
||||
s = (Suff *)Lst_Datum(ln);
|
||||
return (s->searchPath);
|
||||
@ -1059,7 +1059,7 @@ Suff_DoPaths(void)
|
||||
inIncludes = Lst_Init(FALSE);
|
||||
inLibs = Lst_Init(FALSE);
|
||||
|
||||
while ((ln = Lst_Next(sufflist)) != NILLNODE) {
|
||||
while ((ln = Lst_Next(sufflist)) != NULL) {
|
||||
s = (Suff *)Lst_Datum(ln);
|
||||
if (!Lst_IsEmpty (s->searchPath)) {
|
||||
#ifdef INCLUDES
|
||||
@ -1115,7 +1115,7 @@ Suff_AddInclude(char *sname)
|
||||
Suff *s;
|
||||
|
||||
ln = Lst_Find(sufflist, sname, SuffSuffHasNameP);
|
||||
if (ln != NILLNODE) {
|
||||
if (ln != NULL) {
|
||||
s = (Suff *)Lst_Datum(ln);
|
||||
s->flags |= SUFF_INCLUDE;
|
||||
}
|
||||
@ -1147,7 +1147,7 @@ Suff_AddLib(char *sname)
|
||||
Suff *s;
|
||||
|
||||
ln = Lst_Find(sufflist, sname, SuffSuffHasNameP);
|
||||
if (ln != NILLNODE) {
|
||||
if (ln != NULL) {
|
||||
s = (Suff *)Lst_Datum(ln);
|
||||
s->flags |= SUFF_LIBRARY;
|
||||
}
|
||||
@ -1193,7 +1193,7 @@ SuffAddSrc(ClientData sp, ClientData lsp)
|
||||
s2->file = bmake_strdup(targ->pref);
|
||||
s2->pref = targ->pref;
|
||||
s2->parent = targ;
|
||||
s2->node = NILGNODE;
|
||||
s2->node = NULL;
|
||||
s2->suff = s;
|
||||
s->refCount++;
|
||||
s2->children = 0;
|
||||
@ -1211,7 +1211,7 @@ SuffAddSrc(ClientData sp, ClientData lsp)
|
||||
s2->file = str_concat(targ->pref, s->name, 0);
|
||||
s2->pref = targ->pref;
|
||||
s2->parent = targ;
|
||||
s2->node = NILGNODE;
|
||||
s2->node = NULL;
|
||||
s2->suff = s;
|
||||
s->refCount++;
|
||||
s2->children = 0;
|
||||
@ -1284,7 +1284,7 @@ SuffRemoveSrc(Lst l)
|
||||
#endif
|
||||
|
||||
|
||||
while ((ln = Lst_Next(l)) != NILLNODE) {
|
||||
while ((ln = Lst_Next(l)) != NULL) {
|
||||
s = (Src *)Lst_Datum(ln);
|
||||
if (s->children == 0) {
|
||||
free(s->file);
|
||||
@ -1293,14 +1293,14 @@ SuffRemoveSrc(Lst l)
|
||||
else {
|
||||
#ifdef DEBUG_SRC
|
||||
LstNode ln = Lst_Member(s->parent->cp, s);
|
||||
if (ln != NILLNODE)
|
||||
if (ln != NULL)
|
||||
Lst_Remove(s->parent->cp, ln);
|
||||
#endif
|
||||
--s->parent->children;
|
||||
}
|
||||
#ifdef DEBUG_SRC
|
||||
fprintf(debug_file, "free: [l=%x] p=%x %d\n", l, s, s->children);
|
||||
Lst_Destroy(s->cp, NOFREE);
|
||||
Lst_Destroy(s->cp, NULL);
|
||||
#endif
|
||||
Lst_Remove(l, ln);
|
||||
free(s);
|
||||
@ -1357,7 +1357,7 @@ SuffFindThem(Lst srcs, Lst slst)
|
||||
* A file is considered to exist if either a node exists in the
|
||||
* graph for it or the file actually exists.
|
||||
*/
|
||||
if (Targ_FindNode(s->file, TARG_NOCREATE) != NILGNODE) {
|
||||
if (Targ_FindNode(s->file, TARG_NOCREATE) != NULL) {
|
||||
#ifdef DEBUG_SRC
|
||||
fprintf(debug_file, "remove %x from %x\n", s, srcs);
|
||||
#endif
|
||||
@ -1399,7 +1399,7 @@ SuffFindThem(Lst srcs, Lst slst)
|
||||
* targ Src structure to play with
|
||||
*
|
||||
* Results:
|
||||
* The Src structure of the "winning" child, or NIL if no such beast.
|
||||
* The Src structure of the "winning" child, or NULL if no such beast.
|
||||
*
|
||||
* Side Effects:
|
||||
* A Src structure may be allocated.
|
||||
@ -1423,7 +1423,7 @@ SuffFindCmds(Src *targ, Lst slst)
|
||||
|
||||
for (;;) {
|
||||
ln = Lst_Next(t->children);
|
||||
if (ln == NILLNODE) {
|
||||
if (ln == NULL) {
|
||||
Lst_Close(t->children);
|
||||
return NULL;
|
||||
}
|
||||
@ -1454,7 +1454,7 @@ SuffFindCmds(Src *targ, Lst slst)
|
||||
*/
|
||||
ln = Lst_Find(sufflist, &cp[prefLen],
|
||||
SuffSuffHasNameP);
|
||||
if (ln == NILLNODE)
|
||||
if (ln == NULL)
|
||||
continue;
|
||||
/*
|
||||
* It even has a known suffix, see if there's a transformation
|
||||
@ -1464,7 +1464,7 @@ SuffFindCmds(Src *targ, Lst slst)
|
||||
*/
|
||||
suff = (Suff *)Lst_Datum(ln);
|
||||
|
||||
if (Lst_Member(suff->parents, targ->suff) != NILLNODE)
|
||||
if (Lst_Member(suff->parents, targ->suff) != NULL)
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1642,7 +1642,7 @@ SuffExpandChildren(LstNode cln, GNode *pgn)
|
||||
/* Expand wildcards on new node */
|
||||
SuffExpandWildcards(Lst_Prev(cln), pgn);
|
||||
}
|
||||
Lst_Destroy(members, NOFREE);
|
||||
Lst_Destroy(members, NULL);
|
||||
|
||||
/*
|
||||
* Free the result
|
||||
@ -1699,7 +1699,7 @@ SuffExpandWildcards(LstNode cln, GNode *pgn)
|
||||
/*
|
||||
* Nuke what's left of the list
|
||||
*/
|
||||
Lst_Destroy(explist, NOFREE);
|
||||
Lst_Destroy(explist, NULL);
|
||||
|
||||
if (DEBUG(SUFF)) {
|
||||
fprintf(debug_file, "\n");
|
||||
@ -1749,7 +1749,7 @@ Suff_FindPath(GNode* gn)
|
||||
if (DEBUG(SUFF)) {
|
||||
fprintf(debug_file, "Wildcard expanding \"%s\"...", gn->name);
|
||||
}
|
||||
if (ln != NILLNODE)
|
||||
if (ln != NULL)
|
||||
suff = (Suff *)Lst_Datum(ln);
|
||||
/* XXX: Here we can save the suffix so we don't have to do this again */
|
||||
}
|
||||
@ -1812,7 +1812,7 @@ SuffApplyTransform(GNode *tGn, GNode *sGn, Suff *t, Suff *s)
|
||||
ln = Lst_Find(transforms, tname, SuffGNHasNameP);
|
||||
free(tname);
|
||||
|
||||
if (ln == NILLNODE) {
|
||||
if (ln == NULL) {
|
||||
/*
|
||||
* Not really such a transformation rule (can happen when we're
|
||||
* called to link an OP_MEMBER and OP_ARCHV node), so return
|
||||
@ -1840,7 +1840,7 @@ SuffApplyTransform(GNode *tGn, GNode *sGn, Suff *t, Suff *s)
|
||||
/*
|
||||
* Deal with wildcards and variables in any acquired sources
|
||||
*/
|
||||
for (ln = Lst_Succ(ln); ln != NILLNODE; ln = nln) {
|
||||
for (ln = Lst_Succ(ln); ln != NULL; ln = nln) {
|
||||
nln = Lst_Succ(ln);
|
||||
SuffExpandChildren(ln, tGn);
|
||||
}
|
||||
@ -1961,7 +1961,7 @@ SuffFindArchiveDeps(GNode *gn, Lst slst)
|
||||
sd.ename = eoarch;
|
||||
ln = Lst_Find(ms->parents, &sd, SuffSuffIsSuffixP);
|
||||
|
||||
if (ln != NILLNODE) {
|
||||
if (ln != NULL) {
|
||||
/*
|
||||
* Got one -- apply it
|
||||
*/
|
||||
@ -2060,13 +2060,13 @@ SuffFindNormalDeps(GNode *gn, Lst slst)
|
||||
* Should we find one, we discard the one we found before.
|
||||
*/
|
||||
|
||||
while (ln != NILLNODE) {
|
||||
while (ln != NULL) {
|
||||
/*
|
||||
* Look for next possible suffix...
|
||||
*/
|
||||
ln = Lst_FindFrom(sufflist, ln, &sd, SuffSuffIsSuffixP);
|
||||
|
||||
if (ln != NILLNODE) {
|
||||
if (ln != NULL) {
|
||||
int prefLen; /* Length of the prefix */
|
||||
|
||||
/*
|
||||
@ -2182,7 +2182,7 @@ SuffFindNormalDeps(GNode *gn, Lst slst)
|
||||
* Now we've got the important local variables set, expand any sources
|
||||
* that still contain variables or wildcards in their names.
|
||||
*/
|
||||
for (ln = Lst_First(gn->children); ln != NILLNODE; ln = nln) {
|
||||
for (ln = Lst_First(gn->children); ln != NULL; ln = nln) {
|
||||
nln = Lst_Succ(ln);
|
||||
SuffExpandChildren(ln, gn);
|
||||
}
|
||||
@ -2274,7 +2274,7 @@ sfnd_abort:
|
||||
* up to, but not including, the parent node.
|
||||
*/
|
||||
while (bottom && bottom->parent != NULL) {
|
||||
if (Lst_Member(slst, bottom) == NILLNODE) {
|
||||
if (Lst_Member(slst, bottom) == NULL) {
|
||||
Lst_AtEnd(slst, bottom);
|
||||
}
|
||||
bottom = bottom->parent;
|
||||
@ -2302,7 +2302,7 @@ sfnd_abort:
|
||||
* transformation rule. Also, the unmade field of gn is incremented.
|
||||
* Etc.
|
||||
*/
|
||||
if (bottom->node == NILGNODE) {
|
||||
if (bottom->node == NULL) {
|
||||
bottom->node = Targ_FindNode(bottom->file, TARG_CREATE);
|
||||
}
|
||||
|
||||
@ -2314,7 +2314,7 @@ sfnd_abort:
|
||||
src->node->suffix = src->suff;
|
||||
src->node->suffix->refCount++;
|
||||
|
||||
if (targ->node == NILGNODE) {
|
||||
if (targ->node == NULL) {
|
||||
targ->node = Targ_FindNode(targ->file, TARG_CREATE);
|
||||
}
|
||||
|
||||
@ -2350,7 +2350,7 @@ sfnd_abort:
|
||||
*/
|
||||
sfnd_return:
|
||||
if (bottom)
|
||||
if (Lst_Member(slst, bottom) == NILLNODE)
|
||||
if (Lst_Member(slst, bottom) == NULL)
|
||||
Lst_AtEnd(slst, bottom);
|
||||
|
||||
while (SuffRemoveSrc(srcs) || SuffRemoveSrc(targs))
|
||||
@ -2439,7 +2439,7 @@ SuffFindDeps(GNode *gn, Lst slst)
|
||||
SuffSuffHasNameP);
|
||||
if (gn->suffix)
|
||||
gn->suffix->refCount--;
|
||||
if (ln != NILLNODE) {
|
||||
if (ln != NULL) {
|
||||
gn->suffix = s = (Suff *)Lst_Datum(ln);
|
||||
gn->suffix->refCount++;
|
||||
Arch_FindLib(gn, s->searchPath);
|
||||
@ -2485,7 +2485,7 @@ Suff_SetNull(char *name)
|
||||
LstNode ln;
|
||||
|
||||
ln = Lst_Find(sufflist, name, SuffSuffHasNameP);
|
||||
if (ln != NILLNODE) {
|
||||
if (ln != NULL) {
|
||||
s = (Suff *)Lst_Datum(ln);
|
||||
if (suffNull != NULL) {
|
||||
suffNull->flags &= ~SUFF_NULL;
|
||||
@ -2566,8 +2566,8 @@ Suff_End(void)
|
||||
Lst_Destroy(suffClean, SuffFree);
|
||||
if (suffNull)
|
||||
SuffFree(suffNull);
|
||||
Lst_Destroy(srclist, NOFREE);
|
||||
Lst_Destroy(transforms, NOFREE);
|
||||
Lst_Destroy(srclist, NULL);
|
||||
Lst_Destroy(transforms, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: targ.c,v 1.53 2008/10/06 22:09:21 joerg Exp $ */
|
||||
/* $NetBSD: targ.c,v 1.54 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -69,14 +69,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: targ.c,v 1.53 2008/10/06 22:09:21 joerg Exp $";
|
||||
static char rcsid[] = "$NetBSD: targ.c,v 1.54 2008/12/13 15:19:29 dsl Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)targ.c 8.2 (Berkeley) 3/19/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: targ.c,v 1.53 2008/10/06 22:09:21 joerg Exp $");
|
||||
__RCSID("$NetBSD: targ.c,v 1.54 2008/12/13 15:19:29 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -187,7 +187,7 @@ void
|
||||
Targ_End(void)
|
||||
{
|
||||
#ifdef CLEANUP
|
||||
Lst_Destroy(allTargets, NOFREE);
|
||||
Lst_Destroy(allTargets, NULL);
|
||||
if (allGNs)
|
||||
Lst_Destroy(allGNs, TargFreeGN);
|
||||
Hash_DeleteTable(&targets);
|
||||
@ -297,14 +297,14 @@ TargFreeGN(ClientData gnp)
|
||||
free(gn->path);
|
||||
/* gn->fname points to name allocated when file was opened, don't free */
|
||||
|
||||
Lst_Destroy(gn->iParents, NOFREE);
|
||||
Lst_Destroy(gn->cohorts, NOFREE);
|
||||
Lst_Destroy(gn->parents, NOFREE);
|
||||
Lst_Destroy(gn->children, NOFREE);
|
||||
Lst_Destroy(gn->order_succ, NOFREE);
|
||||
Lst_Destroy(gn->order_pred, NOFREE);
|
||||
Lst_Destroy(gn->iParents, NULL);
|
||||
Lst_Destroy(gn->cohorts, NULL);
|
||||
Lst_Destroy(gn->parents, NULL);
|
||||
Lst_Destroy(gn->children, NULL);
|
||||
Lst_Destroy(gn->order_succ, NULL);
|
||||
Lst_Destroy(gn->order_pred, NULL);
|
||||
Hash_DeleteTable(&gn->context);
|
||||
Lst_Destroy(gn->commands, NOFREE);
|
||||
Lst_Destroy(gn->commands, NULL);
|
||||
free(gn);
|
||||
}
|
||||
#endif
|
||||
@ -321,7 +321,7 @@ TargFreeGN(ClientData gnp)
|
||||
* found
|
||||
*
|
||||
* Results:
|
||||
* The node in the list if it was. If it wasn't, return NILGNODE of
|
||||
* The node in the list if it was. If it wasn't, return NULL of
|
||||
* flags was TARG_NOCREATE or the newly created and initialized node
|
||||
* if it was TARG_CREATE
|
||||
*
|
||||
@ -340,7 +340,7 @@ Targ_FindNode(const char *name, int flags)
|
||||
if (!(flags & (TARG_CREATE | TARG_NOHASH))) {
|
||||
he = Hash_FindEntry(&targets, name);
|
||||
if (he == NULL)
|
||||
return (NILGNODE);
|
||||
return NULL;
|
||||
return (GNode *)Hash_GetValue(he);
|
||||
}
|
||||
|
||||
@ -392,10 +392,10 @@ Targ_FindList(Lst names, int flags)
|
||||
if (Lst_Open(names) == FAILURE) {
|
||||
return (nodes);
|
||||
}
|
||||
while ((ln = Lst_Next(names)) != NILLNODE) {
|
||||
while ((ln = Lst_Next(names)) != NULL) {
|
||||
name = (char *)Lst_Datum(ln);
|
||||
gn = Targ_FindNode(name, flags);
|
||||
if (gn != NILGNODE) {
|
||||
if (gn != NULL) {
|
||||
/*
|
||||
* Note: Lst_AtEnd must come before the Lst_Concat so the nodes
|
||||
* are added to the list in the order in which they were
|
||||
|
@ -1,15 +1,15 @@
|
||||
/* $NetBSD: util.c,v 1.46 2008/10/31 17:42:14 christos Exp $ */
|
||||
/* $NetBSD: util.c,v 1.47 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Missing stuff from OS's
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: util.c,v 1.46 2008/10/31 17:42:14 christos Exp $";
|
||||
static char rcsid[] = "$NetBSD: util.c,v 1.47 2008/12/13 15:19:29 dsl Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: util.c,v 1.46 2008/10/31 17:42:14 christos Exp $");
|
||||
__RCSID("$NetBSD: util.c,v 1.47 2008/12/13 15:19:29 dsl Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -286,7 +286,7 @@ getwd(char *pathname)
|
||||
if (stat("/", &st_root) == -1) {
|
||||
(void)sprintf(pathname,
|
||||
"getwd: Cannot stat \"/\" (%s)", strerror(errno));
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
pathbuf[MAXPATHLEN - 1] = '\0';
|
||||
pathptr = &pathbuf[MAXPATHLEN - 1];
|
||||
@ -297,7 +297,7 @@ getwd(char *pathname)
|
||||
if (lstat(".", &st_cur) == -1) {
|
||||
(void)sprintf(pathname,
|
||||
"getwd: Cannot stat \".\" (%s)", strerror(errno));
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
nextpathptr = strrcpy(nextpathptr, "../");
|
||||
|
||||
@ -316,13 +316,13 @@ getwd(char *pathname)
|
||||
(void)sprintf(pathname,
|
||||
"getwd: Cannot stat directory \"%s\" (%s)",
|
||||
nextpathptr, strerror(errno));
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
if ((dp = opendir(nextpathptr)) == NULL) {
|
||||
(void)sprintf(pathname,
|
||||
"getwd: Cannot open directory \"%s\" (%s)",
|
||||
nextpathptr, strerror(errno));
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* look in the parent for the entry with the same inode */
|
||||
@ -346,7 +346,7 @@ getwd(char *pathname)
|
||||
"getwd: Cannot stat \"%s\" (%s)",
|
||||
d->d_name, strerror(errno));
|
||||
(void)closedir(dp);
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
/* check if we found it yet */
|
||||
if (st_next.st_ino == st_cur.st_ino &&
|
||||
@ -358,7 +358,7 @@ getwd(char *pathname)
|
||||
(void)sprintf(pathname,
|
||||
"getwd: Cannot find \".\" in \"..\"");
|
||||
(void)closedir(dp);
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
st_cur = st_dotdot;
|
||||
pathptr = strrcpy(pathptr, d->d_name);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: var.c,v 1.135 2008/12/13 14:26:10 dsl Exp $ */
|
||||
/* $NetBSD: var.c,v 1.136 2008/12/13 15:19:29 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -69,14 +69,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: var.c,v 1.135 2008/12/13 14:26:10 dsl Exp $";
|
||||
static char rcsid[] = "$NetBSD: var.c,v 1.136 2008/12/13 15:19:29 dsl Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: var.c,v 1.135 2008/12/13 14:26:10 dsl Exp $");
|
||||
__RCSID("$NetBSD: var.c,v 1.136 2008/12/13 15:19:29 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -331,7 +331,7 @@ static void VarPrintVar(ClientData);
|
||||
*
|
||||
* Results:
|
||||
* A pointer to the structure describing the desired variable or
|
||||
* NIL if the variable does not exist.
|
||||
* NULL if the variable does not exist.
|
||||
*
|
||||
* Side Effects:
|
||||
* None
|
||||
@ -414,15 +414,15 @@ VarFind(const char *name, GNode *ctxt, int flags)
|
||||
{
|
||||
var = Hash_FindEntry(&VAR_GLOBAL->context, name);
|
||||
if (var == NULL) {
|
||||
return ((Var *)NIL);
|
||||
return NULL;
|
||||
} else {
|
||||
return ((Var *)Hash_GetValue(var));
|
||||
}
|
||||
} else {
|
||||
return((Var *)NIL);
|
||||
return NULL;
|
||||
}
|
||||
} else if (var == NULL) {
|
||||
return ((Var *)NIL);
|
||||
return NULL;
|
||||
} else {
|
||||
return ((Var *)Hash_GetValue(var));
|
||||
}
|
||||
@ -568,7 +568,7 @@ Var_Export1(const char *name, int force)
|
||||
}
|
||||
}
|
||||
v = VarFind(name, VAR_GLOBAL, 0);
|
||||
if (v == (Var *)NIL) {
|
||||
if (v == NULL) {
|
||||
return 0;
|
||||
}
|
||||
if (!force &&
|
||||
@ -751,7 +751,7 @@ Var_Set(const char *name, const char *val, GNode *ctxt, int flags)
|
||||
name = cp;
|
||||
if (ctxt == VAR_GLOBAL) {
|
||||
v = VarFind(name, VAR_CMD, 0);
|
||||
if (v != (Var *)NIL) {
|
||||
if (v != NULL) {
|
||||
if ((v->flags & VAR_FROM_CMD)) {
|
||||
if (DEBUG(VAR)) {
|
||||
fprintf(debug_file, "%s:%s = %s ignored!\n", ctxt->name, name, val);
|
||||
@ -762,7 +762,7 @@ Var_Set(const char *name, const char *val, GNode *ctxt, int flags)
|
||||
}
|
||||
}
|
||||
v = VarFind(name, ctxt, 0);
|
||||
if (v == (Var *)NIL) {
|
||||
if (v == NULL) {
|
||||
VarAdd(name, val, ctxt);
|
||||
} else {
|
||||
Buf_Discard(v->val, Buf_Size(v->val));
|
||||
@ -780,7 +780,7 @@ Var_Set(const char *name, const char *val, GNode *ctxt, int flags)
|
||||
* to the environment (as per POSIX standard)
|
||||
*/
|
||||
if (ctxt == VAR_CMD && (flags & VAR_NO_EXPORT) == 0) {
|
||||
if (v == (Var *)NIL) {
|
||||
if (v == NULL) {
|
||||
/* we just added it */
|
||||
v = VarFind(name, ctxt, 0);
|
||||
}
|
||||
@ -799,7 +799,7 @@ Var_Set(const char *name, const char *val, GNode *ctxt, int flags)
|
||||
out:
|
||||
if (name != cp)
|
||||
free(UNCONST(name));
|
||||
if (v != (Var *)NIL)
|
||||
if (v != NULL)
|
||||
VarFreeEnv(v, TRUE);
|
||||
}
|
||||
|
||||
@ -844,7 +844,7 @@ Var_Append(const char *name, const char *val, GNode *ctxt)
|
||||
|
||||
v = VarFind(name, ctxt, (ctxt == VAR_GLOBAL) ? FIND_ENV : 0);
|
||||
|
||||
if (v == (Var *)NIL) {
|
||||
if (v == NULL) {
|
||||
VarAdd(name, val, ctxt);
|
||||
} else {
|
||||
Buf_AddByte(v->val, (Byte)' ');
|
||||
@ -901,7 +901,7 @@ Var_Exists(const char *name, GNode *ctxt)
|
||||
if (cp != NULL) {
|
||||
free(cp);
|
||||
}
|
||||
if (v == (Var *)NIL) {
|
||||
if (v == NULL) {
|
||||
return(FALSE);
|
||||
} else {
|
||||
(void)VarFreeEnv(v, TRUE);
|
||||
@ -932,13 +932,13 @@ Var_Value(const char *name, GNode *ctxt, char **frp)
|
||||
|
||||
v = VarFind(name, ctxt, FIND_ENV | FIND_GLOBAL | FIND_CMD);
|
||||
*frp = NULL;
|
||||
if (v != (Var *)NIL) {
|
||||
if (v != NULL) {
|
||||
char *p = ((char *)Buf_GetAll(v->val, NULL));
|
||||
if (VarFreeEnv(v, FALSE))
|
||||
*frp = p;
|
||||
return p;
|
||||
} else {
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2300,7 +2300,7 @@ ApplyModifiers(char *nstr, const char *tstr,
|
||||
v->name = bmake_strdup(v->name);
|
||||
} else if (ctxt != VAR_GLOBAL) {
|
||||
Var *gv = VarFind(v->name, ctxt, 0);
|
||||
if (gv == (Var *)NIL)
|
||||
if (gv == NULL)
|
||||
v_ctxt = VAR_GLOBAL;
|
||||
else
|
||||
VarFreeEnv(gv, TRUE);
|
||||
@ -2469,7 +2469,7 @@ ApplyModifiers(char *nstr, const char *tstr,
|
||||
if ((v->flags & VAR_JUNK) != 0)
|
||||
v->flags |= VAR_KEEP;
|
||||
gn = Targ_FindNode(v->name, TARG_NOCREATE);
|
||||
if (gn == NILGNODE || gn->type & OP_NOPATH) {
|
||||
if (gn == NULL || gn->type & OP_NOPATH) {
|
||||
newStr = NULL;
|
||||
} else if (gn->path) {
|
||||
newStr = bmake_strdup(gn->path);
|
||||
@ -3288,7 +3288,7 @@ Var_Parse(const char *str, GNode *ctxt, Boolean errnum, int *lengthPtr,
|
||||
name[1] = '\0';
|
||||
|
||||
v = VarFind(name, ctxt, FIND_ENV | FIND_GLOBAL | FIND_CMD);
|
||||
if (v == (Var *)NIL) {
|
||||
if (v == NULL) {
|
||||
*lengthPtr = 2;
|
||||
|
||||
if ((ctxt == VAR_CMD) || (ctxt == VAR_GLOBAL)) {
|
||||
@ -3385,7 +3385,7 @@ Var_Parse(const char *str, GNode *ctxt, Boolean errnum, int *lengthPtr,
|
||||
*/
|
||||
|
||||
v = VarFind(str, ctxt, FIND_ENV | FIND_GLOBAL | FIND_CMD);
|
||||
if ((v == (Var *)NIL) && (ctxt != VAR_CMD) && (ctxt != VAR_GLOBAL) &&
|
||||
if ((v == NULL) && (ctxt != VAR_CMD) && (ctxt != VAR_GLOBAL) &&
|
||||
(vlen == 2) && (str[1] == 'F' || str[1] == 'D'))
|
||||
{
|
||||
/*
|
||||
@ -3410,7 +3410,7 @@ Var_Parse(const char *str, GNode *ctxt, Boolean errnum, int *lengthPtr,
|
||||
vname[1] = '\0';
|
||||
v = VarFind(vname, ctxt, 0);
|
||||
|
||||
if (v != (Var *)NIL) {
|
||||
if (v != NULL) {
|
||||
/*
|
||||
* No need for nested expansion or anything, as we're
|
||||
* the only one who sets these things and we sure don't
|
||||
@ -3440,7 +3440,7 @@ Var_Parse(const char *str, GNode *ctxt, Boolean errnum, int *lengthPtr,
|
||||
}
|
||||
}
|
||||
|
||||
if (v == (Var *)NIL) {
|
||||
if (v == NULL) {
|
||||
if (((vlen == 1) ||
|
||||
(((vlen == 2) && (str[1] == 'F' ||
|
||||
str[1] == 'D')))) &&
|
||||
|
Loading…
Reference in New Issue
Block a user