diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2017-07-18 10:47:47 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2017-07-18 10:53:03 +0200 |
commit | fa31b699ece5dbc64600b7a41364d5167f98ef5e (patch) | |
tree | 7236f7643e4dc212f5be6b36e84bff115df43643 /src | |
parent | 6515c81f44cc644b45232ddacd2107c9c552b077 (diff) |
broadband-modem: remove unneeded InitializationStartedContext struct
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-broadband-modem.c | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c index 05aabfa4..f98aafc2 100644 --- a/src/mm-broadband-modem.c +++ b/src/mm-broadband-modem.c @@ -8561,17 +8561,6 @@ initialization_stopped (MMBroadbandModem *self, return TRUE; } -typedef struct { - PortsContext *ports; -} InitializationStartedContext; - -static void -initialization_started_context_free (InitializationStartedContext *ctx) -{ - ports_context_unref (ctx->ports); - g_free (ctx); -} - static gpointer initialization_started_finish (MMBroadbandModem *self, GAsyncResult *res, @@ -8625,24 +8614,20 @@ initialization_started (MMBroadbandModem *self, gpointer user_data) { GError *error = NULL; - InitializationStartedContext *ctx; GTask *task; - - ctx = g_new0 (InitializationStartedContext, 1); - ctx->ports = g_new0 (PortsContext, 1); - ctx->ports->ref_count = 1; + PortsContext *ctx; task = g_task_new (self, NULL, callback, user_data); - g_task_set_task_data (task, ctx, (GDestroyNotify)initialization_started_context_free); - if (!open_ports_initialization (self, ctx->ports, &error)) { + ctx = g_new0 (PortsContext, 1); + ctx->ref_count = 1; + + if (!open_ports_initialization (self, ctx, &error)) { + ports_context_unref (ctx); g_prefix_error (&error, "Couldn't open ports during modem initialization: "); g_task_return_error (task, error); } else - g_task_return_pointer (task, - ports_context_ref (ctx->ports), - (GDestroyNotify)ports_context_unref); - + g_task_return_pointer (task, ctx, (GDestroyNotify)ports_context_unref); g_object_unref (task); } |