Module Name: src
Committed By: rillig
Date: Wed Dec 15 10:57:01 UTC 2021
Modified Files:
src/usr.bin/make: main.c str.c str.h
Log Message:
make: in CLEANUP mode, free interned strings at the very end
Noticed by sjg.
To generate a diff of this commit:
cvs rdiff -u -r1.543 -r1.544 src/usr.bin/make/main.c
cvs rdiff -u -r1.87 -r1.88 src/usr.bin/make/str.c
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/str.h
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/main.c
diff -u src/usr.bin/make/main.c:1.543 src/usr.bin/make/main.c:1.544
--- src/usr.bin/make/main.c:1.543 Mon Dec 13 22:26:21 2021
+++ src/usr.bin/make/main.c Wed Dec 15 10:57:01 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.543 2021/12/13 22:26:21 rillig Exp $ */
+/* $NetBSD: main.c,v 1.544 2021/12/15 10:57:01 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -111,7 +111,7 @@
#include "trace.h"
/* "@(#)main.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: main.c,v 1.543 2021/12/13 22:26:21 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.544 2021/12/15 10:57:01 rillig Exp $");
#if defined(MAKE_NATIVE) && !defined(lint)
__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
"The Regents of the University of California. "
@@ -1653,6 +1653,7 @@ main_CleanUp(void)
Dir_End();
Job_End();
Trace_End();
+ Str_Intern_End();
}
/* Determine the exit code. */
Index: src/usr.bin/make/str.c
diff -u src/usr.bin/make/str.c:1.87 src/usr.bin/make/str.c:1.88
--- src/usr.bin/make/str.c:1.87 Mon Dec 13 05:25:04 2021
+++ src/usr.bin/make/str.c Wed Dec 15 10:57:01 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: str.c,v 1.87 2021/12/13 05:25:04 rillig Exp $ */
+/* $NetBSD: str.c,v 1.88 2021/12/15 10:57:01 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -71,7 +71,7 @@
#include "make.h"
/* "@(#)str.c 5.8 (Berkeley) 6/1/90" */
-MAKE_RCSID("$NetBSD: str.c,v 1.87 2021/12/13 05:25:04 rillig Exp $");
+MAKE_RCSID("$NetBSD: str.c,v 1.88 2021/12/15 10:57:01 rillig Exp $");
static HashTable interned_strings;
@@ -406,6 +406,14 @@ Str_Intern_Init(void)
HashTable_Init(&interned_strings);
}
+void
+Str_Intern_End(void)
+{
+#ifdef CLEANUP
+ HashTable_Done(&interned_strings);
+#endif
+}
+
/* Return a canonical instance of str, with unlimited lifetime. */
const char *
Str_Intern(const char *str)
Index: src/usr.bin/make/str.h
diff -u src/usr.bin/make/str.h:1.14 src/usr.bin/make/str.h:1.15
--- src/usr.bin/make/str.h:1.14 Mon Dec 13 05:25:04 2021
+++ src/usr.bin/make/str.h Wed Dec 15 10:57:01 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: str.h,v 1.14 2021/12/13 05:25:04 rillig Exp $ */
+/* $NetBSD: str.h,v 1.15 2021/12/15 10:57:01 rillig Exp $ */
/*
Copyright (c) 2021 Roland Illig <[email protected]>
@@ -345,4 +345,5 @@ char *str_concat3(const char *, const ch
bool Str_Match(const char *, const char *);
void Str_Intern_Init(void);
+void Str_Intern_End(void);
const char *Str_Intern(const char *);