From: Sughosh Ganu <sughosh.ganu@linaro.org>
Date: Mon, 26 Aug 2024 11:59:14 +0000 (+0530)
Subject: alist: add a helper to check if the list is full
X-Git-Tag: v2025.01-rc5-pxa1908~170^2~69^2~26
X-Git-Url: http://git.dujemihanovic.xyz/img/html/index.html?a=commitdiff_plain;h=c4eced2ec0d566e69281a2c20b0b43a141574318;p=u-boot.git

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 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
  *