Module Name: src Committed By: rillig Date: Fri Dec 29 20:43:58 UTC 2023
Modified Files: src/usr.bin/make: lst.c lst.h parse.c Log Message: make: unexport list memory management functions They are only used in a single source file. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.106 -r1.107 src/usr.bin/make/lst.c cvs rdiff -u -r1.103 -r1.104 src/usr.bin/make/lst.h cvs rdiff -u -r1.712 -r1.713 src/usr.bin/make/parse.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.106 src/usr.bin/make/lst.c:1.107 --- src/usr.bin/make/lst.c:1.106 Sat Feb 26 11:57:21 2022 +++ src/usr.bin/make/lst.c Fri Dec 29 20:43:58 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: lst.c,v 1.106 2022/02/26 11:57:21 rillig Exp $ */ +/* $NetBSD: lst.c,v 1.107 2023/12/29 20:43:58 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -34,7 +34,7 @@ #include "make.h" -MAKE_RCSID("$NetBSD: lst.c,v 1.106 2022/02/26 11:57:21 rillig Exp $"); +MAKE_RCSID("$NetBSD: lst.c,v 1.107 2023/12/29 20:43:58 rillig Exp $"); static ListNode * LstNodeNew(ListNode *prev, ListNode *next, void *datum) @@ -48,15 +48,6 @@ LstNodeNew(ListNode *prev, ListNode *nex return ln; } -/* Create and initialize a new, empty list. */ -List * -Lst_New(void) -{ - List *list = bmake_malloc(sizeof *list); - Lst_Init(list); - return list; -} - void Lst_Done(List *list) { @@ -80,15 +71,6 @@ Lst_DoneCall(List *list, LstFreeProc fre } } -/* Free a list and all its nodes. The node data are not freed though. */ -void -Lst_Free(List *list) -{ - - Lst_Done(list); - free(list); -} - /* Insert a new node with the datum before the given node. */ void Lst_InsertBefore(List *list, ListNode *ln, void *datum) Index: src/usr.bin/make/lst.h diff -u src/usr.bin/make/lst.h:1.103 src/usr.bin/make/lst.h:1.104 --- src/usr.bin/make/lst.h:1.103 Thu Mar 3 19:55:27 2022 +++ src/usr.bin/make/lst.h Fri Dec 29 20:43:58 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: lst.h,v 1.103 2022/03/03 19:55:27 rillig Exp $ */ +/* $NetBSD: lst.h,v 1.104 2023/12/29 20:43:58 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -101,16 +101,10 @@ struct List { /* Free the datum of a node, called before freeing the node itself. */ typedef void LstFreeProc(void *); -/* Create or destroy a list */ - -/* Create a new list. */ -List *Lst_New(void) MAKE_ATTR_USE; /* Free the list nodes, but not the list itself. */ void Lst_Done(List *); /* Free the list nodes, freeing the node data using the given function. */ void Lst_DoneCall(List *, LstFreeProc); -/* Free the list, leaving the node data unmodified. */ -void Lst_Free(List *); #define LST_INIT { NULL, NULL } Index: src/usr.bin/make/parse.c diff -u src/usr.bin/make/parse.c:1.712 src/usr.bin/make/parse.c:1.713 --- src/usr.bin/make/parse.c:1.712 Tue Dec 19 19:33:39 2023 +++ src/usr.bin/make/parse.c Fri Dec 29 20:43:58 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.712 2023/12/19 19:33:39 rillig Exp $ */ +/* $NetBSD: parse.c,v 1.713 2023/12/29 20:43:58 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -105,7 +105,7 @@ #include "pathnames.h" /* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: parse.c,v 1.712 2023/12/19 19:33:39 rillig Exp $"); +MAKE_RCSID("$NetBSD: parse.c,v 1.713 2023/12/29 20:43:58 rillig Exp $"); /* Detects a multiple-inclusion guard in a makefile. */ typedef enum { @@ -312,6 +312,23 @@ enum PosixState posix_state = PS_NOT_YET static HashTable /* full file name -> Guard */ guards; + +static List * +Lst_New(void) +{ + List *list = bmake_malloc(sizeof *list); + Lst_Init(list); + return list; +} + +static void +Lst_Free(List *list) +{ + + Lst_Done(list); + free(list); +} + static IncludedFile * GetInclude(size_t i) {