[PATCH] utils: drop useless g_file_test() call
Aleksander Morgado
aleksander at aleksander.es
Fri Apr 14 21:45:16 UTC 2017
On Wed, Apr 12, 2017 at 6:32 PM, Mikhail Efremov <sem at altlinux.org> wrote:
> canonicalize_file_name() returns NULL if file doesn't exist,
> so no need to check file existence with g_file_test().
> ---
Pushed to git master, thanks.
> src/libqmi-glib/qmi-utils.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/src/libqmi-glib/qmi-utils.c b/src/libqmi-glib/qmi-utils.c
> index 29e5f22..5d399a6 100644
> --- a/src/libqmi-glib/qmi-utils.c
> +++ b/src/libqmi-glib/qmi-utils.c
> @@ -743,8 +743,10 @@ __qmi_utils_get_driver (const gchar *cdc_wdm_path)
> path = canonicalize_file_name (tmp);
> g_free (tmp);
>
> - if (g_file_test (path, G_FILE_TEST_EXISTS))
> - driver = g_path_get_basename (path);
> + if (!path)
> + continue;
> +
> + driver = g_path_get_basename (path);
> g_free (path);
> }
>
> --
> 2.10.2
>
> _______________________________________________
> libqmi-devel mailing list
> libqmi-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/libqmi-devel
--
Aleksander
https://aleksander.es
More information about the libqmi-devel
mailing list