aboutsummaryrefslogtreecommitdiff
path: root/contrib/bmake/lst.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/bmake/lst.h')
-rw-r--r--contrib/bmake/lst.h28
1 files changed, 12 insertions, 16 deletions
diff --git a/contrib/bmake/lst.h b/contrib/bmake/lst.h
index cddd6439f611..59f8f201192f 100644
--- a/contrib/bmake/lst.h
+++ b/contrib/bmake/lst.h
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.h,v 1.98 2021/04/03 11:08:40 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.
@@ -106,16 +106,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);
/* 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 }
@@ -129,22 +123,22 @@ Lst_Init(List *list)
/* Get information about a list */
-MAKE_INLINE bool
+MAKE_INLINE bool MAKE_ATTR_USE
Lst_IsEmpty(List *list)
{
return list->first == NULL;
}
/* Find the first node that contains the given datum, or NULL. */
-ListNode *Lst_FindDatum(List *, const void *);
+ListNode *Lst_FindDatum(List *, const void *) MAKE_ATTR_USE;
/* Modify a list */
/* Insert a datum before the given node. */
void Lst_InsertBefore(List *, ListNode *, void *);
-/* Place a datum at the front of the list. */
+/* Add a datum at the head of the list. */
void Lst_Prepend(List *, void *);
-/* Place a datum at the end of the list. */
+/* Add a datum at the tail of the list. */
void Lst_Append(List *, void *);
/* Remove the node from the list. */
void Lst_Remove(List *, ListNode *);
@@ -163,12 +157,13 @@ void LstNode_SetNull(ListNode *);
/* Add a datum at the tail of the queue. */
MAKE_INLINE void
-Lst_Enqueue(List *list, void *datum) {
+Lst_Enqueue(List *list, void *datum)
+{
Lst_Append(list, datum);
}
/* Remove the head node of the queue and return its datum. */
-void *Lst_Dequeue(List *);
+void *Lst_Dequeue(List *) MAKE_ATTR_USE;
/*
* A vector is an ordered collection of items, allowing for fast indexed
@@ -187,7 +182,7 @@ void Vector_Init(Vector *, size_t);
* Return the pointer to the given item in the vector.
* The returned data is valid until the next modifying operation.
*/
-MAKE_INLINE void *
+MAKE_INLINE void * MAKE_ATTR_USE
Vector_Get(Vector *v, size_t i)
{
unsigned char *items = v->items;
@@ -198,8 +193,9 @@ void *Vector_Push(Vector *);
void *Vector_Pop(Vector *);
MAKE_INLINE void
-Vector_Done(Vector *v) {
+Vector_Done(Vector *v)
+{
free(v->items);
}
-#endif /* MAKE_LST_H */
+#endif