Add int_array_equal() to allow comparison of two int_array
instances. Return true if both arrays included the same set of integers.
Co-developed-by: Pooventhiran G <quic_pooventh@quicinc.com>
Signed-off-by: Pooventhiran G <quic_pooventh@quicinc.com>
Signed-off-by: Rohan Dutta <quic_drohan@quicinc.com>
}
+bool int_array_equal(const int *a, const int *b)
+{
+ size_t alen, blen, i;
+
+ if (!a || !b)
+ return false;
+
+ alen = int_array_len(a);
+ blen = int_array_len(b);
+
+ if (alen != blen)
+ return false;
+
+ for (i = 0; i <= alen; i++) {
+ if (!int_array_includes(b, a[i]))
+ return false;
+ }
+
+ return true;
+}
+
+
void str_clear_free(char *str)
{
if (str) {
void int_array_sort_unique(int *a);
void int_array_add_unique(int **res, int a);
bool int_array_includes(const int *arr, int val);
+bool int_array_equal(const int *a, const int *b);
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))