diff --git a/steam-runtime-tools/graphics.c b/steam-runtime-tools/graphics.c index 84d494b36657fc7fbe70c5553fbe1b7b3d2a0006..7cf7d8f82af9f5f743d09c199d8c25553787b16f 100644 --- a/steam-runtime-tools/graphics.c +++ b/steam-runtime-tools/graphics.c @@ -1311,29 +1311,6 @@ srt_icd_write_to_file (const SrtIcd *self, return ret; } -/* - * indirect_strcmp0: - * @left: A non-%NULL pointer to a (possibly %NULL) `const char *` - * @right: A non-%NULL pointer to a (possibly %NULL) `const char *` - * - * A #GCompareFunc to sort pointers to strings in lexicographic - * (g_strcmp0()) order. - * - * Returns: An integer < 0 if left < right, > 0 if left > right, - * or 0 if left == right or if they are not comparable - */ -static int -indirect_strcmp0 (gconstpointer left, - gconstpointer right) -{ - const gchar * const *l = left; - const gchar * const *r = right; - - g_return_val_if_fail (l != NULL, 0); - g_return_val_if_fail (r != NULL, 0); - return g_strcmp0 (*l, *r); -} - /* * A #GCompareFunc that does not sort the members of the directory. */ @@ -2143,7 +2120,7 @@ _srt_load_egl_icds (gchar **envp, if (value != NULL) { dirs = g_strsplit (value, G_SEARCHPATH_SEPARATOR_S, -1); - load_json_dirs (sysroot, dirs, NULL, indirect_strcmp0, + load_json_dirs (sysroot, dirs, NULL, _srt_indirect_strcmp0, egl_icd_load_json_cb, &ret); g_strfreev (dirs); } @@ -2159,7 +2136,7 @@ _srt_load_egl_icds (gchar **envp, /* freedesktop-sdk reconfigures the EGL loader to look here. */ tmp = g_strdup_printf ("/usr/lib/%s/GL/" EGL_VENDOR_SUFFIX, multiarch_tuples[i]); - load_json_dir (sysroot, tmp, NULL, indirect_strcmp0, + load_json_dir (sysroot, tmp, NULL, _srt_indirect_strcmp0, egl_icd_load_json_cb, &ret); g_free (tmp); } @@ -2167,9 +2144,9 @@ _srt_load_egl_icds (gchar **envp, else { load_json_dir (sysroot, get_glvnd_sysconfdir (), EGL_VENDOR_SUFFIX, - indirect_strcmp0, egl_icd_load_json_cb, &ret); + _srt_indirect_strcmp0, egl_icd_load_json_cb, &ret); load_json_dir (sysroot, get_glvnd_datadir (), EGL_VENDOR_SUFFIX, - indirect_strcmp0, egl_icd_load_json_cb, &ret); + _srt_indirect_strcmp0, egl_icd_load_json_cb, &ret); } g_free (flatpak_info); @@ -2535,7 +2512,7 @@ _srt_get_modules_from_path (gchar **envp, g_ptr_array_add (in_this_dir, g_build_filename (module_directory_path, member, NULL)); } - g_ptr_array_sort (in_this_dir, indirect_strcmp0); + g_ptr_array_sort (in_this_dir, _srt_indirect_strcmp0); for (gsize j = 0; j < in_this_dir->len; j++) { diff --git a/steam-runtime-tools/utils-internal.h b/steam-runtime-tools/utils-internal.h index 985d4d45fb97000641bd2e4f239d4db6070781bb..1088f7c7f9eca499506f290b415f1ca3f6d8ae9f 100644 --- a/steam-runtime-tools/utils-internal.h +++ b/steam-runtime-tools/utils-internal.h @@ -56,3 +56,6 @@ G_GNUC_INTERNAL void _srt_child_setup_unblock_signals (gpointer ignored); /* not G_GNUC_INTERNAL because s-r-s-i calls it */ void _srt_unblock_signals (void); + +G_GNUC_INTERNAL int _srt_indirect_strcmp0 (gconstpointer left, + gconstpointer right); diff --git a/steam-runtime-tools/utils.c b/steam-runtime-tools/utils.c index 0ea2c03b8af07dd8db85aee2459ab5ffc1276fc6..058cc1da725b9fd26b06d4d6216cec1c46086d44 100644 --- a/steam-runtime-tools/utils.c +++ b/steam-runtime-tools/utils.c @@ -549,3 +549,26 @@ _srt_unblock_signals (void) } } } + +/* + * _srt_indirect_strcmp0: + * @left: A non-%NULL pointer to a (possibly %NULL) `const char *` + * @right: A non-%NULL pointer to a (possibly %NULL) `const char *` + * + * A #GCompareFunc to sort pointers to strings in lexicographic + * (g_strcmp0()) order. + * + * Returns: An integer < 0 if left < right, > 0 if left > right, + * or 0 if left == right or if they are not comparable + */ +int +_srt_indirect_strcmp0 (gconstpointer left, + gconstpointer right) +{ + const gchar * const *l = left; + const gchar * const *r = right; + + g_return_val_if_fail (l != NULL, 0); + g_return_val_if_fail (r != NULL, 0); + return g_strcmp0 (*l, *r); +}