From 763ebab8e69642508cd688b2d2a006ecd462be81 Mon Sep 17 00:00:00 2001 From: Karol Lewandowski Date: Mon, 13 Jun 2022 15:36:59 +0200 Subject: libsessiond: Drop unused code and data Change-Id: Ia02761d1f9d950e1997f9a590b7d818cd980c001 --- libsessiond/src/lib.c | 93 ++------------------------------------------------- 1 file changed, 2 insertions(+), 91 deletions(-) diff --git a/libsessiond/src/lib.c b/libsessiond/src/lib.c index e422068..9c9dbcd 100644 --- a/libsessiond/src/lib.c +++ b/libsessiond/src/lib.c @@ -71,28 +71,13 @@ static struct { .GetCurrentUser = "GetCurrentUser" }; -static struct { - gchar * AddUserCompleted; - gchar * RemoveUserCompleted; - gchar * SwitchUserCompleted; - gchar * AddUserStarted; - gchar * RemoveUserStarted; - -} dbus_signal_name = { - .AddUserCompleted = "AddUserCompleted", - .RemoveUserCompleted = "RemoveUserCompleted", - .SwitchUserCompleted = "SwitchUserCompleted", - .AddUserStarted = "AddUserStarted", - .RemoveUserStarted = "RemoveUserStarted" -}; - -typedef struct { +typedef struct { guint AddUserCompleted; guint RemoveUserCompleted; guint SwitchUserCompleted; guint AddUserStarted; guint RemoveUserStarted; - } dbus_signal_subscribed_t; +} dbus_signal_subscribed_t; dbus_signal_subscribed_t dbus_signal_subscribed = { .AddUserCompleted = 0, @@ -372,57 +357,6 @@ static signal_client_data_t *find_in_callbacks_data( client_callbacks_data_t *cl return signal_data; } -const int cb_result_ok = 0; - -static void call_reply_callback(signal_client_data_t *signal_data, int ret_status) { - - subsession_reply_callback reply_cb = signal_data->client_callback; - void *client_callback_data = signal_data->client_callback_data; - reply_cb(ret_status, client_callback_data); -} - -static gint g_compare_switch_user_params ( gconstpointer client_data, gconstpointer parameters) { - - maybe_not_comparable_if( - client_data_are_null(client_data, - parameters_are_null(parameters)) - ) - - signal_client_data_t *signal_client_data = (signal_client_data_t*)client_data; - - int client_session_uid = 0; - int client_next_user = 0; - - maybe_g_variant_get_int_(signal_client_data->params, "(ii)", &client_session_uid, &client_next_user); - maybe_not_comparable_if( - session_uid_is_not_valid(client_session_uid, - switched_user_id_is_not_valid(client_next_user)) - ) - - GVariant *params = (GVariant *)parameters; - - int params_session_uid = 0; - int params_switch_id = 0; - int params_prev_user = 0; - int params_next_user = 0; - - maybe_g_variant_get_int_(params, "(ixii)", ¶ms_session_uid, ¶ms_switch_id, ¶ms_prev_user, ¶ms_next_user); - maybe_not_comparable_if( - session_uid_is_not_valid(params_session_uid, - switch_id_is_not_valid(params_switch_id, - switched_user_id_is_not_valid(params_prev_user, - switched_user_id_is_not_valid(params_next_user)))) - ) - - gboolean all_ok = (client_session_uid == params_session_uid) && - (client_next_user == params_next_user); - - if( all_ok) { - return COMPARATOR_RESULT_SAME_; - } - return COMPARATOR_RESULT_DIFFERENT_; -} - static void signal_add_user_started_handler(GDBusConnection *connection, const gchar *sender_name, const gchar *object_path, @@ -688,29 +622,6 @@ static int init_callbacks_list(client_callbacks_data_t *callbacks_data, GVariant return SUBSESSION_ERROR_NONE; } -#define callbacks_data_append_to_list(callback_data, data) \ - callback_data.list = g_list_append(callback_data.list, data) - -static int append_to_callbacks_list(client_callbacks_data_t *callbacks_data_mt, GVariant *init_params, signal_client_data_t *signal_client_data, subsession_reply_callback cb, void *cb_data) { - - if(init_params == NULL || signal_client_data == NULL ) { - return SUBSESSION_ERROR_OUT_OF_MEMORY; - } - - g_mutex_lock(&callbacks_data_mt->mutex); - int init_callbacks_list_res = init_callbacks_list(callbacks_data_mt, init_params); - - if(init_callbacks_list_res != SUBSESSION_ERROR_NONE) { - g_mutex_unlock(&callbacks_data_mt->mutex); - return init_callbacks_list_res; - } - callbacks_data_mt->list = g_list_append(callbacks_data_mt->list, signal_client_data); - - g_mutex_unlock(&callbacks_data_mt->mutex); - - return SUBSESSION_ERROR_NONE; -} - static void async_method_reply_handler(GObject *source_obj, GAsyncResult *res, gpointer userdata) { g_autofree reply_client_data_t * reply_info = (reply_client_data_t *) userdata; -- cgit v1.2.3