mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-06 13:09:50 +00:00
There's no reason to use fancy forms of NULL. Replace all instances
of NIL, NILLST, NILLGNODE, etc. with NULL. Obtained from: OpenBSD
This commit is contained in:
parent
84d4f509f0
commit
98c28d6cc5
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=69527
@ -322,7 +322,7 @@ Arch_ParseArchive (linePtr, nodeLst, ctxt)
|
||||
*/
|
||||
gn = Targ_FindNode(buf, TARG_CREATE);
|
||||
|
||||
if (gn == NILGNODE) {
|
||||
if (gn == NULL) {
|
||||
free(buf);
|
||||
return(FAILURE);
|
||||
} else {
|
||||
@ -358,7 +358,7 @@ Arch_ParseArchive (linePtr, nodeLst, 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 {
|
||||
@ -381,7 +381,7 @@ Arch_ParseArchive (linePtr, nodeLst, 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 {
|
||||
/*
|
||||
@ -492,7 +492,7 @@ ArchStatMember (archive, member, hash)
|
||||
member = cp + 1;
|
||||
|
||||
ln = Lst_Find (archives, (ClientData) archive, ArchFindArchive);
|
||||
if (ln != NILLNODE) {
|
||||
if (ln != NULL) {
|
||||
ar = (Arch *) Lst_Datum (ln);
|
||||
|
||||
he = Hash_FindEntry (&ar->members, member);
|
||||
@ -1051,7 +1051,7 @@ Arch_MemMTime (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) {
|
||||
|
@ -77,7 +77,7 @@ __RCSID("$FreeBSD$");
|
||||
|
||||
static char meta[256];
|
||||
|
||||
static GNode *curTarg = NILGNODE;
|
||||
static GNode *curTarg = NULL;
|
||||
static GNode *ENDNode;
|
||||
static void CompatInterrupt __P((int));
|
||||
static int CompatRunCommand __P((ClientData, ClientData));
|
||||
@ -108,7 +108,7 @@ CompatInterrupt (signo)
|
||||
{
|
||||
GNode *gn;
|
||||
|
||||
if ((curTarg != NILGNODE) && !Targ_Precious (curTarg)) {
|
||||
if ((curTarg != NULL) && !Targ_Precious (curTarg)) {
|
||||
char *p1;
|
||||
char *file = Var_Value (TARGET, curTarg, &p1);
|
||||
|
||||
@ -122,7 +122,7 @@ CompatInterrupt (signo)
|
||||
*/
|
||||
if (signo == SIGINT) {
|
||||
gn = Targ_FindNode(".INTERRUPT", TARG_NOCREATE);
|
||||
if (gn != NILGNODE) {
|
||||
if (gn != NULL) {
|
||||
Lst_ForEach(gn->commands, CompatRunCommand, (ClientData)gn);
|
||||
}
|
||||
}
|
||||
@ -444,7 +444,7 @@ CompatMake (gnp, pgnp)
|
||||
return (0);
|
||||
}
|
||||
|
||||
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);
|
||||
efree(p1);
|
||||
@ -503,7 +503,7 @@ CompatMake (gnp, pgnp)
|
||||
if (!touchFlag) {
|
||||
curTarg = gn;
|
||||
Lst_ForEach (gn->commands, CompatRunCommand, (ClientData)gn);
|
||||
curTarg = NILGNODE;
|
||||
curTarg = NULL;
|
||||
} else {
|
||||
Job_Touch (gn, gn->type & OP_SILENT);
|
||||
}
|
||||
@ -597,7 +597,7 @@ CompatMake (gnp, pgnp)
|
||||
*/
|
||||
pgn->make = FALSE;
|
||||
} 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);
|
||||
efree(p1);
|
||||
@ -676,7 +676,7 @@ Compat_Run(targs)
|
||||
*/
|
||||
if (!queryFlag) {
|
||||
gn = Targ_FindNode(".BEGIN", TARG_NOCREATE);
|
||||
if (gn != NILGNODE) {
|
||||
if (gn != NULL) {
|
||||
Lst_ForEach(gn->commands, CompatRunCommand, (ClientData)gn);
|
||||
if (gn->made == ERROR) {
|
||||
printf("\n\nStop.\n");
|
||||
|
@ -340,7 +340,7 @@ CondDoMake (argLen, arg)
|
||||
Boolean result;
|
||||
|
||||
arg[argLen] = '\0';
|
||||
if (Lst_Find (create, (ClientData)arg, CondStrMatch) == NILLNODE) {
|
||||
if (Lst_Find (create, (ClientData)arg, CondStrMatch) == NULL) {
|
||||
result = FALSE;
|
||||
} else {
|
||||
result = TRUE;
|
||||
@ -407,7 +407,7 @@ CondDoTarget (argLen, 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;
|
||||
|
@ -496,7 +496,7 @@ DirExpandInt(word, path, 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);
|
||||
}
|
||||
@ -722,7 +722,7 @@ Dir_FindFile (name, path)
|
||||
* and return the resulting string. If we don't find any such thing,
|
||||
* we go on to phase two...
|
||||
*/
|
||||
while ((ln = Lst_Next (path)) != NILLNODE) {
|
||||
while ((ln = Lst_Next (path)) != NULL) {
|
||||
p = (Path *) Lst_Datum (ln);
|
||||
if (DEBUG(DIR)) {
|
||||
printf("%s...", p->name);
|
||||
@ -806,7 +806,7 @@ Dir_FindFile (name, path)
|
||||
printf("failed. Trying subdirectories...");
|
||||
}
|
||||
(void) Lst_Open (path);
|
||||
while ((ln = Lst_Next (path)) != NILLNODE) {
|
||||
while ((ln = Lst_Next (path)) != NULL) {
|
||||
p = (Path *) Lst_Datum (ln);
|
||||
if (p != dot) {
|
||||
file = str_concat (p->name, name, STR_ADDSLASH);
|
||||
@ -903,7 +903,7 @@ Dir_FindFile (name, path)
|
||||
|
||||
bigmisses += 1;
|
||||
ln = Lst_Last (path);
|
||||
if (ln == NILLNODE) {
|
||||
if (ln == NULL) {
|
||||
return ((char *) NULL);
|
||||
} else {
|
||||
p = (Path *) Lst_Datum (ln);
|
||||
@ -1036,9 +1036,9 @@ Dir_AddDir (path, name)
|
||||
register struct dirent *dp; /* entry in directory */
|
||||
|
||||
ln = Lst_Find (openDirectories, (ClientData)name, DirFindName);
|
||||
if (ln != NILLNODE) {
|
||||
if (ln != NULL) {
|
||||
p = (Path *)Lst_Datum (ln);
|
||||
if (Lst_Member(path, (ClientData)p) == NILLNODE) {
|
||||
if (Lst_Member(path, (ClientData)p) == NULL) {
|
||||
p->refCount += 1;
|
||||
(void)Lst_AtEnd (path, (ClientData)p);
|
||||
}
|
||||
@ -1137,7 +1137,7 @@ Dir_MakeFlags (flag, path)
|
||||
str = estrdup ("");
|
||||
|
||||
if (Lst_Open (path) == SUCCESS) {
|
||||
while ((ln = Lst_Next (path)) != NILLNODE) {
|
||||
while ((ln = Lst_Next (path)) != NULL) {
|
||||
p = (Path *) Lst_Datum (ln);
|
||||
tstr = str_concat (flag, p->name, 0);
|
||||
str = str_concat (str, tstr, STR_ADDSPACE | STR_DOFREE);
|
||||
@ -1230,9 +1230,9 @@ Dir_Concat(path1, 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, (ClientData)p) == NILLNODE) {
|
||||
if (Lst_Member(path1, (ClientData)p) == NULL) {
|
||||
p->refCount += 1;
|
||||
(void)Lst_AtEnd(path1, (ClientData)p);
|
||||
}
|
||||
@ -1253,7 +1253,7 @@ Dir_PrintDirectories()
|
||||
hits * 100 / (hits + bigmisses + nearmisses) : 0));
|
||||
printf ("# %-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);
|
||||
printf ("# %-20s %10d\t%4d\n", p->name, p->refCount, p->hits);
|
||||
}
|
||||
|
@ -356,7 +356,7 @@ Hash_EnumNext(searchPtr)
|
||||
|
||||
/*
|
||||
* The hashEntryPtr field points to the most recently returned
|
||||
* entry, or is nil if we are starting up. If not nil, we have
|
||||
* entry, or is NULL if we are starting up. If not NULL, we have
|
||||
* to start at the next one in the chain.
|
||||
*/
|
||||
e = searchPtr->hashEntryPtr;
|
||||
|
@ -969,7 +969,7 @@ JobFinish(job, 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,
|
||||
(ClientData)job->node);
|
||||
@ -1101,7 +1101,7 @@ Job_CheckCommands(gn, abortProc)
|
||||
* 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)) {
|
||||
char *p1;
|
||||
/*
|
||||
* Make only looks for a .DEFAULT if the node was never the
|
||||
@ -1687,7 +1687,7 @@ JobStart(gn, flags, previous)
|
||||
}
|
||||
|
||||
job->node = gn;
|
||||
job->tailCmds = NILLNODE;
|
||||
job->tailCmds = NULL;
|
||||
|
||||
/*
|
||||
* Set the initial value of the flags for this job based on the global
|
||||
@ -1762,7 +1762,7 @@ JobStart(gn, flags, previous)
|
||||
} else {
|
||||
LstNode ln = Lst_Next(gn->commands);
|
||||
|
||||
if ((ln == NILLNODE) ||
|
||||
if ((ln == NULL) ||
|
||||
JobPrintCommand((ClientData) Lst_Datum(ln),
|
||||
(ClientData) job))
|
||||
{
|
||||
@ -1853,7 +1853,7 @@ JobStart(gn, flags, previous)
|
||||
*/
|
||||
if (cmdsOK) {
|
||||
if (aborting == 0) {
|
||||
if (job->tailCmds != NILLNODE) {
|
||||
if (job->tailCmds != NULL) {
|
||||
Lst_ForEachFrom(job->node->commands, job->tailCmds,
|
||||
JobSaveCommand,
|
||||
(ClientData)job->node);
|
||||
@ -2254,10 +2254,10 @@ Job_CatchChildren(block)
|
||||
|
||||
jnode = Lst_Find(jobs, (ClientData)&pid, JobCmpPid);
|
||||
|
||||
if (jnode == NILLNODE) {
|
||||
if (jnode == NULL) {
|
||||
if (WIFSIGNALED(status) && (WTERMSIG(status) == SIGCONT)) {
|
||||
jnode = Lst_Find(stoppedJobs, (ClientData) &pid, JobCmpPid);
|
||||
if (jnode == NILLNODE) {
|
||||
if (jnode == NULL) {
|
||||
Error("Resumed child (%d) not in table", pid);
|
||||
continue;
|
||||
}
|
||||
@ -2358,7 +2358,7 @@ Job_CatchOutput()
|
||||
if (Lst_Open(jobs) == FAILURE) {
|
||||
Punt("Cannot open job table");
|
||||
}
|
||||
while (nfds && (ln = Lst_Next(jobs)) != NILLNODE) {
|
||||
while (nfds && (ln = Lst_Next(jobs)) != NULL) {
|
||||
job = (Job *) Lst_Datum(ln);
|
||||
if (FD_ISSET(job->inPipe, &readfds)) {
|
||||
JobDoOutput(job, FALSE);
|
||||
@ -2424,7 +2424,7 @@ Job_Init(maxproc, maxlocal)
|
||||
aborting = 0;
|
||||
errors = 0;
|
||||
|
||||
lastNode = NILGNODE;
|
||||
lastNode = NULL;
|
||||
|
||||
if (maxJobs == 1 || beVerbose == 0
|
||||
#ifdef REMOTE
|
||||
@ -2498,7 +2498,7 @@ Job_Init(maxproc, maxlocal)
|
||||
|
||||
begin = Targ_FindNode(".BEGIN", TARG_NOCREATE);
|
||||
|
||||
if (begin != NILGNODE) {
|
||||
if (begin != NULL) {
|
||||
JobStart(begin, JOB_SPECIAL, (Job *)0);
|
||||
while (nJobs) {
|
||||
Job_CatchOutput();
|
||||
@ -2793,7 +2793,7 @@ JobInterrupt(runINTERRUPT, signo)
|
||||
aborting = ABORT_INTERRUPT;
|
||||
|
||||
(void) Lst_Open(jobs);
|
||||
while ((ln = Lst_Next(jobs)) != NILLNODE) {
|
||||
while ((ln = Lst_Next(jobs)) != NULL) {
|
||||
job = (Job *) Lst_Datum(ln);
|
||||
|
||||
if (!Targ_Precious(job->node)) {
|
||||
@ -2838,7 +2838,7 @@ JobInterrupt(runINTERRUPT, signo)
|
||||
|
||||
#ifdef REMOTE
|
||||
(void)Lst_Open(stoppedJobs);
|
||||
while ((ln = Lst_Next(stoppedJobs)) != NILLNODE) {
|
||||
while ((ln = Lst_Next(stoppedJobs)) != NULL) {
|
||||
job = (Job *) Lst_Datum(ln);
|
||||
|
||||
if (job->flags & JOB_RESTART) {
|
||||
@ -2899,7 +2899,7 @@ JobInterrupt(runINTERRUPT, signo)
|
||||
|
||||
if (runINTERRUPT && !touchFlag) {
|
||||
interrupt = Targ_FindNode(".INTERRUPT", TARG_NOCREATE);
|
||||
if (interrupt != NILGNODE) {
|
||||
if (interrupt != NULL) {
|
||||
ignoreErrors = FALSE;
|
||||
|
||||
JobStart(interrupt, JOB_IGNDOTS, (Job *)0);
|
||||
@ -2926,7 +2926,7 @@ JobInterrupt(runINTERRUPT, signo)
|
||||
int
|
||||
Job_End()
|
||||
{
|
||||
if (postCommands != NILGNODE && !Lst_IsEmpty(postCommands->commands)) {
|
||||
if (postCommands != NULL && !Lst_IsEmpty(postCommands->commands)) {
|
||||
if (errors) {
|
||||
Error("Errors reported so .END ignored");
|
||||
} else {
|
||||
@ -2996,7 +2996,7 @@ Job_AbortAll()
|
||||
if (nJobs) {
|
||||
|
||||
(void) Lst_Open(jobs);
|
||||
while ((ln = Lst_Next(jobs)) != NILLNODE) {
|
||||
while ((ln = Lst_Next(jobs)) != NULL) {
|
||||
job = (Job *) Lst_Datum(ln);
|
||||
|
||||
/*
|
||||
@ -3053,9 +3053,9 @@ JobFlagForMigration(hostID)
|
||||
}
|
||||
jnode = Lst_Find(jobs, (ClientData)hostID, JobCmpRmtID);
|
||||
|
||||
if (jnode == NILLNODE) {
|
||||
if (jnode == NULL) {
|
||||
jnode = Lst_Find(stoppedJobs, (ClientData)hostID, JobCmpRmtID);
|
||||
if (jnode == NILLNODE) {
|
||||
if (jnode == NULL) {
|
||||
if (DEBUG(JOB)) {
|
||||
Error("Evicting host(%d) not in table", hostID);
|
||||
}
|
||||
|
@ -65,7 +65,7 @@
|
||||
* 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.
|
||||
|
@ -128,8 +128,8 @@ void List_Move(); /* move an element elsewhere in a list */
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
#define List_InitElement(elementPtr) \
|
||||
(elementPtr)->prevPtr = (List_Links *) NIL; \
|
||||
(elementPtr)->nextPtr = (List_Links *) NIL;
|
||||
(elementPtr)->prevPtr = (List_Links *) NULL; \
|
||||
(elementPtr)->nextPtr = (List_Links *) NULL;
|
||||
|
||||
/*
|
||||
* Macros for stepping through or selecting parts of lists
|
||||
|
@ -59,9 +59,6 @@
|
||||
typedef struct Lst *Lst;
|
||||
typedef struct LstNode *LstNode;
|
||||
|
||||
#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.
|
||||
|
@ -60,7 +60,7 @@ __RCSID("$FreeBSD$");
|
||||
* 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.
|
||||
*
|
||||
*-----------------------------------------------------------------------
|
||||
*/
|
||||
@ -74,7 +74,7 @@ Lst_Append (l, ln, d)
|
||||
register ListNode lNode;
|
||||
register ListNode nLNode;
|
||||
|
||||
if (LstValid (l) && (ln == NILLNODE && LstIsEmpty (l))) {
|
||||
if (LstValid (l) && (ln == NULL && LstIsEmpty (l))) {
|
||||
goto ok;
|
||||
}
|
||||
|
||||
@ -90,11 +90,11 @@ Lst_Append (l, ln, 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 {
|
||||
@ -102,7 +102,7 @@ Lst_Append (l, ln, d)
|
||||
nLNode->nextPtr = lNode->nextPtr;
|
||||
|
||||
lNode->nextPtr = nLNode;
|
||||
if (nLNode->nextPtr != NilListNode) {
|
||||
if (nLNode->nextPtr != NULL) {
|
||||
nLNode->nextPtr->prevPtr = nLNode;
|
||||
}
|
||||
|
||||
|
@ -84,16 +84,16 @@ Lst_Concat (l1, l2, 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
|
||||
* last element of list two to be NULL to make the loop easier and
|
||||
* so we don't need an extra case should the first list turn
|
||||
* out to be non-circular -- the final element will already point
|
||||
* 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.
|
||||
* to NULL space and the first element will be untouched if it
|
||||
* existed before and will also point to NULL 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
|
||||
@ -103,14 +103,14 @@ Lst_Concat (l1, l2, 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
|
||||
@ -120,27 +120,27 @@ Lst_Concat (l1, l2, flags)
|
||||
list1->lastPtr->nextPtr = list1->firstPtr;
|
||||
}
|
||||
free ((Address)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
|
||||
* We set the nextPtr of the last element of list 2 to be NULL to make
|
||||
* the loop less difficult. The loop simply goes through the entire
|
||||
* second list creating new LstNodes and filling in the nextPtr, and
|
||||
* prevPtr to fit into l1 and its datum field from the
|
||||
* datum field of the corresponding element in l2. The 'last' node
|
||||
* follows the last of the new nodes along until the entire l2 has
|
||||
* been appended. Only then does the bookkeeping catch up with the
|
||||
* changes. During the first iteration of the loop, if 'last' is nil,
|
||||
* changes. During the first iteration of the loop, if 'last' is NULL,
|
||||
* 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;
|
||||
@ -166,7 +166,7 @@ Lst_Concat (l1, l2, flags)
|
||||
list1->lastPtr->nextPtr = list1->firstPtr;
|
||||
list1->firstPtr->prevPtr = list1->lastPtr;
|
||||
} else {
|
||||
last->nextPtr = NilListNode;
|
||||
last->nextPtr = NULL;
|
||||
}
|
||||
|
||||
if (list2->isCirc) {
|
||||
|
@ -54,7 +54,7 @@ __RCSID("$FreeBSD$");
|
||||
* Return the datum stored in the given node.
|
||||
*
|
||||
* Results:
|
||||
* The datum or (ick!) NIL if the node is invalid.
|
||||
* The datum or (ick!) NULL if the node is invalid.
|
||||
*
|
||||
* Side Effects:
|
||||
* None.
|
||||
@ -65,10 +65,10 @@ ClientData
|
||||
Lst_Datum (ln)
|
||||
LstNode ln;
|
||||
{
|
||||
if (ln != NILLNODE) {
|
||||
if (ln != NULL) {
|
||||
return (((ListNode)ln)->datum);
|
||||
} else {
|
||||
return ((ClientData) NIL);
|
||||
return ((ClientData) NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ __RCSID("$FreeBSD$");
|
||||
* 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 (ick) NULL if the list
|
||||
* is empty.
|
||||
*
|
||||
* Side Effects:
|
||||
@ -70,13 +70,13 @@ Lst_DeQueue (l)
|
||||
register ListNode tln;
|
||||
|
||||
tln = (ListNode) Lst_First (l);
|
||||
if (tln == NilListNode) {
|
||||
return ((ClientData) NIL);
|
||||
if (tln == NULL) {
|
||||
return ((ClientData) NULL);
|
||||
}
|
||||
|
||||
rd = tln->datum;
|
||||
if (Lst_Remove (l, (LstNode)tln) == FAILURE) {
|
||||
return ((ClientData) NIL);
|
||||
return ((ClientData) NULL);
|
||||
} else {
|
||||
return (rd);
|
||||
}
|
||||
|
@ -69,10 +69,10 @@ Lst_Destroy (l, freeProc)
|
||||
register void (*freeProc) __P((ClientData));
|
||||
{
|
||||
register ListNode ln;
|
||||
register ListNode tln = NilListNode;
|
||||
register ListNode tln = NULL;
|
||||
register List list = (List)l;
|
||||
|
||||
if (l == NILLST || ! l) {
|
||||
if (l == NULL || ! l) {
|
||||
/*
|
||||
* Note the check for l == (Lst)0 to catch uninitialized static Lst's.
|
||||
* Gross, but useful.
|
||||
@ -81,21 +81,21 @@ Lst_Destroy (l, freeProc)
|
||||
}
|
||||
|
||||
/* To ease scanning */
|
||||
if (list->lastPtr != NilListNode)
|
||||
list->lastPtr->nextPtr = NilListNode;
|
||||
if (list->lastPtr != NULL)
|
||||
list->lastPtr->nextPtr = NULL;
|
||||
else {
|
||||
free ((Address)l);
|
||||
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 ((Address)ln);
|
||||
}
|
||||
} else {
|
||||
for (ln = list->firstPtr; ln != NilListNode; ln = tln) {
|
||||
for (ln = list->firstPtr; ln != NULL; ln = tln) {
|
||||
tln = ln->nextPtr;
|
||||
free ((Address)ln);
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ __RCSID("$FreeBSD$");
|
||||
* given, the individual client elements will be duplicated as well.
|
||||
*
|
||||
* Results:
|
||||
* The new Lst structure or NILLST if failure.
|
||||
* The new Lst structure or NULL if failure.
|
||||
*
|
||||
* Side Effects:
|
||||
* A new list is created.
|
||||
@ -73,26 +73,26 @@ Lst_Duplicate (l, copyProc)
|
||||
register List 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) {
|
||||
while (ln != NULL) {
|
||||
if (copyProc != NOCOPY) {
|
||||
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;
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ __RCSID("$FreeBSD$");
|
||||
* and the given datum.
|
||||
*
|
||||
* Results:
|
||||
* The found node or NILLNODE if none matches.
|
||||
* The found node or NULL if none matches.
|
||||
*
|
||||
* Side Effects:
|
||||
* None.
|
||||
|
@ -56,7 +56,7 @@ __RCSID("$FreeBSD$");
|
||||
* determine when it has been found.
|
||||
*
|
||||
* Results:
|
||||
* The found node or NILLNODE
|
||||
* The found node or NULL
|
||||
*
|
||||
* Side Effects:
|
||||
* None.
|
||||
@ -74,7 +74,7 @@ Lst_FindFrom (l, ln, d, cProc)
|
||||
Boolean found = FALSE;
|
||||
|
||||
if (!LstValid (l) || LstIsEmpty (l) || !LstNodeValid (ln, l)) {
|
||||
return (NILLNODE);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
tln = (ListNode)ln;
|
||||
@ -86,12 +86,12 @@ Lst_FindFrom (l, ln, d, cProc)
|
||||
} else {
|
||||
tln = tln->nextPtr;
|
||||
}
|
||||
} while (tln != (ListNode)ln && tln != NilListNode);
|
||||
} while (tln != (ListNode)ln && tln != NULL);
|
||||
|
||||
if (found) {
|
||||
return ((LstNode)tln);
|
||||
} else {
|
||||
return (NILLNODE);
|
||||
return (NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ __RCSID("$FreeBSD$");
|
||||
* 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.
|
||||
@ -66,7 +66,7 @@ Lst_First (l)
|
||||
Lst l;
|
||||
{
|
||||
if (!LstValid (l) || LstIsEmpty (l)) {
|
||||
return (NILLNODE);
|
||||
return (NULL);
|
||||
} else {
|
||||
return ((LstNode)((List)l)->firstPtr);
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ Lst_ForEachFrom (l, ln, proc, d)
|
||||
* doesn't exist.
|
||||
*/
|
||||
done = (next == tln->nextPtr &&
|
||||
(next == NilListNode || next == list->firstPtr));
|
||||
(next == NULL || next == list->firstPtr));
|
||||
|
||||
next = tln->nextPtr;
|
||||
|
||||
|
@ -69,8 +69,8 @@ Lst_Init(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;
|
||||
|
@ -77,7 +77,7 @@ Lst_Insert (l, ln, 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)) {
|
||||
@ -90,18 +90,18 @@ Lst_Insert (l, ln, 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;
|
||||
|
@ -61,8 +61,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;
|
||||
@ -77,14 +75,12 @@ typedef struct {
|
||||
*/
|
||||
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'
|
||||
@ -95,18 +91,18 @@ typedef struct {
|
||||
* LstValid (l) --
|
||||
* Return TRUE if the list l is valid
|
||||
*/
|
||||
#define LstValid(l) (((Lst)l == NILLST) ? FALSE : TRUE)
|
||||
#define LstValid(l) (((Lst)l == NULL) ? FALSE : TRUE)
|
||||
|
||||
/*
|
||||
* LstNodeValid (ln, l) --
|
||||
* Return TRUE if the LstNode ln is valid with respect to l
|
||||
*/
|
||||
#define LstNodeValid(ln, l) ((((LstNode)ln) == NILLNODE) ? FALSE : TRUE)
|
||||
#define LstNodeValid(ln, l) ((((LstNode)ln) == NULL) ? FALSE : TRUE)
|
||||
|
||||
/*
|
||||
* 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_ */
|
||||
|
@ -59,8 +59,8 @@ __RCSID("$FreeBSD$");
|
||||
* 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 NULLLIST).
|
||||
*-----------------------------------------------------------------------
|
||||
*/
|
||||
Boolean
|
||||
|
@ -54,7 +54,7 @@ __RCSID("$FreeBSD$");
|
||||
* 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.
|
||||
@ -66,7 +66,7 @@ Lst_Last (l)
|
||||
Lst l;
|
||||
{
|
||||
if (!LstValid(l) || LstIsEmpty (l)) {
|
||||
return (NILLNODE);
|
||||
return (NULL);
|
||||
} else {
|
||||
return ((LstNode)((List)l)->lastPtr);
|
||||
}
|
||||
|
@ -57,8 +57,8 @@ Lst_Member (l, d)
|
||||
register ListNode lNode;
|
||||
|
||||
lNode = list->firstPtr;
|
||||
if (lNode == NilListNode) {
|
||||
return NILLNODE;
|
||||
if (lNode == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
do {
|
||||
@ -66,7 +66,7 @@ Lst_Member (l, d)
|
||||
return (LstNode)lNode;
|
||||
}
|
||||
lNode = lNode->nextPtr;
|
||||
} while (lNode != NilListNode && lNode != list->firstPtr);
|
||||
} while (lNode != NULL && lNode != list->firstPtr);
|
||||
|
||||
return NILLNODE;
|
||||
return NULL;
|
||||
}
|
||||
|
@ -59,8 +59,8 @@ __RCSID("$FreeBSD$");
|
||||
* 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:
|
||||
@ -77,12 +77,12 @@ Lst_Next (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.
|
||||
@ -92,14 +92,14 @@ Lst_Next (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...
|
||||
*/
|
||||
|
@ -62,7 +62,7 @@ __RCSID("$FreeBSD$");
|
||||
* 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.
|
||||
*
|
||||
@ -77,7 +77,7 @@ Lst_Open (l)
|
||||
}
|
||||
((List) l)->isOpen = TRUE;
|
||||
((List) l)->atEnd = LstIsEmpty (l) ? Head : Unknown;
|
||||
((List) l)->curPtr = NilListNode;
|
||||
((List) l)->curPtr = NULL;
|
||||
|
||||
return (SUCCESS);
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ __RCSID("$FreeBSD$");
|
||||
* 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.
|
||||
*
|
||||
@ -79,10 +79,10 @@ Lst_Remove (l, 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;
|
||||
}
|
||||
|
||||
@ -100,12 +100,12 @@ Lst_Remove (l, 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;
|
||||
}
|
||||
}
|
||||
@ -116,7 +116,7 @@ Lst_Remove (l, ln)
|
||||
* this case). The list is, therefore, empty and is marked as such
|
||||
*/
|
||||
if (list->firstPtr == lNode) {
|
||||
list->firstPtr = NilListNode;
|
||||
list->firstPtr = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -66,7 +66,7 @@ Lst_Replace (ln, d)
|
||||
register LstNode ln;
|
||||
ClientData d;
|
||||
{
|
||||
if (ln == NILLNODE) {
|
||||
if (ln == NULL) {
|
||||
return (FAILURE);
|
||||
} else {
|
||||
((ListNode) ln)->datum = d;
|
||||
|
@ -67,8 +67,8 @@ LstNode
|
||||
Lst_Succ (ln)
|
||||
LstNode ln;
|
||||
{
|
||||
if (ln == NILLNODE) {
|
||||
return (NILLNODE);
|
||||
if (ln == NULL) {
|
||||
return (NULL);
|
||||
} else {
|
||||
return ((LstNode) ((ListNode) ln)->nextPtr);
|
||||
}
|
||||
|
@ -701,7 +701,7 @@ main(argc, argv)
|
||||
Targ_Init();
|
||||
Suff_Init();
|
||||
|
||||
DEFAULT = NILGNODE;
|
||||
DEFAULT = NULL;
|
||||
(void)time(&now);
|
||||
|
||||
/*
|
||||
@ -712,7 +712,7 @@ main(argc, 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);
|
||||
|
||||
@ -753,7 +753,7 @@ main(argc, argv)
|
||||
if (Lst_IsEmpty(sysMkPath))
|
||||
Fatal("make: no system rules (%s).", _PATH_DEFSYSMK);
|
||||
ln = Lst_Find(sysMkPath, (ClientData)NULL, ReadMakefile);
|
||||
if (ln != NILLNODE)
|
||||
if (ln != NULL)
|
||||
Fatal("make: cannot open %s.", (char *)Lst_Datum(ln));
|
||||
}
|
||||
|
||||
@ -761,7 +761,7 @@ main(argc, argv)
|
||||
LstNode ln;
|
||||
|
||||
ln = Lst_Find(makefiles, (ClientData)NULL, ReadMakefile);
|
||||
if (ln != NILLNODE)
|
||||
if (ln != NULL)
|
||||
Fatal("make: cannot open %s.", (char *)Lst_Datum(ln));
|
||||
} else if (!ReadMakefile("makefile", NULL))
|
||||
(void)ReadMakefile("Makefile", NULL);
|
||||
@ -826,7 +826,7 @@ main(argc, argv)
|
||||
if (printVars) {
|
||||
LstNode ln;
|
||||
|
||||
for (ln = Lst_First(variables); ln != NILLNODE;
|
||||
for (ln = Lst_First(variables); ln != NULL;
|
||||
ln = Lst_Succ(ln)) {
|
||||
char *value;
|
||||
if (expandVars) {
|
||||
|
@ -340,10 +340,10 @@ Make_HandleUse (cgn, pgn)
|
||||
}
|
||||
|
||||
if (Lst_Open (cgn->children) == SUCCESS) {
|
||||
while ((ln = Lst_Next (cgn->children)) != NILLNODE) {
|
||||
while ((ln = Lst_Next (cgn->children)) != NULL) {
|
||||
gn = (GNode *)Lst_Datum (ln);
|
||||
|
||||
if (Lst_Member (pgn->children, gn) == NILLNODE) {
|
||||
if (Lst_Member (pgn->children, gn) == NULL) {
|
||||
(void) Lst_AtEnd (pgn->children, gn);
|
||||
(void) Lst_AtEnd (gn->parents, pgn);
|
||||
pgn->unmade += 1;
|
||||
@ -480,7 +480,7 @@ Make_Update (cgn)
|
||||
}
|
||||
|
||||
if (Lst_Open (cgn->parents) == SUCCESS) {
|
||||
while ((ln = Lst_Next (cgn->parents)) != NILLNODE) {
|
||||
while ((ln = Lst_Next (cgn->parents)) != NULL) {
|
||||
pgn = (GNode *)Lst_Datum (ln);
|
||||
if (pgn->make) {
|
||||
pgn->unmade -= 1;
|
||||
@ -514,11 +514,11 @@ Make_Update (cgn)
|
||||
* it means we need to place it in the queue as it restrained itself
|
||||
* before.
|
||||
*/
|
||||
for (ln = Lst_First(cgn->successors); ln != NILLNODE; ln = Lst_Succ(ln)) {
|
||||
for (ln = Lst_First(cgn->successors); ln != NULL; ln = Lst_Succ(ln)) {
|
||||
GNode *succ = (GNode *)Lst_Datum(ln);
|
||||
|
||||
if (succ->make && succ->unmade == 0 && succ->made == UNMADE &&
|
||||
Lst_Member(toBeMade, (ClientData)succ) == NILLNODE)
|
||||
Lst_Member(toBeMade, (ClientData)succ) == NULL)
|
||||
{
|
||||
(void)Lst_EnQueue(toBeMade, (ClientData)succ);
|
||||
}
|
||||
@ -532,7 +532,7 @@ Make_Update (cgn)
|
||||
char *p1;
|
||||
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->make) {
|
||||
Var_Set (IMPSRC, cname, pgn);
|
||||
@ -690,7 +690,7 @@ MakeStartJobs ()
|
||||
if (!Lst_IsEmpty(gn->preds)) {
|
||||
LstNode ln;
|
||||
|
||||
for (ln = Lst_First(gn->preds); ln != NILLNODE; ln = Lst_Succ(ln)){
|
||||
for (ln = Lst_First(gn->preds); ln != NULL; ln = Lst_Succ(ln)){
|
||||
GNode *pgn = (GNode *)Lst_Datum(ln);
|
||||
|
||||
if (pgn->make && pgn->made == UNMADE) {
|
||||
@ -701,12 +701,12 @@ MakeStartJobs ()
|
||||
}
|
||||
}
|
||||
/*
|
||||
* If ln isn't nil, there's a predecessor as yet unmade, so we
|
||||
* If ln isn't NULL, there's a predecessor as yet unmade, so we
|
||||
* just drop this node on the floor. When the node in question
|
||||
* has been made, it will notice this node as being ready to
|
||||
* make but as yet unmade and will place the node on the queue.
|
||||
*/
|
||||
if (ln != NILLNODE) {
|
||||
if (ln != NULL) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -163,11 +163,6 @@ typedef struct GNode {
|
||||
* but the Suff module) */
|
||||
} 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
|
||||
@ -230,7 +225,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_CREATE 0x01 /* create node if not found */
|
||||
#define TARG_NOCREATE 0x00 /* don't create it */
|
||||
|
@ -183,7 +183,7 @@ static ParseSpecial specType;
|
||||
static int waiting;
|
||||
|
||||
/*
|
||||
* 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;
|
||||
@ -365,7 +365,7 @@ ParseLinkSrc (pgnp, cgnp)
|
||||
{
|
||||
GNode *pgn = (GNode *) pgnp;
|
||||
GNode *cgn = (GNode *) cgnp;
|
||||
if (Lst_Member (pgn->children, (ClientData)cgn) == NILLNODE) {
|
||||
if (Lst_Member (pgn->children, (ClientData)cgn) == NULL) {
|
||||
(void)Lst_AtEnd (pgn->children, (ClientData)cgn);
|
||||
if (specType == Not) {
|
||||
(void)Lst_AtEnd (cgn->parents, (ClientData)pgn);
|
||||
@ -556,7 +556,7 @@ ParseDoSrc (tOp, src, allsrc)
|
||||
* source and the current one.
|
||||
*/
|
||||
gn = Targ_FindNode(src, TARG_CREATE);
|
||||
if (predecessor != NILGNODE) {
|
||||
if (predecessor != NULL) {
|
||||
(void)Lst_AtEnd(predecessor->successors, (ClientData)gn);
|
||||
(void)Lst_AtEnd(gn->preds, (ClientData)predecessor);
|
||||
}
|
||||
@ -588,7 +588,7 @@ ParseDoSrc (tOp, src, allsrc)
|
||||
register GNode *cohort;
|
||||
register LstNode ln;
|
||||
|
||||
for (ln=Lst_First(gn->cohorts); ln != NILLNODE; ln = Lst_Succ(ln)){
|
||||
for (ln=Lst_First(gn->cohorts); ln != NULL; ln = Lst_Succ(ln)){
|
||||
cohort = (GNode *)Lst_Datum(ln);
|
||||
if (tOp) {
|
||||
cohort->type |= tOp;
|
||||
@ -843,7 +843,7 @@ ParseDoDependency (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:
|
||||
@ -881,7 +881,7 @@ ParseDoDependency (line)
|
||||
compatMake = 1;
|
||||
break;
|
||||
case Order:
|
||||
predecessor = NILGNODE;
|
||||
predecessor = NULL;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -896,7 +896,7 @@ ParseDoDependency (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]);
|
||||
@ -1204,7 +1204,7 @@ ParseDoDependency (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
|
||||
@ -2578,7 +2578,7 @@ Parse_File(name, stream)
|
||||
void
|
||||
Parse_Init ()
|
||||
{
|
||||
mainNode = NILGNODE;
|
||||
mainNode = NULL;
|
||||
parseIncPath = Lst_Init (FALSE);
|
||||
sysIncPath = Lst_Init (FALSE);
|
||||
includes = Lst_Init (FALSE);
|
||||
@ -2618,7 +2618,7 @@ Parse_MainName()
|
||||
|
||||
listmain = Lst_Init (FALSE);
|
||||
|
||||
if (mainNode == NILGNODE) {
|
||||
if (mainNode == NULL) {
|
||||
Punt ("no target to make.");
|
||||
/*NOTREACHED*/
|
||||
} else if (mainNode->type & OP_DOUBLEDEP) {
|
||||
|
@ -87,8 +87,6 @@ typedef int ReturnStatus;
|
||||
* by user processes.
|
||||
*/
|
||||
|
||||
#define NIL ~0
|
||||
#define USER_NIL 0
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif /* NULL */
|
||||
|
@ -90,7 +90,7 @@ __RCSID("$FreeBSD$");
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@ -378,7 +378,7 @@ SuffRemove(l, s)
|
||||
Suff *s;
|
||||
{
|
||||
LstNode ln = Lst_Member(l, (ClientData)s);
|
||||
if (ln != NILLNODE) {
|
||||
if (ln != NULL) {
|
||||
Lst_Remove(l, ln);
|
||||
s->refCount--;
|
||||
}
|
||||
@ -408,7 +408,7 @@ SuffInsert (l, 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;
|
||||
@ -419,7 +419,7 @@ SuffInsert (l, s)
|
||||
if (DEBUG(SUFF)) {
|
||||
printf("inserting %s(%d)...", s->name, s->sNum);
|
||||
}
|
||||
if (ln == NILLNODE) {
|
||||
if (ln == NULL) {
|
||||
if (DEBUG(SUFF)) {
|
||||
printf("at end of list\n");
|
||||
}
|
||||
@ -492,8 +492,8 @@ SuffParseTransform(str, srcPtr, 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
|
||||
@ -502,17 +502,17 @@ SuffParseTransform(str, srcPtr, targPtr)
|
||||
* parsed the string.
|
||||
*/
|
||||
for (;;) {
|
||||
if (srcLn == NILLNODE) {
|
||||
if (srcLn == NULL) {
|
||||
srcLn = Lst_Find(sufflist, (ClientData)str, SuffSuffIsPrefix);
|
||||
} else {
|
||||
srcLn = Lst_FindFrom (sufflist, Lst_Succ(srcLn), (ClientData)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
|
||||
@ -535,7 +535,7 @@ SuffParseTransform(str, srcPtr, targPtr)
|
||||
singleLn = srcLn;
|
||||
} else {
|
||||
targLn = Lst_Find(sufflist, (ClientData)str2, SuffSuffHasNameP);
|
||||
if (targLn != NILLNODE) {
|
||||
if (targLn != NULL) {
|
||||
*srcPtr = src;
|
||||
*targPtr = (Suff *)Lst_Datum(targLn);
|
||||
return (TRUE);
|
||||
@ -591,7 +591,7 @@ Suff_AddTransform (line)
|
||||
LstNode ln; /* Node for existing transformation */
|
||||
|
||||
ln = Lst_Find (transforms, (ClientData)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.
|
||||
@ -667,7 +667,7 @@ Suff_EndTransform(gnp, dummy)
|
||||
|
||||
/*
|
||||
* Remove the source from the target's children list. We check for a
|
||||
* nil return to handle a beanhead saying something like
|
||||
* NULL return to handle a beanhead saying something like
|
||||
* .c.o .c.o:
|
||||
*
|
||||
* We'll be called twice when the next target is seen, but .c and .o
|
||||
@ -722,7 +722,7 @@ SuffRebuildGraph(transformp, sp)
|
||||
cp = SuffStrIsPrefix(s->name, transform->name);
|
||||
if (cp != (char *)NULL) {
|
||||
ln = Lst_Find(sufflist, (ClientData)cp, SuffSuffHasNameP);
|
||||
if (ln != NILLNODE) {
|
||||
if (ln != NULL) {
|
||||
/*
|
||||
* Found target. Link in and return, since it can't be anything
|
||||
* else.
|
||||
@ -748,7 +748,7 @@ SuffRebuildGraph(transformp, 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
|
||||
*/
|
||||
@ -782,7 +782,7 @@ Suff_AddSuffix (str)
|
||||
LstNode ln;
|
||||
|
||||
ln = Lst_Find (sufflist, (ClientData)str, SuffSuffHasNameP);
|
||||
if (ln == NILLNODE) {
|
||||
if (ln == NULL) {
|
||||
s = (Suff *) emalloc (sizeof (Suff));
|
||||
|
||||
s->name = estrdup (str);
|
||||
@ -810,7 +810,7 @@ Suff_AddSuffix (str)
|
||||
* 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:
|
||||
@ -825,8 +825,8 @@ Suff_GetPath (sname)
|
||||
Suff *s;
|
||||
|
||||
ln = Lst_Find (sufflist, (ClientData)sname, SuffSuffHasNameP);
|
||||
if (ln == NILLNODE) {
|
||||
return (NILLST);
|
||||
if (ln == NULL) {
|
||||
return (NULL);
|
||||
} else {
|
||||
s = (Suff *) Lst_Datum (ln);
|
||||
return (s->searchPath);
|
||||
@ -867,7 +867,7 @@ Suff_DoPaths()
|
||||
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
|
||||
@ -921,7 +921,7 @@ Suff_AddInclude (sname)
|
||||
Suff *s;
|
||||
|
||||
ln = Lst_Find (sufflist, (ClientData)sname, SuffSuffHasNameP);
|
||||
if (ln != NILLNODE) {
|
||||
if (ln != NULL) {
|
||||
s = (Suff *) Lst_Datum (ln);
|
||||
s->flags |= SUFF_INCLUDE;
|
||||
}
|
||||
@ -951,7 +951,7 @@ Suff_AddLib (sname)
|
||||
Suff *s;
|
||||
|
||||
ln = Lst_Find (sufflist, (ClientData)sname, SuffSuffHasNameP);
|
||||
if (ln != NILLNODE) {
|
||||
if (ln != NULL) {
|
||||
s = (Suff *) Lst_Datum (ln);
|
||||
s->flags |= SUFF_LIBRARY;
|
||||
}
|
||||
@ -995,7 +995,7 @@ SuffAddSrc (sp, lsp)
|
||||
s2->file = estrdup(targ->pref);
|
||||
s2->pref = targ->pref;
|
||||
s2->parent = targ;
|
||||
s2->node = NILGNODE;
|
||||
s2->node = NULL;
|
||||
s2->suff = s;
|
||||
s->refCount++;
|
||||
s2->children = 0;
|
||||
@ -1013,7 +1013,7 @@ SuffAddSrc (sp, 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;
|
||||
@ -1085,7 +1085,7 @@ SuffRemoveSrc (l)
|
||||
#endif
|
||||
|
||||
|
||||
while ((ln = Lst_Next (l)) != NILLNODE) {
|
||||
while ((ln = Lst_Next (l)) != NULL) {
|
||||
s = (Src *) Lst_Datum (ln);
|
||||
if (s->children == 0) {
|
||||
free ((Address)s->file);
|
||||
@ -1094,7 +1094,7 @@ SuffRemoveSrc (l)
|
||||
else {
|
||||
#ifdef DEBUG_SRC
|
||||
LstNode ln = Lst_Member(s->parent->cp, (ClientData)s);
|
||||
if (ln != NILLNODE)
|
||||
if (ln != NULL)
|
||||
Lst_Remove(s->parent->cp, ln);
|
||||
#endif
|
||||
--s->parent->children;
|
||||
@ -1157,7 +1157,7 @@ SuffFindThem (srcs, 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
|
||||
printf("remove %x from %x\n", s, srcs);
|
||||
#endif
|
||||
@ -1196,7 +1196,7 @@ SuffFindThem (srcs, slst)
|
||||
* a Src structure is put together for it and returned.
|
||||
*
|
||||
* 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.
|
||||
@ -1220,7 +1220,7 @@ SuffFindCmds (targ, slst)
|
||||
(void) Lst_Open (t->children);
|
||||
prefLen = strlen (targ->pref);
|
||||
|
||||
while ((ln = Lst_Next (t->children)) != NILLNODE) {
|
||||
while ((ln = Lst_Next (t->children)) != NULL) {
|
||||
s = (GNode *)Lst_Datum (ln);
|
||||
|
||||
cp = strrchr (s->name, '/');
|
||||
@ -1236,7 +1236,7 @@ SuffFindCmds (targ, slst)
|
||||
*/
|
||||
ln = Lst_Find (sufflist, (ClientData)&cp[prefLen],
|
||||
SuffSuffHasNameP);
|
||||
if (ln != NILLNODE) {
|
||||
if (ln != NULL) {
|
||||
/*
|
||||
* It even has a known suffix, see if there's a transformation
|
||||
* defined between the node's suffix and the target's suffix.
|
||||
@ -1246,7 +1246,7 @@ SuffFindCmds (targ, slst)
|
||||
suff = (Suff *)Lst_Datum (ln);
|
||||
|
||||
if (Lst_Member (suff->parents,
|
||||
(ClientData)targ->suff) != NILLNODE)
|
||||
(ClientData)targ->suff) != NULL)
|
||||
{
|
||||
/*
|
||||
* Hot Damn! Create a new Src structure to describe
|
||||
@ -1416,7 +1416,7 @@ SuffExpandChildren(cgnp, pgnp)
|
||||
if (DEBUG(SUFF)) {
|
||||
printf("%s...", gn->name);
|
||||
}
|
||||
if (Lst_Member(pgn->children, (ClientData)gn) == NILLNODE) {
|
||||
if (Lst_Member(pgn->children, (ClientData)gn) == NULL) {
|
||||
(void)Lst_Append(pgn->children, prevLN, (ClientData)gn);
|
||||
prevLN = Lst_Succ(prevLN);
|
||||
(void)Lst_AtEnd(gn->parents, (ClientData)pgn);
|
||||
@ -1458,7 +1458,7 @@ SuffExpandChildren(cgnp, pgnp)
|
||||
printf("Wildcard expanding \"%s\"...", cgn->name);
|
||||
}
|
||||
|
||||
if (ln != NILLNODE) {
|
||||
if (ln != NULL) {
|
||||
Suff *s = (Suff *)Lst_Datum(ln);
|
||||
|
||||
if (DEBUG(SUFF)) {
|
||||
@ -1493,7 +1493,7 @@ SuffExpandChildren(cgnp, pgnp)
|
||||
* If gn isn't already a child of the parent, make it so and
|
||||
* up the parent's count of unmade children.
|
||||
*/
|
||||
if (Lst_Member(pgn->children, (ClientData)gn) == NILLNODE) {
|
||||
if (Lst_Member(pgn->children, (ClientData)gn) == NULL) {
|
||||
(void)Lst_Append(pgn->children, prevLN, (ClientData)gn);
|
||||
prevLN = Lst_Succ(prevLN);
|
||||
(void)Lst_AtEnd(gn->parents, (ClientData)pgn);
|
||||
@ -1550,7 +1550,7 @@ SuffApplyTransform(tGn, sGn, t, s)
|
||||
char *tname; /* Name of transformation rule */
|
||||
GNode *gn; /* Node for same */
|
||||
|
||||
if (Lst_Member(tGn->children, (ClientData)sGn) == NILLNODE) {
|
||||
if (Lst_Member(tGn->children, (ClientData)sGn) == NULL) {
|
||||
/*
|
||||
* Not already linked, so form the proper links between the
|
||||
* target and source.
|
||||
@ -1567,10 +1567,10 @@ SuffApplyTransform(tGn, sGn, t, s)
|
||||
* sGn gets the target in its iParents list, however, as that
|
||||
* will be sufficient to get the .IMPSRC variable set for tGn
|
||||
*/
|
||||
for (ln=Lst_First(sGn->cohorts); ln != NILLNODE; ln=Lst_Succ(ln)) {
|
||||
for (ln=Lst_First(sGn->cohorts); ln != NULL; ln=Lst_Succ(ln)) {
|
||||
gn = (GNode *)Lst_Datum(ln);
|
||||
|
||||
if (Lst_Member(tGn->children, (ClientData)gn) == NILLNODE) {
|
||||
if (Lst_Member(tGn->children, (ClientData)gn) == NULL) {
|
||||
/*
|
||||
* Not already linked, so form the proper links between the
|
||||
* target and source.
|
||||
@ -1588,7 +1588,7 @@ SuffApplyTransform(tGn, sGn, t, s)
|
||||
ln = Lst_Find(transforms, (ClientData)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
|
||||
@ -1617,7 +1617,7 @@ SuffApplyTransform(tGn, sGn, t, s)
|
||||
* Deal with wildcards and variables in any acquired sources
|
||||
*/
|
||||
ln = Lst_Succ(ln);
|
||||
if (ln != NILLNODE) {
|
||||
if (ln != NULL) {
|
||||
Lst_ForEachFrom(tGn->children, ln,
|
||||
SuffExpandChildren, (ClientData)tGn);
|
||||
}
|
||||
@ -1686,7 +1686,7 @@ SuffFindArchiveDeps(gn, slst)
|
||||
/*
|
||||
* Create the link between the two nodes right off
|
||||
*/
|
||||
if (Lst_Member(gn->children, (ClientData)mem) == NILLNODE) {
|
||||
if (Lst_Member(gn->children, (ClientData)mem) == NULL) {
|
||||
(void)Lst_AtEnd(gn->children, (ClientData)mem);
|
||||
(void)Lst_AtEnd(mem->parents, (ClientData)gn);
|
||||
gn->unmade += 1;
|
||||
@ -1734,7 +1734,7 @@ SuffFindArchiveDeps(gn, slst)
|
||||
*/
|
||||
ln = Lst_Find(ms->parents, eoarch, SuffSuffIsSuffixP);
|
||||
|
||||
if (ln != NILLNODE) {
|
||||
if (ln != NULL) {
|
||||
/*
|
||||
* Got one -- apply it
|
||||
*/
|
||||
@ -1830,13 +1830,13 @@ SuffFindNormalDeps(gn, 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, eoname, SuffSuffIsSuffixP);
|
||||
|
||||
if (ln != NILLNODE) {
|
||||
if (ln != NULL) {
|
||||
int prefLen; /* Length of the prefix */
|
||||
Src *targ;
|
||||
|
||||
@ -2059,7 +2059,7 @@ SuffFindNormalDeps(gn, slst)
|
||||
* up to, but not including, the parent node.
|
||||
*/
|
||||
while (bottom && bottom->parent != NULL) {
|
||||
if (Lst_Member(slst, (ClientData) bottom) == NILLNODE) {
|
||||
if (Lst_Member(slst, (ClientData) bottom) == NULL) {
|
||||
Lst_AtEnd(slst, (ClientData) bottom);
|
||||
}
|
||||
bottom = bottom->parent;
|
||||
@ -2087,7 +2087,7 @@ SuffFindNormalDeps(gn, slst)
|
||||
* 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);
|
||||
}
|
||||
|
||||
@ -2099,7 +2099,7 @@ SuffFindNormalDeps(gn, slst)
|
||||
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);
|
||||
}
|
||||
|
||||
@ -2141,7 +2141,7 @@ SuffFindNormalDeps(gn, slst)
|
||||
*/
|
||||
sfnd_return:
|
||||
if (bottom)
|
||||
if (Lst_Member(slst, (ClientData) bottom) == NILLNODE)
|
||||
if (Lst_Member(slst, (ClientData) bottom) == NULL)
|
||||
Lst_AtEnd(slst, (ClientData) bottom);
|
||||
|
||||
while (SuffRemoveSrc(srcs) || SuffRemoveSrc(targs))
|
||||
@ -2226,7 +2226,7 @@ SuffFindDeps (gn, slst)
|
||||
ln = Lst_Find (sufflist, (ClientData)LIBSUFF, 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);
|
||||
@ -2270,7 +2270,7 @@ Suff_SetNull(name)
|
||||
LstNode ln;
|
||||
|
||||
ln = Lst_Find(sufflist, (ClientData)name, SuffSuffHasNameP);
|
||||
if (ln != NILLNODE) {
|
||||
if (ln != NULL) {
|
||||
s = (Suff *)Lst_Datum(ln);
|
||||
if (suffNull != (Suff *)NULL) {
|
||||
suffNull->flags &= ~SUFF_NULL;
|
||||
|
@ -231,7 +231,7 @@ TargFreeGN (gnp)
|
||||
* Find a node in the list using the given name for matching
|
||||
*
|
||||
* 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
|
||||
*
|
||||
@ -263,7 +263,7 @@ Targ_FindNode (name, flags)
|
||||
}
|
||||
|
||||
if (he == (Hash_Entry *) NULL) {
|
||||
return (NILGNODE);
|
||||
return (NULL);
|
||||
} else {
|
||||
return ((GNode *) Hash_GetValue (he));
|
||||
}
|
||||
@ -300,10 +300,10 @@ Targ_FindList (names, 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
|
||||
|
@ -221,7 +221,7 @@ VarCmp (v, name)
|
||||
*
|
||||
* 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
|
||||
@ -283,7 +283,7 @@ VarFind (name, ctxt, flags)
|
||||
* the -E flag to use environment-variable-override for.
|
||||
*/
|
||||
if (Lst_Find (envFirstVars, (ClientData)name,
|
||||
(int (*)(ClientData, ClientData)) strcmp) != NILLNODE)
|
||||
(int (*)(ClientData, ClientData)) strcmp) != NULL)
|
||||
{
|
||||
localCheckEnvFirst = TRUE;
|
||||
} else {
|
||||
@ -297,15 +297,15 @@ VarFind (name, ctxt, flags)
|
||||
*/
|
||||
var = Lst_Find (ctxt->context, (ClientData)name, VarCmp);
|
||||
|
||||
if ((var == NILLNODE) && (flags & FIND_CMD) && (ctxt != VAR_CMD)) {
|
||||
if ((var == NULL) && (flags & FIND_CMD) && (ctxt != VAR_CMD)) {
|
||||
var = Lst_Find (VAR_CMD->context, (ClientData)name, VarCmp);
|
||||
}
|
||||
if ((var == NILLNODE) && (flags & FIND_GLOBAL) && (ctxt != VAR_GLOBAL) &&
|
||||
if ((var == NULL) && (flags & FIND_GLOBAL) && (ctxt != VAR_GLOBAL) &&
|
||||
!checkEnvFirst && !localCheckEnvFirst)
|
||||
{
|
||||
var = Lst_Find (VAR_GLOBAL->context, (ClientData)name, VarCmp);
|
||||
}
|
||||
if ((var == NILLNODE) && (flags & FIND_ENV)) {
|
||||
if ((var == NULL) && (flags & FIND_ENV)) {
|
||||
char *env;
|
||||
|
||||
if ((env = getenv (name)) != NULL) {
|
||||
@ -325,16 +325,16 @@ VarFind (name, ctxt, flags)
|
||||
(flags & FIND_GLOBAL) && (ctxt != VAR_GLOBAL))
|
||||
{
|
||||
var = Lst_Find (VAR_GLOBAL->context, (ClientData)name, VarCmp);
|
||||
if (var == NILLNODE) {
|
||||
return ((Var *) NIL);
|
||||
if (var == NULL) {
|
||||
return ((Var *) NULL);
|
||||
} else {
|
||||
return ((Var *)Lst_Datum(var));
|
||||
}
|
||||
} else {
|
||||
return((Var *)NIL);
|
||||
return((Var *)NULL);
|
||||
}
|
||||
} else if (var == NILLNODE) {
|
||||
return ((Var *) NIL);
|
||||
} else if (var == NULL) {
|
||||
return ((Var *) NULL);
|
||||
} else {
|
||||
return ((Var *) Lst_Datum (var));
|
||||
}
|
||||
@ -429,7 +429,7 @@ Var_Delete(name, ctxt)
|
||||
printf("%s:delete %s\n", ctxt->name, name);
|
||||
}
|
||||
ln = Lst_Find(ctxt->context, (ClientData)name, VarCmp);
|
||||
if (ln != NILLNODE) {
|
||||
if (ln != NULL) {
|
||||
register Var *v;
|
||||
|
||||
v = (Var *)Lst_Datum(ln);
|
||||
@ -475,7 +475,7 @@ Var_Set (name, val, ctxt)
|
||||
* point in searching them all just to save a bit of memory...
|
||||
*/
|
||||
v = VarFind (name, ctxt, 0);
|
||||
if (v == (Var *) NIL) {
|
||||
if (v == (Var *) NULL) {
|
||||
VarAdd (name, val, ctxt);
|
||||
} else {
|
||||
Buf_Discard(v->val, Buf_Size(v->val));
|
||||
@ -526,7 +526,7 @@ Var_Append (name, val, ctxt)
|
||||
|
||||
v = VarFind (name, ctxt, (ctxt == VAR_GLOBAL) ? FIND_ENV : 0);
|
||||
|
||||
if (v == (Var *) NIL) {
|
||||
if (v == (Var *) NULL) {
|
||||
VarAdd (name, val, ctxt);
|
||||
} else {
|
||||
Buf_AddByte(v->val, (Byte)' ');
|
||||
@ -572,7 +572,7 @@ Var_Exists(name, ctxt)
|
||||
|
||||
v = VarFind(name, ctxt, FIND_CMD|FIND_GLOBAL|FIND_ENV);
|
||||
|
||||
if (v == (Var *)NIL) {
|
||||
if (v == (Var *)NULL) {
|
||||
return(FALSE);
|
||||
} else if (v->flags & VAR_FROM_ENV) {
|
||||
free(v->name);
|
||||
@ -604,7 +604,7 @@ Var_Value (name, ctxt, frp)
|
||||
|
||||
v = VarFind (name, ctxt, FIND_ENV | FIND_GLOBAL | FIND_CMD);
|
||||
*frp = NULL;
|
||||
if (v != (Var *) NIL) {
|
||||
if (v != (Var *) NULL) {
|
||||
char *p = ((char *)Buf_GetAll(v->val, (int *)NULL));
|
||||
if (v->flags & VAR_FROM_ENV) {
|
||||
Buf_Destroy(v->val, FALSE);
|
||||
@ -1494,7 +1494,7 @@ Var_Parse (str, ctxt, err, lengthPtr, freePtr)
|
||||
name[1] = '\0';
|
||||
|
||||
v = VarFind (name, ctxt, FIND_ENV | FIND_GLOBAL | FIND_CMD);
|
||||
if (v == (Var *)NIL) {
|
||||
if (v == (Var *)NULL) {
|
||||
*lengthPtr = 2;
|
||||
|
||||
if ((ctxt == VAR_CMD) || (ctxt == VAR_GLOBAL)) {
|
||||
@ -1574,7 +1574,7 @@ Var_Parse (str, ctxt, err, lengthPtr, freePtr)
|
||||
vlen = strlen(str);
|
||||
|
||||
v = VarFind (str, ctxt, FIND_ENV | FIND_GLOBAL | FIND_CMD);
|
||||
if ((v == (Var *)NIL) && (ctxt != VAR_CMD) && (ctxt != VAR_GLOBAL) &&
|
||||
if ((v == (Var *)NULL) && (ctxt != VAR_CMD) && (ctxt != VAR_GLOBAL) &&
|
||||
(vlen == 2) && (str[1] == 'F' || str[1] == 'D'))
|
||||
{
|
||||
/*
|
||||
@ -1599,7 +1599,7 @@ Var_Parse (str, ctxt, err, lengthPtr, freePtr)
|
||||
vname[1] = '\0';
|
||||
v = VarFind(vname, ctxt, 0);
|
||||
|
||||
if (v != (Var *)NIL) {
|
||||
if (v != (Var *)NULL) {
|
||||
/*
|
||||
* No need for nested expansion or anything, as we're
|
||||
* the only one who sets these things and we sure don't
|
||||
@ -1627,7 +1627,7 @@ Var_Parse (str, ctxt, err, lengthPtr, freePtr)
|
||||
}
|
||||
}
|
||||
|
||||
if (v == (Var *)NIL) {
|
||||
if (v == (Var *)NULL) {
|
||||
if (((vlen == 1) ||
|
||||
(((vlen == 2) && (str[1] == 'F' ||
|
||||
str[1] == 'D')))) &&
|
||||
|
Loading…
Reference in New Issue
Block a user