summaryrefslogtreecommitdiff
path: root/libnm/nm-wimax-nsp.c
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2014-10-22 12:32:46 -0400
committerDan Winship <danw@gnome.org>2014-10-28 17:17:17 -0400
commit6ae422485004485afd0a64f00e75c17fa5084b2e (patch)
treed364cd6dcd8f63e7aaba1666e3f8db41c2890378 /libnm/nm-wimax-nsp.c
parent9e5c7d915b837e79a2f6d64a7d89bf2a2dec2f50 (diff)
downloadNetworkManager-6ae422485004485afd0a64f00e75c17fa5084b2e.tar.gz
libnm: change GSList to GPtrArray in libnm methods
libnm mostly used GPtrArrays in its APIs, except that arrays of connections were usually GSLists. Fix this and make them GPtrArrays too (and rename nm_client_list_connections() to nm_client_get_connections() to match everything else).
Diffstat (limited to 'libnm/nm-wimax-nsp.c')
-rw-r--r--libnm/nm-wimax-nsp.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/libnm/nm-wimax-nsp.c b/libnm/nm-wimax-nsp.c
index 2387000569..9532b17627 100644
--- a/libnm/nm-wimax-nsp.c
+++ b/libnm/nm-wimax-nsp.c
@@ -145,33 +145,32 @@ nm_wimax_nsp_connection_valid (NMWimaxNsp *nsp, NMConnection *connection)
/**
* nm_wimax_nsp_filter_connections:
* @nsp: an #NMWimaxNsp to filter connections for
- * @connections: (element-type NMConnection): a list of
- * #NMConnection objects to filter
+ * @connections: (element-type NMConnection): an array of #NMConnections to
+ * filter
*
- * Filters a given list of connections for a given #NMWimaxNsp object and
- * return connections which may be activated with the access point. Any
- * returned connections will match the @nsp's network name and other attributes.
+ * Filters a given array of connections for a given #NMWimaxNsp object and
+ * return connections which may be activated with the NSP. Any returned
+ * connections will match the @nsp's network name and other attributes.
*
- * Returns: (transfer container) (element-type NMConnection): a
- * list of #NMConnection objects that could be activated with the given @nsp.
- * The elements of the list are owned by their creator and should not be freed
- * by the caller, but the returned list itself is owned by the caller and should
- * be freed with g_slist_free() when it is no longer required.
+ * Returns: (transfer container) (element-type NMConnection): an array of
+ * #NMConnections that could be activated with the given @nsp. The array should
+ * be freed with g_ptr_array_unref() when it is no longer required.
**/
-GSList *
-nm_wimax_nsp_filter_connections (NMWimaxNsp *nsp, const GSList *connections)
+GPtrArray *
+nm_wimax_nsp_filter_connections (NMWimaxNsp *nsp, const GPtrArray *connections)
{
- GSList *filtered = NULL;
- const GSList *iter;
+ GPtrArray *filtered;
+ int i;
- for (iter = connections; iter; iter = g_slist_next (iter)) {
- NMConnection *candidate = NM_CONNECTION (iter->data);
+ filtered = g_ptr_array_new_with_free_func (g_object_unref);
+ for (i = 0; i < connections->len; i++) {
+ NMConnection *candidate = connections->pdata[i];
if (nm_wimax_nsp_connection_valid (nsp, candidate))
- filtered = g_slist_prepend (filtered, candidate);
+ g_ptr_array_add (filtered, g_object_ref (candidate));
}
- return g_slist_reverse (filtered);
+ return filtered;
}
/************************************************************/