[PATCH 2/2] qmi-firmware-update: remove explicit GDestroyNotify cast on g_free / g_object_unref

Aleksander Morgado aleksander at aleksander.es
Wed Mar 29 08:44:20 UTC 2017


On 29/03/17 03:48, Ben Chan wrote:
> g_free and g_object_unref are in form of  `void (*)(gpointer)`, which
> matches the GDestroyNotify signature. An explicit GDestroyNotify cast on
> g_free and g_object_unref is thus not needed.
> ---

Thanks, pushed to git master.

>  src/qmi-firmware-update/qfu-device-selection.c | 6 +++---
>  src/qmi-firmware-update/qfu-operation-update.c | 2 +-
>  src/qmi-firmware-update/qfu-reseter.c          | 4 ++--
>  src/qmi-firmware-update/qfu-udev-helpers.c     | 2 +-
>  src/qmi-firmware-update/qfu-updater.c          | 4 ++--
>  5 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/src/qmi-firmware-update/qfu-device-selection.c b/src/qmi-firmware-update/qfu-device-selection.c
> index a367548..22c2063 100644
> --- a/src/qmi-firmware-update/qfu-device-selection.c
> +++ b/src/qmi-firmware-update/qfu-device-selection.c
> @@ -74,7 +74,7 @@ device_selection_get_single (QfuDeviceSelection      *self,
>              preferred_selection = g_object_ref (l->data);
>          g_free (path);
>      }
> -    g_list_free_full (list, (GDestroyNotify) g_object_unref);
> +    g_list_free_full (list, g_object_unref);
>  
>      if (preferred_selection) {
>          path = g_file_get_path (preferred_selection);
> @@ -154,7 +154,7 @@ device_selection_get_multiple (QfuDeviceSelection      *self,
>          path = g_file_get_path (preferred_selection);
>          g_debug ("[qfu,device-selection]   using only preferred device: %s", path);
>          g_free (path);
> -        g_list_free_full (list, (GDestroyNotify) g_object_unref);
> +        g_list_free_full (list, g_object_unref);
>          return g_list_append (NULL, preferred_selection);
>      }
>  
> @@ -212,7 +212,7 @@ wait_for_device_ready (gpointer      unused,
>      if (!file)
>          g_task_return_error (task, error);
>      else
> -        g_task_return_pointer (task, file, (GDestroyNotify) g_object_unref);
> +        g_task_return_pointer (task, file, g_object_unref);
>      g_object_unref (task);
>  }
>  
> diff --git a/src/qmi-firmware-update/qfu-operation-update.c b/src/qmi-firmware-update/qfu-operation-update.c
> index af061e9..02f5ab1 100644
> --- a/src/qmi-firmware-update/qfu-operation-update.c
> +++ b/src/qmi-firmware-update/qfu-operation-update.c
> @@ -104,7 +104,7 @@ operation_update_run (QfuUpdater   *updater,
>  
>      /* Run! */
>      qfu_updater_run (updater, image_file_list, operation.cancellable, (GAsyncReadyCallback) run_ready, &operation);
> -    g_list_free_full (image_file_list, (GDestroyNotify) g_object_unref);
> +    g_list_free_full (image_file_list, g_object_unref);
>      g_main_loop_run (operation.loop);
>  
>      if (operation.cancellable)
> diff --git a/src/qmi-firmware-update/qfu-reseter.c b/src/qmi-firmware-update/qfu-reseter.c
> index 541d390..979294a 100644
> --- a/src/qmi-firmware-update/qfu-reseter.c
> +++ b/src/qmi-firmware-update/qfu-reseter.c
> @@ -77,8 +77,8 @@ run_context_free (RunContext *ctx)
>          qmi_device_close_async (ctx->qmi_device, 10, NULL, NULL, NULL);
>          g_object_unref (ctx->qmi_device);
>      }
> -    g_list_free_full (ctx->ttys, (GDestroyNotify) g_object_unref);
> -    g_list_free_full (ctx->at_devices, (GDestroyNotify) g_object_unref);
> +    g_list_free_full (ctx->ttys, g_object_unref);
> +    g_list_free_full (ctx->at_devices, g_object_unref);
>      g_slice_free (RunContext, ctx);
>  }
>  
> diff --git a/src/qmi-firmware-update/qfu-udev-helpers.c b/src/qmi-firmware-update/qfu-udev-helpers.c
> index 3412f46..7524dc5 100644
> --- a/src/qmi-firmware-update/qfu-udev-helpers.c
> +++ b/src/qmi-firmware-update/qfu-udev-helpers.c
> @@ -303,7 +303,7 @@ qfu_udev_helper_find_by_device_info (guint16   vid,
>      GString     *match_str;
>      gchar       *sysfs_path = NULL;
>  
> -    sysfs_paths = g_ptr_array_new_with_free_func ((GDestroyNotify) g_free);
> +    sysfs_paths = g_ptr_array_new_with_free_func (g_free);
>      udev        = g_udev_client_new (NULL);
>      match_str   = g_string_new ("");
>  
> diff --git a/src/qmi-firmware-update/qfu-updater.c b/src/qmi-firmware-update/qfu-updater.c
> index 53c2315..efe4f61 100644
> --- a/src/qmi-firmware-update/qfu-updater.c
> +++ b/src/qmi-firmware-update/qfu-updater.c
> @@ -202,7 +202,7 @@ run_context_free (RunContext *ctx)
>  
>      if (ctx->current_image)
>          g_object_unref (ctx->current_image);
> -    g_list_free_full (ctx->pending_images, (GDestroyNotify) g_object_unref);
> +    g_list_free_full (ctx->pending_images, g_object_unref);
>  
>      g_slice_free (RunContext, ctx);
>  }
> @@ -1002,7 +1002,7 @@ set_firmware_preference_ready (QmiClientDms *client,
>              g_print ("device already contains the given firmware/config version: no download needed\n");
>              g_print ("forcing the download may be requested with the --override-download option\n");
>              g_print ("now power cycling to apply the new firmware preference...\n");
> -            g_list_free_full (ctx->pending_images, (GDestroyNotify) g_object_unref);
> +            g_list_free_full (ctx->pending_images, g_object_unref);
>              ctx->pending_images = NULL;
>          } else {
>              GString                 *images = NULL;
> 


-- 
Aleksander
https://aleksander.es


More information about the libqmi-devel mailing list