Re: [Maria-developers] Rev 3768: Changed acl_roles to be stored into a HASH
Hi, Vicențiu! A couple of small notes: On Jun 27, noreply@launchpad.net wrote:
------------------------------------------------------------ revno: 3768 committer: Vicențiu Ciorbaru <cvicentiu@gmail.com> branch nick: trunk timestamp: Fri 2013-06-28 01:20:45 +0300 message: Changed acl_roles to be stored into a HASH.
=== modified file 'sql/sql_acl.cc' --- sql/sql_acl.cc 2013-06-25 21:49:50 +0000 +++ sql/sql_acl.cc 2013-06-27 22:20:45 +0000 @@ -51,6 +51,7 @@ #include "hostname.h" #include "sql_db.h" #include "sql_array.h" +#include "sql_hset.h"
You should probably include hash.h not sql_hset.h because you don't use Hash_set<> template.
@@ -520,6 +521,13 @@ return (uchar*) entry->key; }
+uchar* acl_role_get_key(ACL_USER *entry, size_t *length, + my_bool not_used __attribute__((unused))) +{ + *length=(uint) (entry->user ? strlen(entry->user) : 0);
You know, we generally try to avoid strlens, especially in a code that's used often, like here. Please, replace char *user; in the ACL_USER with LEX_STRING user;
+ return (uchar*) entry->user; +} + #define IP_ADDR_STRLEN (3 + 1 + 3 + 1 + 3 + 1 + 3) #define ACL_KEY_LENGTH (IP_ADDR_STRLEN + 1 + NAME_LEN + \ 1 + USERNAME_LENGTH + 1)
Regards, Sergei
participants (1)
-
Sergei