Get rid of the ReturnStatus obscuration that was anyway used only

in two places. While here don't bother returning anything from
Lst_Replace - nobody ever checks the return code.

Suggested by:	jmallet
This commit is contained in:
Hartmut Brandt 2005-05-18 06:50:39 +00:00
parent 7caeec6a13
commit 485aef42c9
8 changed files with 32 additions and 45 deletions

View File

@ -54,7 +54,7 @@ __FBSDID("$FreeBSD$");
* The interface to this module is:
* Arch_ParseArchive Given an archive specification, return a list
* of GNode's, one for each member in the spec.
* FAILURE is returned if the specification is
* FALSE is returned if the specification is
* invalid for some reason.
*
* Arch_Touch Alter the modification time of the archive
@ -200,7 +200,7 @@ Boolean arch_fatal = TRUE;
* in which to expand variables.
*
* Results:
* SUCCESS if it was a valid specification. The linePtr is updated
* TRUE if it was a valid specification. The linePtr is updated
* to point to the first non-space after the archive spec. The
* nodes for the members are placed on the given list.
*
@ -209,7 +209,7 @@ Boolean arch_fatal = TRUE;
*
*-----------------------------------------------------------------------
*/
ReturnStatus
Boolean
Arch_ParseArchive(char **linePtr, Lst *nodeLst, GNode *ctxt)
{
char *cp; /* Pointer into line */
@ -237,7 +237,7 @@ Arch_ParseArchive(char **linePtr, Lst *nodeLst, GNode *ctxt)
result = Var_Parse(cp, ctxt, TRUE, &length, &freeIt);
if (result == var_Error) {
return (FAILURE);
return (FALSE);
}
subLibName = TRUE;
@ -286,7 +286,7 @@ Arch_ParseArchive(char **linePtr, Lst *nodeLst, GNode *ctxt)
result = Var_Parse(cp, ctxt, TRUE,
&length, &freeIt);
if (result == var_Error) {
return (FAILURE);
return (FALSE);
}
doSubst = TRUE;
@ -308,7 +308,7 @@ Arch_ParseArchive(char **linePtr, Lst *nodeLst, GNode *ctxt)
if (*cp == '\0') {
printf("No closing parenthesis in archive "
"specification\n");
return (FAILURE);
return (FALSE);
}
/*
@ -370,19 +370,19 @@ Arch_ParseArchive(char **linePtr, Lst *nodeLst, GNode *ctxt)
if (gn == NULL) {
free(buf);
Buf_Destroy(buf1, FALSE);
return (FAILURE);
return (FALSE);
}
gn->type |= OP_ARCHV;
Lst_AtEnd(nodeLst, (void *)gn);
} else if (Arch_ParseArchive(&sacrifice, nodeLst,
ctxt) != SUCCESS) {
} else if (!Arch_ParseArchive(&sacrifice, nodeLst,
ctxt)) {
/*
* Error in nested call -- free buffer and
* return FAILURE ourselves.
* return FALSE ourselves.
*/
free(buf);
Buf_Destroy(buf1, FALSE);
return (FAILURE);
return (FALSE);
}
/* Free buffer and continue with our work. */
@ -413,7 +413,7 @@ Arch_ParseArchive(char **linePtr, Lst *nodeLst, GNode *ctxt)
if (gn == NULL) {
free(nameBuf);
/* XXXHB Lst_Destroy(&members) */
return (FAILURE);
return (FALSE);
}
/*
* We've found the node, but have to make sure
@ -435,7 +435,7 @@ Arch_ParseArchive(char **linePtr, Lst *nodeLst, GNode *ctxt)
gn = Targ_FindNode(nameBuf, TARG_CREATE);
free(nameBuf);
if (gn == NULL) {
return (FAILURE);
return (FALSE);
}
/*
* We've found the node, but have to make sure the
@ -471,7 +471,7 @@ Arch_ParseArchive(char **linePtr, Lst *nodeLst, GNode *ctxt)
} while (*cp != '\0' && isspace((unsigned char)*cp));
*linePtr = cp;
return (SUCCESS);
return (TRUE);
}
/*

View File

@ -50,7 +50,7 @@ struct Path;
/* archive errors are fatal */
extern Boolean arch_fatal;
ReturnStatus Arch_ParseArchive(char **, struct Lst *, struct GNode *);
Boolean Arch_ParseArchive(char **, struct Lst *, struct GNode *);
void Arch_Touch(struct GNode *);
void Arch_TouchLib(struct GNode *);
int Arch_MTime(struct GNode *);

View File

