alist: add a helper to check if the list is full
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>
diff --git a/include/alist.h b/include/alist.h
index 586a1ef..68d268f 100644
--- a/include/alist.h
+++ b/include/alist.h
@@ -83,6 +83,17 @@
}
/**
+ * 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
*
* @lst: alist to check