libnm-core: add _nm_utils_hash_values_to_slist()

Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Thomas Haller 2014-07-27 23:33:16 +02:00
parent d299c425d4
commit ff142ce780
2 changed files with 31 additions and 0 deletions

View file

@ -61,4 +61,7 @@ gboolean _nm_setting_ip4_config_add_address_with_label (NMSettingIP4Config *s
NM_SETTING_SECRET_FLAG_NOT_REQUIRED)
GSList * _nm_utils_hash_values_to_slist (GHashTable *hash);
#endif

View file

@ -536,6 +536,34 @@ done:
return valid;
}
/**
* _nm_utils_hash_values_to_slist:
* @hash: a #GHashTable
*
* Utility function to iterate over a hash table and return
* it's values as a #GSList.
*
* Returns: (element-type gpointer) (transfer container): a newly allocated #GSList
* containing the values of the hash table. The caller must free the
* returned list with g_slist_free(). The hash values are not owned
* by the returned list.
**/
GSList *
_nm_utils_hash_values_to_slist (GHashTable *hash)
{
GSList *list = NULL;
GHashTableIter iter;
void *value;
g_return_val_if_fail (hash, NULL);
g_hash_table_iter_init (&iter, hash);
while (g_hash_table_iter_next (&iter, NULL, &value))
list = g_slist_prepend (list, value);
return list;
}
static gboolean
device_supports_ap_ciphers (guint32 dev_caps,
guint32 ap_flags,