@ -77,7 +77,7 @@ __FBSDID("$FreeBSD$");
* Job_Empty Return TRUE if the job table is completely empty.
*
* Job_ParseShell Given the line following a .SHELL target, parse the
* line as a shell specification. Returns FAILURE if the
* line as a shell specification. Returns FALSE if the
* spec was incorrect.
*
* Job_Finish Perform any final processing which needs doing. This
@ -2860,7 +2860,7 @@ JobMatchShell(const char *name)
* and shellName appropriately.
*
* Results:
* FAILURE if the specification was incorrect.
* TRUE if the specification was correct. FALSE otherwise.
*
* Side Effects:
* commandShell points to a Shell structure (either predefined or
@ -2894,7 +2894,7 @@ JobMatchShell(const char *name)
* command so as to ignore any errors it returns if
* hasErrCtl is FALSE.
*/
ReturnStatus
Boolean
Job_ParseShell(char *line)
{
char **words;
@ -2929,7 +2929,7 @@ Job_ParseShell(char *line)
if ((eq = strchr(*argv, '=')) == NULL) {
Parse_Error(PARSE_FATAL, "missing '=' in shell "
"specification keyword '%s'", *argv);
return (FAILURE);
return (FALSE);
}
*eq++ = '\0';
@ -2965,7 +2965,7 @@ Job_ParseShell(char *line)
} else {
Parse_Error(PARSE_FATAL, "unknown keyword in shell "
"specification '%s'", *argv);
return (FAILURE);
return (FALSE);
}
}
@ -2991,12 +2991,12 @@ Job_ParseShell(char *line)
if (newShell.name == NULL) {
Parse_Error(PARSE_FATAL,
"Neither path nor name specified");
return (FAILURE);
return (FALSE);
}
if ((sh = JobMatchShell(newShell.name)) == NULL) {
Parse_Error(PARSE_FATAL, "%s: no matching shell",
newShell.name);
return (FAILURE);
return (FALSE);
}
} else {
@ -3022,7 +3022,7 @@ Job_ParseShell(char *line)
Parse_Error(PARSE_FATAL,
"%s: no matching shell", newShell.name);
free(path);
return (FAILURE);
return (FALSE);
}
} else {
sh = JobCopyShell(&newShell);
@ -3037,7 +3037,7 @@ Job_ParseShell(char *line)
shellName = commandShell->name;
return (SUCCESS);
return (TRUE);
}
/**

View File

@ -64,7 +64,7 @@ void Job_Make(struct GNode *);
void Job_Init(int);
Boolean Job_Full(void);
Boolean Job_Empty(void);
ReturnStatus Job_ParseShell(char *);
Boolean Job_ParseShell(char *);
int Job_Finish(void);
void Job_Wait(void);
void Job_AbortAll(void);

View File

@ -92,9 +92,6 @@ Lst_Append(Lst *list, LstNode *ln, void *d)
* If the elements should be duplicated to avoid confusion with another
* list, the Lst_Duplicate function should be called first.
*
* Results:
* SUCCESS if all went well. FAILURE otherwise.
*
* Arguments:
* list1 The list to which list2 is to be appended
* list2 The list to append to list1
@ -315,9 +312,6 @@ Lst_Member(Lst *list, void *d)
* Lst_Remove
* Remove the given node from the given list.
*
* Results:
* SUCCESS or FAILURE.
*
* Side Effects:
* 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

View File

@ -113,8 +113,7 @@ void Lst_Append(Lst *, LstNode *, void *);
/* Remove an element */
void Lst_Remove(Lst *, LstNode *);
/* Replace a node with a new value */
#define Lst_Replace(NODE, D) (((NODE) == NULL) ? FAILURE : \
(((NODE)->datum = (D)), SUCCESS))
#define Lst_Replace(NODE, D) ((void)((NODE)->datum = (D)))
/* Concatenate two lists */
void Lst_Concat(Lst *, Lst *, int);

View File

@ -774,13 +774,12 @@ ParseDoDependency(char *line)
* file2.o file3.o)" are permissible. Arch_ParseArchive
* will set 'line' to be the first non-blank after the
* archive-spec. It creates/finds nodes for the members
* and places them on the given list, returning SUCCESS
* if all went well and FAILURE if there was an error in
* and places them on the given list, returning TRUE
* if all went well and FALSE if there was an error in
* the specification. On error, line should remain
* untouched.
*/
if (Arch_ParseArchive(&line, &targets, VAR_CMD) !=
SUCCESS) {
if (!Arch_ParseArchive(&line, &targets, VAR_CMD)) {
Parse_Error(PARSE_FATAL,
"Error in archive specification: \"%s\"",
line);
@ -1089,7 +1088,7 @@ ParseDoDependency(char *line)
*line = '\0';
} else if (specType == ExShell) {
if (Job_ParseShell(line) != SUCCESS) {
if (!Job_ParseShell(line)) {
Parse_Error(PARSE_FATAL,
"improper shell specification");
return;
@ -1204,8 +1203,8 @@ ParseDoDependency(char *line)
/* list of archive source names after exp. */
Lst sources = Lst_Initializer(sources);
if (Arch_ParseArchive(&line, &sources,
VAR_CMD) != SUCCESS) {
if (!Arch_ParseArchive(&line, &sources,
VAR_CMD)) {
Parse_Error(PARSE_FATAL, "Error in "
"source archive spec \"%s\"", line);
return;

View File

@ -55,11 +55,6 @@ typedef int Boolean;
#define FALSE 0
#endif /* TRUE */
typedef int ReturnStatus;
#define SUCCESS 0
#define FAILURE 1
#define CONCAT(a,b) a##b
struct flag2str {