[PATCH 3/4] cli: remove explicit GDestroyNotify cast on g_object_unref

Aleksander Morgado aleksander at aleksander.es
Wed Mar 29 08:32:45 UTC 2017


On Wed, Mar 29, 2017 at 3:35 AM, Ben Chan <benchan at chromium.org> wrote:
> g_object_unref is in form of  `void (*)(gpointer)`, which matches the
> GDestroyNotify signature. An explicit GDestroyNotify cast on
> g_object_unref is thus not needed.
> ---

Pushed to git master, thanks!

>  cli/mmcli-common.c  | 30 +++++++++++++++---------------
>  cli/mmcli-manager.c |  4 ++--
>  2 files changed, 17 insertions(+), 17 deletions(-)
>
> diff --git a/cli/mmcli-common.c b/cli/mmcli-common.c
> index f48dd9c2..327031c2 100644
> --- a/cli/mmcli-common.c
> +++ b/cli/mmcli-common.c
> @@ -142,7 +142,7 @@ find_modem (MMManager *manager,
>              break;
>          }
>      }
> -    g_list_free_full (modems, (GDestroyNotify) g_object_unref);
> +    g_list_free_full (modems, g_object_unref);
>
>      if (!found) {
>          if (modem_path)
> @@ -339,7 +339,7 @@ get_bearer_context_free (GetBearerContext *ctx)
>          g_object_unref (ctx->manager);
>      if (ctx->bearer)
>          g_object_unref (ctx->bearer);
> -    g_list_free_full (ctx->modems, (GDestroyNotify) g_object_unref);
> +    g_list_free_full (ctx->modems, g_object_unref);
>      g_free (ctx->bearer_path);
>      g_free (ctx);
>  }
> @@ -404,7 +404,7 @@ list_bearers_ready (MMModem *modem,
>      }
>
>      ctx->bearer = find_bearer_in_list (bearers, ctx->bearer_path);
> -    g_list_free_full (bearers, (GDestroyNotify) g_object_unref);
> +    g_list_free_full (bearers, g_object_unref);
>
>      /* Found! */
>      if (ctx->bearer) {
> @@ -574,7 +574,7 @@ mmcli_get_bearer_sync (GDBusConnection *connection,
>          }
>
>          found = find_bearer_in_list (bearers, bearer_path);
> -        g_list_free_full (bearers, (GDestroyNotify) g_object_unref);
> +        g_list_free_full (bearers, g_object_unref);
>
>          if (found && o_object)
>              *o_object = g_object_ref (object);
> @@ -588,7 +588,7 @@ mmcli_get_bearer_sync (GDBusConnection *connection,
>          exit (EXIT_FAILURE);
>      }
>
> -    g_list_free_full (modems, (GDestroyNotify) g_object_unref);
> +    g_list_free_full (modems, g_object_unref);
>      g_free (bearer_path);
>
>      if (o_manager)
> @@ -709,7 +709,7 @@ get_sim_manager_ready (GDBusConnection *connection,
>          exit (EXIT_FAILURE);
>      }
>
> -    g_list_free_full (modems, (GDestroyNotify) g_object_unref);
> +    g_list_free_full (modems, g_object_unref);
>  }
>
>  static gchar *
> @@ -814,7 +814,7 @@ mmcli_get_sim_sync (GDBusConnection *connection,
>          exit (EXIT_FAILURE);
>      }
>
> -    g_list_free_full (modems, (GDestroyNotify) g_object_unref);
> +    g_list_free_full (modems, g_object_unref);
>      g_free (sim_path);
>
>      if (o_manager)
> @@ -846,7 +846,7 @@ get_sms_context_free (GetSmsContext *ctx)
>          g_object_unref (ctx->manager);
>      if (ctx->sms)
>          g_object_unref (ctx->sms);
> -    g_list_free_full (ctx->modems, (GDestroyNotify) g_object_unref);
> +    g_list_free_full (ctx->modems, g_object_unref);
>      g_free (ctx->sms_path);
>      g_free (ctx);
>  }
> @@ -911,7 +911,7 @@ list_sms_ready (MMModemMessaging *modem,
>      }
>
>      ctx->sms = find_sms_in_list (sms_list, ctx->sms_path);
> -    g_list_free_full (sms_list, (GDestroyNotify) g_object_unref);
> +    g_list_free_full (sms_list, g_object_unref);
>
>      /* Found! */
>      if (ctx->sms) {
> @@ -1070,7 +1070,7 @@ mmcli_get_sms_sync (GDBusConnection *connection,
>          }
>
>          found = find_sms_in_list (sms_list, sms_path);
> -        g_list_free_full (sms_list, (GDestroyNotify) g_object_unref);
> +        g_list_free_full (sms_list, g_object_unref);
>
>          if (found && o_object)
>              *o_object = g_object_ref (object);
> @@ -1084,7 +1084,7 @@ mmcli_get_sms_sync (GDBusConnection *connection,
>          exit (EXIT_FAILURE);
>      }
>
> -    g_list_free_full (modems, (GDestroyNotify) g_object_unref);
> +    g_list_free_full (modems, g_object_unref);
>      g_free (sms_path);
>
>      if (o_manager)
> @@ -1134,7 +1134,7 @@ get_voice_context_free (GetVoiceContext *ctx)
>          g_object_unref (ctx->manager);
>      if (ctx->call)
>          g_object_unref (ctx->call);
> -    g_list_free_full (ctx->modems, (GDestroyNotify) g_object_unref);
> +    g_list_free_full (ctx->modems, g_object_unref);
>      g_free (ctx->call_path);
>      g_free (ctx);
>  }
> @@ -1185,7 +1185,7 @@ list_call_ready (MMModemVoice *modem,
>      }
>
>      ctx->call = find_call_in_list (call_list, ctx->call_path);
> -    g_list_free_full (call_list, (GDestroyNotify) g_object_unref);
> +    g_list_free_full (call_list, g_object_unref);
>
>      /* Found! */
>      if (ctx->call) {
> @@ -1359,7 +1359,7 @@ mmcli_get_call_sync (GDBusConnection *connection,
>          }
>
>          found = find_call_in_list (call_list, call_path);
> -        g_list_free_full (call_list, (GDestroyNotify) g_object_unref);
> +        g_list_free_full (call_list, g_object_unref);
>
>          if (found && o_object)
>              *o_object = g_object_ref (object);
> @@ -1373,7 +1373,7 @@ mmcli_get_call_sync (GDBusConnection *connection,
>          exit (EXIT_FAILURE);
>      }
>
> -    g_list_free_full (modems, (GDestroyNotify) g_object_unref);
> +    g_list_free_full (modems, g_object_unref);
>      g_free (call_path);
>
>      if (o_manager)
> diff --git a/cli/mmcli-manager.c b/cli/mmcli-manager.c
> index 24ecc4eb..5e5e60b6 100644
> --- a/cli/mmcli-manager.c
> +++ b/cli/mmcli-manager.c
> @@ -314,7 +314,7 @@ list_current_modems (MMManager *manager)
>          for (l = modems; l; l = g_list_next (l)) {
>              print_modem_short_info (MM_OBJECT (l->data));
>          }
> -        g_list_free_full (modems, (GDestroyNotify) g_object_unref);
> +        g_list_free_full (modems, g_object_unref);
>      }
>      g_print ("\n");
>  }
> @@ -412,7 +412,7 @@ get_manager_ready (GObject      *source,
>                  mm_manager_report_kernel_event (ctx->manager, properties, NULL, NULL, NULL);
>                  g_object_unref (properties);
>              }
> -            g_list_free_full (list, (GDestroyNotify) g_object_unref);
> +            g_list_free_full (list, g_object_unref);
>          }
>
>          /* If we get cancelled, operation done */
> --
> 2.12.2.564.g063fe858b8-goog
>



-- 
Aleksander
https://aleksander.es


More information about the ModemManager-devel mailing list