MCPcopy Create free account
hub / github.com/MariaDB/server / remove_ptr_from_dynarray

Function remove_ptr_from_dynarray

sql/sql_acl.cc:4087–4100  ·  view source on GitHub ↗

This helper function is used to removes roles and grantees from the corresponding cross-reference arrays. see remove_role_user_mapping(). as such, it asserts that an element to delete is present in the array, and is present only once. */

Source from the content-addressed store, hash-verified

4085 and is present only once.
4086*/
4087static void remove_ptr_from_dynarray(DYNAMIC_ARRAY *array, void *ptr)
4088{
4089 bool found __attribute__((unused))= false;
4090 for (size_t i= 0; i < array->elements; i++)
4091 {
4092 if (ptr == *dynamic_element(array, i, void**))
4093 {
4094 DBUG_ASSERT(!found);
4095 delete_dynamic_element(array, i);
4096 IF_DBUG_ASSERT(found= true, break);
4097 }
4098 }
4099 DBUG_ASSERT(found);
4100}
4101
4102static void remove_role_user_mapping(ACL_USER_BASE *grantee, ACL_ROLE *role,
4103 int grantee_idx=-1, int role_idx=-1)

Callers 3

remove_role_user_mappingFunction · 0.85
handle_grant_structFunction · 0.85
mysql_revoke_allFunction · 0.85

Calls 1

delete_dynamic_elementFunction · 0.85

Tested by

no test coverage detected