Module Name: src Committed By: rillig Date: Thu Aug 27 06:13:53 UTC 2020
Modified Files: src/usr.bin/make: arch.c nonints.h parse.c Log Message: make(1): convert Arch_ParseArchive from ReturnStatus to Boolean There are only few functions left that use the ReturnStatus. These will be converted as well, to get rid of the additional typedef. To generate a diff of this commit: cvs rdiff -u -r1.97 -r1.98 src/usr.bin/make/arch.c cvs rdiff -u -r1.98 -r1.99 src/usr.bin/make/nonints.h cvs rdiff -u -r1.263 -r1.264 src/usr.bin/make/parse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/make/arch.c diff -u src/usr.bin/make/arch.c:1.97 src/usr.bin/make/arch.c:1.98 --- src/usr.bin/make/arch.c:1.97 Wed Aug 26 22:55:46 2020 +++ src/usr.bin/make/arch.c Thu Aug 27 06:13:53 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: arch.c,v 1.97 2020/08/26 22:55:46 rillig Exp $ */ +/* $NetBSD: arch.c,v 1.98 2020/08/27 06:13:53 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: arch.c,v 1.97 2020/08/26 22:55:46 rillig Exp $"; +static char rcsid[] = "$NetBSD: arch.c,v 1.98 2020/08/27 06:13:53 rillig 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.97 2020/08/26 22:55:46 rillig Exp $"); +__RCSID("$NetBSD: arch.c,v 1.98 2020/08/27 06:13:53 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -225,7 +225,7 @@ ArchFree(void *ap) * ctxt Context 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. * @@ -234,7 +234,7 @@ ArchFree(void *ap) * *----------------------------------------------------------------------- */ -ReturnStatus +Boolean Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode *ctxt) { char *cp; /* Pointer into line */ @@ -264,7 +264,7 @@ Arch_ParseArchive(char **linePtr, Lst no free(freeIt); if (result == var_Error) { - return FAILURE; + return FALSE; } else { subLibName = TRUE; } @@ -306,7 +306,7 @@ Arch_ParseArchive(char **linePtr, Lst no free(freeIt); if (result == var_Error) { - return FAILURE; + return FALSE; } else { doSubst = TRUE; } @@ -324,7 +324,7 @@ Arch_ParseArchive(char **linePtr, Lst no */ if (*cp == '\0') { printf("No closing parenthesis in archive specification\n"); - return FAILURE; + return FALSE; } /* @@ -373,18 +373,18 @@ Arch_ParseArchive(char **linePtr, Lst no if (gn == NULL) { free(buf); - return FAILURE; + return FALSE; } else { gn->type |= OP_ARCHV; Lst_AppendS(nodeLst, 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. */ free(buf); - return FAILURE; + return FALSE; } /* * Free buffer and continue with our work. @@ -409,7 +409,7 @@ Arch_ParseArchive(char **linePtr, Lst no gn = Targ_FindNode(Buf_GetAll(&nameBuf, NULL), TARG_CREATE); if (gn == NULL) { Buf_Destroy(&nameBuf, TRUE); - return FAILURE; + return FALSE; } else { /* * We've found the node, but have to make sure the rest of @@ -436,7 +436,7 @@ Arch_ParseArchive(char **linePtr, Lst no gn = Targ_FindNode(Buf_GetAll(&nameBuf, NULL), TARG_CREATE); Buf_Destroy(&nameBuf, TRUE); if (gn == NULL) { - return FAILURE; + return FALSE; } else { /* * We've found the node, but have to make sure the rest of the @@ -473,7 +473,7 @@ Arch_ParseArchive(char **linePtr, Lst no } while (*cp != '\0' && isspace ((unsigned char)*cp)); *linePtr = cp; - return SUCCESS; + return TRUE; } /*- Index: src/usr.bin/make/nonints.h diff -u src/usr.bin/make/nonints.h:1.98 src/usr.bin/make/nonints.h:1.99 --- src/usr.bin/make/nonints.h:1.98 Sun Aug 23 18:26:35 2020 +++ src/usr.bin/make/nonints.h Thu Aug 27 06:13:53 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: nonints.h,v 1.98 2020/08/23 18:26:35 rillig Exp $ */ +/* $NetBSD: nonints.h,v 1.99 2020/08/27 06:13:53 rillig Exp $ */ /*- * Copyright (c) 1988, 1989, 1990, 1993 @@ -73,7 +73,7 @@ */ /* arch.c */ -ReturnStatus Arch_ParseArchive(char **, Lst, GNode *); +Boolean Arch_ParseArchive(char **, Lst, GNode *); void Arch_Touch(GNode *); void Arch_TouchLib(GNode *); time_t Arch_MTime(GNode *); Index: src/usr.bin/make/parse.c diff -u src/usr.bin/make/parse.c:1.263 src/usr.bin/make/parse.c:1.264 --- src/usr.bin/make/parse.c:1.263 Wed Aug 26 22:55:46 2020 +++ src/usr.bin/make/parse.c Thu Aug 27 06:13:53 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.263 2020/08/26 22:55:46 rillig Exp $ */ +/* $NetBSD: parse.c,v 1.264 2020/08/27 06:13:53 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: parse.c,v 1.263 2020/08/26 22:55:46 rillig Exp $"; +static char rcsid[] = "$NetBSD: parse.c,v 1.264 2020/08/27 06:13:53 rillig 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.263 2020/08/26 22:55:46 rillig Exp $"); +__RCSID("$NetBSD: parse.c,v 1.264 2020/08/27 06:13:53 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -1254,7 +1254,7 @@ ParseDoDependency(char *line) * went well and FAILURE 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); goto out; @@ -1713,7 +1713,7 @@ ParseDoDependency(char *line) if (*cp == LPAREN) { sources = Lst_Init(); - 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); goto out;