[PATCH v2 01/32] alist: add a helper to check if the list is full
Sughosh Ganu
sughosh.ganu at linaro.org
Wed Aug 14 12:59:38 CEST 2024
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 at linaro.org>
---
Changes since V1:
* Do away with the alist_empty() function, as it is no longer needed
include/alist.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/include/alist.h b/include/alist.h
index 586a1efa5c..68d268f01a 100644
--- a/include/alist.h
+++ b/include/alist.h
@@ -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
*
--
2.34.1
More information about the U-Boot
mailing list