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): remove code for circular lists from Ls...



details:   https://anonhg.NetBSD.org/src/rev/225e66120194
branches:  trunk
changeset: 941481:225e66120194
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Oct 22 19:14:06 2020 +0000

description:
make(1): remove code for circular lists from Lst_Next

Since make does not use circular lists, they have been removed from the
list library a few weeks ago.

diffstat:

 usr.bin/make/lst.c |  24 ++++++------------------
 1 files changed, 6 insertions(+), 18 deletions(-)

diffs (54 lines):

diff -r 1dce6993bf88 -r 225e66120194 usr.bin/make/lst.c
--- a/usr.bin/make/lst.c        Thu Oct 22 19:05:24 2020 +0000
+++ b/usr.bin/make/lst.c        Thu Oct 22 19:14:06 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.c,v 1.79 2020/10/19 21:57:37 rillig Exp $ */
+/* $NetBSD: lst.c,v 1.80 2020/10/22 19:14:06 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -34,7 +34,7 @@
 
 #include "make.h"
 
-MAKE_RCSID("$NetBSD: lst.c,v 1.79 2020/10/19 21:57:37 rillig Exp $");
+MAKE_RCSID("$NetBSD: lst.c,v 1.80 2020/10/22 19:14:06 rillig Exp $");
 
 /* Allocate and initialize a list node.
  *
@@ -343,12 +343,11 @@
         */
        if (next != tln->next) {
            next = tln->next;
-           done = 0;
+           done = FALSE;
        }
 
-       if (tln->priv_deleted) {
-           free((char *)tln);
-       }
+       if (tln->priv_deleted)
+           free(tln);
        tln = next;
        if (result || LstIsEmpty(list) || done)
            break;
@@ -441,18 +440,7 @@
     } else {
        node = list->priv_curr->next;
        list->priv_curr = node;
-
-       if (node == list->first || node == NULL) {
-           /*
-            * If back at the front, then we've hit the end...
-            */
-           list->priv_lastAccess = Tail;
-       } else {
-           /*
-            * Reset to Middle if gone past first.
-            */
-           list->priv_lastAccess = Middle;
-       }
+       list->priv_lastAccess = node == NULL ? Tail : Middle;
     }
 
     return node;



Home | Main Index | Thread Index | Old Index