summaryrefslogtreecommitdiff
path: root/src/nm-active-connection.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-04-17 14:59:27 +0200
committerThomas Haller <thaller@redhat.com>2018-04-24 09:03:39 +0200
commit9abe3dc1a48d39b3b82014ee8ea19f748d30fed7 (patch)
tree04770318f306b685521b439994aa7a168077e27d /src/nm-active-connection.c
parentdc138da420bd42b9593dcb38f8581ca0cd2a0e3f (diff)
downloadNetworkManager-9abe3dc1a48d39b3b82014ee8ea19f748d30fed7.tar.gz
core: rework passing user-data to nm_active_connection_authorize()
Previously, nm_active_connection_authorize() accepts two user-data pointers for convenience. nm_active_connection_authorize() has three callers. One only requires one user-data, one passes two user-data pointers, and one requires three pointer. Also, the way how the third passes the user data (via g_object_set_qdata_full()) is not great. Let's only use one user-data pointer. We commonly do that, and it's easy enough to allocate a buffer to pack multiple pointers together.
Diffstat (limited to 'src/nm-active-connection.c')
-rw-r--r--src/nm-active-connection.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/nm-active-connection.c b/src/nm-active-connection.c
index c6d6645d51..272554d342 100644
--- a/src/nm-active-connection.c
+++ b/src/nm-active-connection.c
@@ -67,8 +67,7 @@ typedef struct _NMActiveConnectionPrivate {
NMAuthManagerCallId *call_id_wifi_shared_permission;
NMActiveConnectionAuthResultFunc result_func;
- gpointer user_data1;
- gpointer user_data2;
+ gpointer user_data;
} auth;
} NMActiveConnectionPrivate;
@@ -999,8 +998,7 @@ auth_cancel (NMActiveConnection *self)
nm_auth_manager_check_authorization_cancel (priv->auth.call_id_wifi_shared_permission);
}
priv->auth.result_func = NULL;
- priv->auth.user_data1 = NULL;
- priv->auth.user_data2 = NULL;
+ priv->auth.user_data = NULL;
}
static void
@@ -1012,8 +1010,7 @@ auth_complete (NMActiveConnection *self, gboolean result, const char *message)
priv->auth.result_func (self,
result,
message,
- priv->auth.user_data1,
- priv->auth.user_data2);
+ priv->auth.user_data);
auth_cancel (self);
}
@@ -1082,8 +1079,7 @@ auth_done (NMAuthManager *auth_mgr,
* is no @settings_connection available when creating the active connection.
* Instead pass an alternative connection.
* @result_func: function to be called on success or error
- * @user_data1: pointer passed to @result_func
- * @user_data2: additional pointer passed to @result_func
+ * @user_data: pointer passed to @result_func
*
* Checks whether the subject that initiated the active connection (read from
* the #NMActiveConnection::subject property) is authorized to complete this
@@ -1093,8 +1089,7 @@ void
nm_active_connection_authorize (NMActiveConnection *self,
NMConnection *initial_connection,
NMActiveConnectionAuthResultFunc result_func,
- gpointer user_data1,
- gpointer user_data2)
+ gpointer user_data)
{
NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (self);
const char *wifi_permission = NULL;
@@ -1133,10 +1128,8 @@ nm_active_connection_authorize (NMActiveConnection *self,
self);
}
- /* Wait for authorization */
priv->auth.result_func = result_func;
- priv->auth.user_data1 = user_data1;
- priv->auth.user_data2 = user_data2;
+ priv->auth.user_data = user_data;
}
/*****************************************************************************/