alist: Add a function to empty the list
Sometimes it is useful to empty the list without de-allocating any of
the memory used, e.g. when the list will be re-populated immediately
afterwards.
Add a new function for this.
Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/lib/alist.c b/lib/alist.c
index 1a4b4fb..32cd45b 100644
--- a/lib/alist.c
+++ b/lib/alist.c
@@ -41,6 +41,11 @@
memset(lst, '\0', sizeof(struct alist));
}
+void alist_empty(struct alist *lst)
+{
+ lst->count = 0;
+}
+
/**
* alist_expand_to() - Expand a list to the given size
*