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: fix documentation of Lst_MoveAll



details:   https://anonhg.NetBSD.org/src/rev/33105929f33b
branches:  trunk
changeset: 953660:33105929f33b
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Mar 15 16:45:30 2021 +0000

description:
make: fix documentation of Lst_MoveAll

In CLEANUP mode, was originally meant to track memory allocations but is
useful during debugging as well, initialize the list.  There is no
distinct constant representing an invalid pointer, otherwise that would
have been an even better choice.

diffstat:

 usr.bin/make/lst.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (38 lines):

diff -r 6690ff21cbbd -r 33105929f33b usr.bin/make/lst.c
--- a/usr.bin/make/lst.c        Mon Mar 15 16:06:05 2021 +0000
+++ b/usr.bin/make/lst.c        Mon Mar 15 16:45:30 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.c,v 1.104 2021/02/01 19:39:31 rillig Exp $ */
+/* $NetBSD: lst.c,v 1.105 2021/03/15 16:45:30 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -34,7 +34,7 @@
 
 #include "make.h"
 
-MAKE_RCSID("$NetBSD: lst.c,v 1.104 2021/02/01 19:39:31 rillig Exp $");
+MAKE_RCSID("$NetBSD: lst.c,v 1.105 2021/03/15 16:45:30 rillig Exp $");
 
 static ListNode *
 LstNodeNew(ListNode *prev, ListNode *next, void *datum)
@@ -205,7 +205,7 @@
 
 /*
  * Move all nodes from src to the end of dst.
- * The source list becomes empty but is not freed.
+ * The source list becomes indeterminate.
  */
 void
 Lst_MoveAll(List *dst, List *src)
@@ -219,6 +219,10 @@
 
                dst->last = src->last;
        }
+#ifdef CLEANUP
+       src->first = NULL;
+       src->last = NULL;
+#endif
 }
 
 /* Copy the element data from src to the start of dst. */



Home | Main Index | Thread Index | Old Index