* | mutt_list_insert_head() | Insert a string at the beginning of a List
* | mutt_list_insert_tail() | Append a string to the end of a List
* | mutt_list_match() | Is the string in the list (see notes)
+ * | strict_cmp_stailq() | Compare two string lists
*/
#include "config.h"
}
return false;
}
+
+/**
+ * strict_cmp_stailq - Compare two string lists
+ * @param ah First string list
+ * @param bh Second string list
+ * @retval bool True if lists are identical
+ *
+ * To be identical, the lists must both be the same length and contain the same
+ * strings. Two empty lists are identical.
+ */
+int strict_cmp_stailq(const struct ListHead *ah, const struct ListHead *bh)
+{
+ struct ListNode *a = STAILQ_FIRST(ah);
+ struct ListNode *b = STAILQ_FIRST(bh);
+
+ while (a && b)
+ {
+ if (mutt_strcmp(a->data, b->data) != 0)
+ return 0;
+
+ a = STAILQ_NEXT(a, entries);
+ b = STAILQ_NEXT(b, entries);
+ }
+ if (a || b)
+ return 0;
+
+ return 1;
+}
+
struct ListNode *mutt_list_insert_head(struct ListHead *h, char *s);
struct ListNode *mutt_list_insert_tail(struct ListHead *h, char *s);
bool mutt_list_match(const char *s, struct ListHead *h);
+int strict_cmp_stailq(const struct ListHead *ah, const struct ListHead *bh);
#endif /* _LIB_LIST_H */
return 1;
}
-static int strict_cmp_stailq(const struct ListHead *ah, const struct ListHead *bh)
-{
- struct ListNode *a = STAILQ_FIRST(ah);
- struct ListNode *b = STAILQ_FIRST(bh);
-
- while (a && b)
- {
- if (mutt_strcmp(a->data, b->data) != 0)
- return 0;
-
- a = STAILQ_NEXT(a, entries);
- b = STAILQ_NEXT(b, entries);
- }
- if (a || b)
- return 0;
-
- return 1;
-}
-
-/**
- * strict_cmp_envelopes - Strictly compare two Envelopes
- * @param e1 First Envelope
- * @param e2 Second Envelope
- * @retval true Envelopes are strictly identical
- */
static int strict_cmp_envelopes(const struct Envelope *e1, const struct Envelope *e2)
{
if (e1 && e2)