mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-05 13:28:02 +02:00
shared: add nm_utils_g_slist_strlist_join() util
This commit is contained in:
parent
ad3ef326aa
commit
efa51ba9a2
2 changed files with 20 additions and 0 deletions
|
|
@ -2871,6 +2871,24 @@ nm_utils_g_slist_strlist_cmp (const GSList *a, const GSList *b)
|
|||
}
|
||||
}
|
||||
|
||||
char *
|
||||
nm_utils_g_slist_strlist_join (const GSList *a, const char *separator)
|
||||
{
|
||||
GString *str = NULL;
|
||||
|
||||
if (!a)
|
||||
return NULL;
|
||||
|
||||
for (; a; a = a->next) {
|
||||
if (!str)
|
||||
str = g_string_new (NULL);
|
||||
else
|
||||
g_string_append (str, separator);
|
||||
g_string_append (str, a->data);
|
||||
}
|
||||
return g_string_free (str, FALSE);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
gpointer
|
||||
|
|
|
|||
|
|
@ -993,6 +993,8 @@ GSList *nm_utils_g_slist_find_str (const GSList *list,
|
|||
|
||||
int nm_utils_g_slist_strlist_cmp (const GSList *a, const GSList *b);
|
||||
|
||||
char *nm_utils_g_slist_strlist_join (const GSList *a, const char *separator);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
gssize nm_utils_ptrarray_find_binary_search (gconstpointer *list,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue