[glib: 10/11] Remove function pointer casts when calling xdg_run_command_on_dirs().
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 10/11] Remove function pointer casts when calling xdg_run_command_on_dirs().
- Date: Mon, 27 Sep 2021 11:50:50 +0000 (UTC)
commit 2f98cbe483699a2246204d2a035c837a8b6d22d5
Author: Daniel Cheng <dcheng google com>
Date: Tue Apr 13 22:57:02 2021 +0000
Remove function pointer casts when calling xdg_run_command_on_dirs().
The function pointer casts silence the compiler and allow the code to
build (and even run in the typical case). However, when building with
control flow integrity checks, the runtime (rightfully) complains about
calling a function via a mismatched function pointer type.
gio/xdgmime/xdgmime.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/gio/xdgmime/xdgmime.c b/gio/xdgmime/xdgmime.c
index 338211818..770a4dd0b 100644
--- a/gio/xdgmime/xdgmime.c
+++ b/gio/xdgmime/xdgmime.c
@@ -138,7 +138,8 @@ xdg_dir_time_list_free (XdgDirTimeList *list)
}
static int
-xdg_mime_init_from_directory (const char *directory)
+xdg_mime_init_from_directory (const char *directory,
+ void *user_data)
{
char *file_name;
struct stat st;
@@ -404,10 +405,11 @@ xdg_check_file (const char *file_path,
static int
xdg_check_dir (const char *directory,
- int *invalid_dir_list)
+ void *user_data)
{
int invalid, exists;
char *file_name;
+ int* invalid_dir_list = user_data;
assert (directory != NULL);
@@ -462,8 +464,7 @@ xdg_check_dirs (void)
for (list = dir_time_list; list; list = list->next)
list->checked = XDG_CHECKED_UNCHECKED;
- xdg_run_command_on_dirs ((XdgDirectoryFunc) xdg_check_dir,
- &invalid_dir_list);
+ xdg_run_command_on_dirs (xdg_check_dir, &invalid_dir_list);
if (invalid_dir_list)
return TRUE;
@@ -519,8 +520,7 @@ xdg_mime_init (void)
icon_list = _xdg_mime_icon_list_new ();
generic_icon_list = _xdg_mime_icon_list_new ();
- xdg_run_command_on_dirs ((XdgDirectoryFunc) xdg_mime_init_from_directory,
- NULL);
+ xdg_run_command_on_dirs (xdg_mime_init_from_directory, NULL);
need_reread = FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]