gthreadedsocketservice: Abstract out a free function

This introduces no functional changes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
Philip Withnall 2019-04-12 15:21:10 +01:00
parent ec569ff2e2
commit 63823ae628

View File

@ -75,6 +75,14 @@ typedef struct
GObject *source_object;
} GThreadedSocketServiceData;
static void
g_threaded_socket_service_data_free (GThreadedSocketServiceData *data)
{
g_clear_object (&data->connection);
g_clear_object (&data->source_object);
g_slice_free (GThreadedSocketServiceData, data);
}
static void
g_threaded_socket_service_func (gpointer _data,
gpointer user_data)
@ -86,17 +94,12 @@ g_threaded_socket_service_func (gpointer _data,
g_signal_emit (threaded, g_threaded_socket_service_run_signal,
0, data->connection, data->source_object, &result);
g_object_unref (data->connection);
if (data->source_object)
g_object_unref (data->source_object);
g_slice_free (GThreadedSocketServiceData, data);
G_LOCK (job_count);
if (threaded->priv->job_count-- == threaded->priv->max_threads)
g_socket_service_start (G_SOCKET_SERVICE (threaded));
G_UNLOCK (job_count);
g_object_unref (threaded);
g_threaded_socket_service_data_free (data);
}
static gboolean