diff options
author | Simon Glass <sjg@chromium.org> | 2024-10-19 09:21:46 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2024-11-03 21:27:12 -0600 |
commit | 5bd4ead8bd76c85aa599c44e8bfb12f512d8ed09 (patch) | |
tree | 4fb1a792341f6a5b3c636bf79071c64f2a669d6a /lib | |
parent | d785a77d18acdf6714f4570c14e622caadf4d5e3 (diff) |
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>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/alist.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/alist.c b/lib/alist.c index 1a4b4fb9c40..32cd45b0b01 100644 --- a/lib/alist.c +++ b/lib/alist.c @@ -41,6 +41,11 @@ void alist_uninit(struct alist *lst) 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 * |