iface-modem-3gpp: coding style updates in initialization sequence

This commit is contained in:
Aleksander Morgado
2023-04-18 13:59:36 +02:00
committed by Aleksander Morgado
parent db6b45fa10
commit e1691780f7

View File

@@ -3160,20 +3160,20 @@ typedef enum {
} InitializationStep; } InitializationStep;
struct _InitializationContext { struct _InitializationContext {
MmGdbusModem3gpp *skeleton; MmGdbusModem3gpp *skeleton;
InitializationStep step; InitializationStep step;
}; };
static void static void
initialization_context_free (InitializationContext *ctx) initialization_context_free (InitializationContext *ctx)
{ {
g_object_unref (ctx->skeleton); g_clear_object (&ctx->skeleton);
g_free (ctx); g_slice_free (InitializationContext, ctx);
} }
static void static void
sim_pin_lock_enabled_cb (MMBaseSim *self, sim_pin_lock_enabled_cb (MMBaseSim *self,
gboolean enabled, gboolean enabled,
MmGdbusModem3gpp *skeleton) MmGdbusModem3gpp *skeleton)
{ {
MMModem3gppFacility facilities; MMModem3gppFacility facilities;
@@ -3267,8 +3267,8 @@ load_enabled_facility_locks_ready (MMIfaceModem3gpp *self,
GTask *task) GTask *task)
{ {
InitializationContext *ctx; InitializationContext *ctx;
g_autoptr(GError) error = NULL;
MMModem3gppFacility facilities; MMModem3gppFacility facilities;
g_autoptr(GError) error = NULL;
ctx = g_task_get_task_data (task); ctx = g_task_get_task_data (task);
@@ -3323,9 +3323,9 @@ load_imei_ready (MMIfaceModem3gpp *self,
static void static void
interface_initialization_step (GTask *task) interface_initialization_step (GTask *task)
{ {
MMIfaceModem3gpp *self; MMIfaceModem3gpp *self;
InitializationContext *ctx; InitializationContext *ctx;
MMModemState modem_state; MMModemState modem_state;
/* Don't run new steps if we're cancelled */ /* Don't run new steps if we're cancelled */
if (g_task_return_error_if_cancelled (task)) { if (g_task_return_error_if_cancelled (task)) {
@@ -3334,7 +3334,7 @@ interface_initialization_step (GTask *task)
} }
self = g_task_get_source_object (task); self = g_task_get_source_object (task);
ctx = g_task_get_task_data (task); ctx = g_task_get_task_data (task);
switch (ctx->step) { switch (ctx->step) {
case INITIALIZATION_STEP_FIRST: case INITIALIZATION_STEP_FIRST:
@@ -3475,22 +3475,22 @@ interface_initialization_step (GTask *task)
} }
gboolean gboolean
mm_iface_modem_3gpp_initialize_finish (MMIfaceModem3gpp *self, mm_iface_modem_3gpp_initialize_finish (MMIfaceModem3gpp *self,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
return g_task_propagate_boolean (G_TASK (res), error); return g_task_propagate_boolean (G_TASK (res), error);
} }
void void
mm_iface_modem_3gpp_initialize (MMIfaceModem3gpp *self, mm_iface_modem_3gpp_initialize (MMIfaceModem3gpp *self,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
MmGdbusModem3gpp *skeleton = NULL; MmGdbusModem3gpp *skeleton = NULL;
InitializationContext *ctx; InitializationContext *ctx;
GTask *task; GTask *task;
/* Did we already create it? */ /* Did we already create it? */
g_object_get (self, g_object_get (self,
@@ -3523,7 +3523,7 @@ mm_iface_modem_3gpp_initialize (MMIfaceModem3gpp *self,
NULL); NULL);
} }
ctx = g_new0 (InitializationContext, 1); ctx = g_slice_new0 (InitializationContext);
ctx->step = INITIALIZATION_STEP_FIRST; ctx->step = INITIALIZATION_STEP_FIRST;
ctx->skeleton = skeleton; ctx->skeleton = skeleton;