]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
alist: add a helper to check if the list is full
authorSughosh Ganu <sughosh.ganu@linaro.org>
Mon, 26 Aug 2024 11:59:14 +0000 (17:29 +0530)
committerTom Rini <trini@konsulko.com>
Tue, 3 Sep 2024 20:08:49 +0000 (14:08 -0600)
Add a helper function to check if the alist is full. This can then be
used to extend the alist.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
include/alist.h

index 586a1efa5c8af029f2c2d74f7cd5ae9802a2eafd..68d268f01af38bb308c71b14928687f92541e03e 100644 (file)
@@ -82,6 +82,17 @@ static inline bool alist_err(struct alist *lst)
        return lst->flags & ALISTF_FAIL;
 }
 
+/**
+ * alist_full() - Check if the alist is full
+ *
+ * @lst: List to check
+ * Return: true if full, false otherwise
+ */
+static inline bool alist_full(struct alist *lst)
+{
+       return lst->count == lst->alloc;
+}
+
 /**
  * alist_get_ptr() - Get the value of a pointer
  *