Skip to content

Commit 5432fa8

Browse files
committed
MDEV-34348: Fix casts in sql_acl
Partial commit of the greater MDEV-34348 scope. MDEV-34348: MariaDB is violating clang-16 -Wcast-function-type-strict Reviewed By: ============ Marko Mäkelä <marko.makela@mariadb.com>
1 parent 7a8eb26 commit 5432fa8

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

sql/sql_acl.cc

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -697,9 +697,9 @@ static bool add_role_user_mapping(const char *uname, const char *hname, const ch
697697
static bool get_YN_as_bool(Field *field);
698698

699699
#define ROLE_CYCLE_FOUND 2
700-
static int traverse_role_graph_up(ACL_ROLE *, void *,
701-
int (*) (ACL_ROLE *, void *),
702-
int (*) (ACL_ROLE *, ACL_ROLE *, void *));
700+
static int
701+
traverse_role_graph_up(ACL_ROLE *, void *, int (*)(ACL_USER_BASE *, void *),
702+
int (*)(ACL_USER_BASE *, ACL_ROLE *, void *));
703703

704704
static int traverse_role_graph_down(ACL_USER_BASE *, void *,
705705
int (*) (ACL_USER_BASE *, void *),
@@ -2848,7 +2848,7 @@ void acl_free(bool end)
28482848
my_hash_free(&acl_roles);
28492849
free_root(&acl_memroot,MYF(0));
28502850
delete_dynamic(&acl_hosts);
2851-
delete_dynamic_with_callback(&acl_users, (FREE_FUNC) free_acl_user);
2851+
delete_dynamic_with_callback(&acl_users, free_acl_user);
28522852
acl_dbs.free_memory();
28532853
delete_dynamic(&acl_wild_hosts);
28542854
delete_dynamic(&acl_proxy_users);
@@ -2956,7 +2956,7 @@ bool acl_reload(THD *thd)
29562956
my_hash_free(&old_acl_roles);
29572957
free_root(&old_mem,MYF(0));
29582958
delete_dynamic(&old_acl_hosts);
2959-
delete_dynamic_with_callback(&old_acl_users, (FREE_FUNC) free_acl_user);
2959+
delete_dynamic_with_callback(&old_acl_users, free_acl_user);
29602960
delete_dynamic(&old_acl_proxy_users);
29612961
my_hash_free(&old_acl_roles_mappings);
29622962
}
@@ -6222,19 +6222,20 @@ static enum PRIVS_TO_MERGE::what sp_privs_to_merge(enum_sp_type type)
62226222
}
62236223

62246224

6225-
static int init_role_for_merging(ACL_ROLE *role, void *context)
6225+
static int init_role_for_merging(ACL_USER_BASE *role_, void *context)
62266226
{
6227+
ACL_ROLE *role= static_cast<ACL_ROLE *>(role_);
62276228
role->counter= 0;
62286229
return 0;
62296230
}
62306231

6231-
static int count_subgraph_nodes(ACL_ROLE *role, ACL_ROLE *grantee, void *context)
6232+
static int count_subgraph_nodes(ACL_USER_BASE *, ACL_ROLE *grantee, void *context)
62326233
{
62336234
grantee->counter++;
62346235
return 0;
62356236
}
62366237

6237-
static int merge_role_privileges(ACL_ROLE *, ACL_ROLE *, void *);
6238+
static int merge_role_privileges(ACL_USER_BASE *, ACL_ROLE *, void *);
62386239
static bool merge_one_role_privileges(ACL_ROLE *grantee, PRIVS_TO_MERGE what);
62396240

62406241
/**
@@ -6474,13 +6475,11 @@ static int traverse_role_graph_impl(ACL_USER_BASE *user, void *context,
64746475
*/
64756476

64766477
static int traverse_role_graph_up(ACL_ROLE *role, void *context,
6477-
int (*on_node) (ACL_ROLE *role, void *context),
6478-
int (*on_edge) (ACL_ROLE *current, ACL_ROLE *neighbour, void *context))
6478+
int (*on_node) (ACL_USER_BASE *role, void *context),
6479+
int (*on_edge) (ACL_USER_BASE *current, ACL_ROLE *neighbour, void *context))
64796480
{
6480-
return traverse_role_graph_impl(role, context,
6481-
my_offsetof(ACL_ROLE, parent_grantee),
6482-
(int (*)(ACL_USER_BASE *, void *))on_node,
6483-
(int (*)(ACL_USER_BASE *, ACL_ROLE *, void *))on_edge);
6481+
return traverse_role_graph_impl(
6482+
role, context, my_offsetof(ACL_ROLE, parent_grantee), on_node, on_edge);
64846483
}
64856484

64866485
/**
@@ -7020,7 +7019,7 @@ static bool merge_role_routine_grant_privileges(ACL_ROLE *grantee,
70207019
/**
70217020
update privileges of the 'grantee' from all roles, granted to it
70227021
*/
7023-
static int merge_role_privileges(ACL_ROLE *role __attribute__((unused)),
7022+
static int merge_role_privileges(ACL_USER_BASE *,
70247023
ACL_ROLE *grantee, void *context)
70257024
{
70267025
PRIVS_TO_MERGE *data= (PRIVS_TO_MERGE *)context;

0 commit comments

Comments
 (0)