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): rename local list functions



details:   https://anonhg.NetBSD.org/src/rev/0e07e2a86a13
branches:  trunk
changeset: 942903:0e07e2a86a13
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Aug 22 07:26:34 2020 +0000

description:
make(1): rename local list functions

Since the name of LstIsValid and LstNodeIsValid now matches exactly the
comment, the comment is not needed anymore.

diffstat:

 usr.bin/make/lst.c |  57 ++++++++++++++++++++++++-----------------------------
 1 files changed, 26 insertions(+), 31 deletions(-)

diffs (210 lines):

diff -r 7ea32906ffc8 -r 0e07e2a86a13 usr.bin/make/lst.c
--- a/usr.bin/make/lst.c        Sat Aug 22 07:24:40 2020 +0000
+++ b/usr.bin/make/lst.c        Sat Aug 22 07:26:34 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.c,v 1.19 2020/08/22 00:13:16 rillig Exp $ */
+/* $NetBSD: lst.c,v 1.20 2020/08/22 07:26:34 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -37,11 +37,11 @@
 #include "make.h"
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: lst.c,v 1.19 2020/08/22 00:13:16 rillig Exp $";
+static char rcsid[] = "$NetBSD: lst.c,v 1.20 2020/08/22 07:26:34 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: lst.c,v 1.19 2020/08/22 00:13:16 rillig Exp $");
+__RCSID("$NetBSD: lst.c,v 1.20 2020/08/22 07:26:34 rillig Exp $");
 #endif /* not lint */
 #endif
 
@@ -62,27 +62,23 @@
 struct List {
     LstNode first;             /* first node in list */
     LstNode last;              /* last node in list */
-/*
- * fields for sequential access
- */
+
+    /* fields for sequential access */
     Where lastAccess;          /* Where in the list the last access was */
     Boolean isOpen;            /* true if list has been Lst_Open'ed */
     LstNode curr;              /* current node, if open. NULL if
                                 * *just* opened */
-    LstNode prev;              /* Previous node, if open. Used by
-                                * Lst_Remove */
+    LstNode prev;              /* Previous node, if open. Used by Lst_Remove */
 };
 
-/* Return TRUE if the list is valid. */
 static Boolean
-LstValid(Lst list)
+LstIsValid(Lst list)
 {
     return list != NULL;
 }
 
-/* Return TRUE if the list node is valid. */
 static Boolean
-LstNodeValid(LstNode node)
+LstNodeIsValid(LstNode node)
 {
     return node != NULL;
 }
@@ -99,7 +95,6 @@
     return node;
 }
 
-/* Return TRUE if the list is empty. */
 static Boolean
 LstIsEmpty(Lst list)
 {
@@ -130,7 +125,7 @@
     Lst newList;
     LstNode node;
 
-    if (!LstValid(list)) {
+    if (!LstIsValid(list)) {
        return NULL;
     }
 
@@ -201,10 +196,10 @@
     /*
      * check validity of arguments
      */
-    if (LstValid(list) && (LstIsEmpty(list) && node == NULL))
+    if (LstIsValid(list) && (LstIsEmpty(list) && node == NULL))
        goto ok;
 
-    if (!LstValid(list) || LstIsEmpty(list) || !LstNodeValid(node)) {
+    if (!LstIsValid(list) || LstIsEmpty(list) || !LstNodeIsValid(node)) {
        return FAILURE;
     }
 
@@ -238,11 +233,11 @@
 {
     LstNode newNode;
 
-    if (LstValid(list) && (node == NULL && LstIsEmpty(list))) {
+    if (LstIsValid(list) && (node == NULL && LstIsEmpty(list))) {
        goto ok;
     }
 
-    if (!LstValid(list) || LstIsEmpty(list) || !LstNodeValid(node)) {
+    if (!LstIsValid(list) || LstIsEmpty(list) || !LstNodeIsValid(node)) {
        return FAILURE;
     }
     ok:
@@ -290,8 +285,8 @@
 void
 Lst_RemoveS(Lst list, LstNode node)
 {
-    assert(LstValid(list));
-    assert(LstNodeValid(node));
+    assert(LstIsValid(list));
+    assert(LstNodeIsValid(node));
 
     /*
      * unlink it from the list
@@ -355,7 +350,7 @@
 LstNode
 Lst_First(Lst list)
 {
-    if (!LstValid(list) || LstIsEmpty(list)) {
+    if (!LstIsValid(list) || LstIsEmpty(list)) {
        return NULL;
     } else {
        return list->first;
@@ -367,7 +362,7 @@
 LstNode
 Lst_Last(Lst list)
 {
-    if (!LstValid(list) || LstIsEmpty(list)) {
+    if (!LstIsValid(list) || LstIsEmpty(list)) {
        return NULL;
     } else {
        return list->last;
@@ -416,7 +411,7 @@
 Boolean
 Lst_IsEmpty(Lst list)
 {
-    return !LstValid(list) || LstIsEmpty(list);
+    return !LstIsValid(list) || LstIsEmpty(list);
 }
 
 /* Return the first node from the given list for which the given comparison
@@ -436,7 +431,7 @@
 {
     LstNode tln;
 
-    if (!LstValid(list) || LstIsEmpty(list) || !LstNodeValid(node)) {
+    if (!LstIsValid(list) || LstIsEmpty(list) || !LstNodeIsValid(node)) {
        return NULL;
     }
 
@@ -496,7 +491,7 @@
     Boolean done;
     int result;
 
-    if (!LstValid(list) || LstIsEmpty(list)) {
+    if (!LstIsValid(list) || LstIsEmpty(list)) {
        return 0;
     }
 
@@ -561,7 +556,7 @@
     LstNode last;      /* the last element in the list.
                         * Keeps bookkeeping until the end */
 
-    if (!LstValid(list1) || !LstValid(list2)) {
+    if (!LstIsValid(list1) || !LstIsValid(list2)) {
        return FAILURE;
     }
 
@@ -639,7 +634,7 @@
 ReturnStatus
 Lst_Open(Lst list)
 {
-    if (!LstValid(list)) {
+    if (!LstIsValid(list)) {
        return FAILURE;
     }
     Lst_OpenS(list);
@@ -651,7 +646,7 @@
 void
 Lst_OpenS(Lst list)
 {
-    assert(LstValid(list));
+    assert(LstIsValid(list));
 #if 0
     /* XXX: This assertion fails for NetBSD's "build.sh -j1 tools", somewhere
      * between "dependall ===> compat" and "dependall ===> binstall".
@@ -673,7 +668,7 @@
 {
     LstNode node;
 
-    assert(LstValid(list));
+    assert(LstIsValid(list));
     assert(list->isOpen);
 
     list->prev = list->curr;
@@ -715,7 +710,7 @@
 void
 Lst_CloseS(Lst list)
 {
-    assert(LstValid(list));
+    assert(LstIsValid(list));
     assert(list->isOpen);
 
     list->isOpen = FALSE;
@@ -731,7 +726,7 @@
 ReturnStatus
 Lst_EnQueue(Lst list, void *datum)
 {
-    if (!LstValid(list)) {
+    if (!LstIsValid(list)) {
        return FAILURE;
     }
 



Home | Main Index | Thread Index | Old Index