broadband-modem: remove unneeded InitializationStartedContext struct
This commit is contained in:
@@ -8561,17 +8561,6 @@ initialization_stopped (MMBroadbandModem *self,
|
|||||||
return TRUE;
|
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
|
static gpointer
|
||||||
initialization_started_finish (MMBroadbandModem *self,
|
initialization_started_finish (MMBroadbandModem *self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
@@ -8625,24 +8614,20 @@ initialization_started (MMBroadbandModem *self,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
InitializationStartedContext *ctx;
|
|
||||||
GTask *task;
|
GTask *task;
|
||||||
|
PortsContext *ctx;
|
||||||
ctx = g_new0 (InitializationStartedContext, 1);
|
|
||||||
ctx->ports = g_new0 (PortsContext, 1);
|
|
||||||
ctx->ports->ref_count = 1;
|
|
||||||
|
|
||||||
task = g_task_new (self, NULL, callback, user_data);
|
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_prefix_error (&error, "Couldn't open ports during modem initialization: ");
|
||||||
g_task_return_error (task, error);
|
g_task_return_error (task, error);
|
||||||
} else
|
} else
|
||||||
g_task_return_pointer (task,
|
g_task_return_pointer (task, ctx, (GDestroyNotify)ports_context_unref);
|
||||||
ports_context_ref (ctx->ports),
|
|
||||||
(GDestroyNotify)ports_context_unref);
|
|
||||||
|
|
||||||
g_object_unref (task);
|
g_object_unref (task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user