Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make make(1): convert Arch_ParseArchive from ReturnS...



details:   https://anonhg.NetBSD.org/src/rev/019b650d11b6
branches:  trunk
changeset: 937805:019b650d11b6
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Aug 27 06:13:53 2020 +0000

description:
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.

diffstat:

 usr.bin/make/arch.c    |  28 ++++++++++++++--------------
 usr.bin/make/nonints.h |   4 ++--
 usr.bin/make/parse.c   |  10 +++++-----
 3 files changed, 21 insertions(+), 21 deletions(-)

diffs (182 lines):

diff -r 3e1fa424bc0a -r 019b650d11b6 usr.bin/make/arch.c
--- a/usr.bin/make/arch.c       Thu Aug 27 04:54:43 2020 +0000
+++ b/usr.bin/make/arch.c       Thu Aug 27 06:13:53 2020 +0000
@@ -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 @@
  *     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 @@
  *
  *-----------------------------------------------------------------------
  */
-ReturnStatus
+Boolean
 Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode *ctxt)
 {
     char           *cp;            /* Pointer into line */
@@ -264,7 +264,7 @@
            free(freeIt);
 
            if (result == var_Error) {
-               return FAILURE;
+               return FALSE;
            } else {
                subLibName = TRUE;
            }
@@ -306,7 +306,7 @@
                free(freeIt);
 
                if (result == var_Error) {
-                   return FAILURE;
+                   return FALSE;
                } else {
                    doSubst = TRUE;
                }
@@ -324,7 +324,7 @@
         */
        if (*cp == '\0') {
            printf("No closing parenthesis in archive specification\n");
-           return FAILURE;
+           return FALSE;
        }
 
        /*
@@ -373,18 +373,18 @@
 
                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 @@
                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 @@
            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 @@
     } while (*cp != '\0' && isspace ((unsigned char)*cp));
 
     *linePtr = cp;
-    return SUCCESS;
+    return TRUE;
 }
 
 /*-
diff -r 3e1fa424bc0a -r 019b650d11b6 usr.bin/make/nonints.h
--- a/usr.bin/make/nonints.h    Thu Aug 27 04:54:43 2020 +0000
+++ b/usr.bin/make/nonints.h    Thu Aug 27 06:13:53 2020 +0000
@@ -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 *);
diff -r 3e1fa424bc0a -r 019b650d11b6 usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Thu Aug 27 04:54:43 2020 +0000
+++ b/usr.bin/make/parse.c      Thu Aug 27 06:13:53 2020 +0000
@@ -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 @@
             * 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 @@
 
            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;



Home | Main Index | Thread Index | Old Index