diff --git a/shared/nm-glib-aux/nm-shared-utils.c b/shared/nm-glib-aux/nm-shared-utils.c index 6ed86f5916..c8b0eef84e 100644 --- a/shared/nm-glib-aux/nm-shared-utils.c +++ b/shared/nm-glib-aux/nm-shared-utils.c @@ -2709,6 +2709,25 @@ nm_utils_g_slist_find_str (const GSList *list, return NULL; } +/** + * nm_utils_g_slist_strlist_cmp: + * @a: the left #GSList of strings + * @b: the right #GSList of strings to compare. + * + * Compares two string lists. The data elements are compared with + * strcmp(), alloing %NULL elements. + * + * Returns: 0, 1, or -1, depending on how the lists compare. + */ +int +nm_utils_g_slist_strlist_cmp (const GSList *a, const GSList *b) +{ + for (; a && b; a = a->next, b = b->next) + NM_CMP_DIRECT_STRCMP0 (a->data, b->data); + NM_CMP_SELF (a, b); + return 0; +} + /*****************************************************************************/ gpointer diff --git a/shared/nm-glib-aux/nm-shared-utils.h b/shared/nm-glib-aux/nm-shared-utils.h index 8f11a9b0c3..a8f2966b38 100644 --- a/shared/nm-glib-aux/nm-shared-utils.h +++ b/shared/nm-glib-aux/nm-shared-utils.h @@ -981,6 +981,8 @@ nm_utils_strv_make_deep_copied_nonnull (const char **strv) GSList *nm_utils_g_slist_find_str (const GSList *list, const char *needle); +int nm_utils_g_slist_strlist_cmp (const GSList *a, const GSList *b); + /*****************************************************************************/ gssize nm_utils_ptrarray_find_binary_search (gconstpointer *list,