Module Name:    src
Committed By:   rillig
Date:           Mon Mar 15 16:45:30 UTC 2021

Modified Files:
        src/usr.bin/make: lst.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/usr.bin/make/lst.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/lst.c
diff -u src/usr.bin/make/lst.c:1.104 src/usr.bin/make/lst.c:1.105
--- src/usr.bin/make/lst.c:1.104	Mon Feb  1 19:39:31 2021
+++ src/usr.bin/make/lst.c	Mon Mar 15 16:45:30 2021
@@ -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 @@ Lst_FindDatum(List *list, const void *da
 
 /*
  * 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 @@ Lst_MoveAll(List *dst, List *src)
 
 		dst->last = src->last;
 	}
+#ifdef CLEANUP
+	src->first = NULL;
+	src->last = NULL;
+#endif
 }
 
 /* Copy the element data from src to the start of dst. */

Reply via email to