diff options
author | Simon Glass <sjg@chromium.org> | 2024-10-19 09:21:46 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2024-11-02 11:13:59 -0600 |
commit | 70f5f17415a257ce8d5f32df5b40194b89a27960 (patch) | |
tree | a01d9b96bd88ea76aa1f4e7c253ae02eea12d50d /lib/alist.c | |
parent | 83bc5989fc5f71e2c40d75ea786ccbf937b9fbab (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/alist.c')
-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 * |