Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
16d8367a
Commit
16d8367a
authored
Mar 19, 2014
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
List<>-style template wrapper over hash_filo
parent
94c97e5b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
9 deletions
+20
-9
sql/hash_filo.h
sql/hash_filo.h
+13
-0
sql/hostname.cc
sql/hostname.cc
+4
-4
sql/sql_acl.cc
sql/sql_acl.cc
+3
-4
sql/sql_servers.cc
sql/sql_servers.cc
+0
-1
No files found.
sql/hash_filo.h
View file @
16d8367a
...
...
@@ -199,4 +199,17 @@ public:
}
};
template
<
class
T
>
class
Hash_filo
:
public
hash_filo
{
public:
Hash_filo
(
uint
size_arg
,
uint
key_offset_arg
,
uint
key_length_arg
,
my_hash_get_key
get_key_arg
,
my_hash_free_key
free_element_arg
,
CHARSET_INFO
*
hash_charset_arg
)
:
hash_filo
(
size_arg
,
key_offset_arg
,
key_length_arg
,
get_key_arg
,
free_element_arg
,
hash_charset_arg
)
{}
T
*
first
()
{
return
(
T
*
)
hash_filo
::
first
();
}
T
*
last
()
{
return
(
T
*
)
hash_filo
::
last
();
}
T
*
search
(
uchar
*
key
,
size_t
len
)
{
return
(
T
*
)
hash_filo
::
search
(
key
,
len
);
}
};
#endif
sql/hostname.cc
View file @
16d8367a
...
...
@@ -126,7 +126,7 @@ void Host_errors::aggregate(const Host_errors *errors)
m_local
+=
errors
->
m_local
;
}
static
hash_filo
*
hostname_cache
;
static
Hash_filo
<
Host_entry
>
*
hostname_cache
;
ulong
host_cache_size
;
void
hostname_cache_refresh
()
...
...
@@ -149,7 +149,7 @@ bool hostname_cache_init()
Host_entry
tmp
;
uint
key_offset
=
(
uint
)
((
char
*
)
(
&
tmp
.
ip_key
)
-
(
char
*
)
&
tmp
);
if
(
!
(
hostname_cache
=
new
hash_filo
(
host_cache_size
,
if
(
!
(
hostname_cache
=
new
Hash_filo
<
Host_entry
>
(
host_cache_size
,
key_offset
,
HOST_ENTRY_KEY_SIZE
,
NULL
,
(
my_hash_free_key
)
free
,
&
my_charset_bin
)))
...
...
@@ -187,11 +187,11 @@ static void prepare_hostname_cache_key(const char *ip_string,
}
Host_entry
*
hostname_cache_first
()
{
return
(
Host_entry
*
)
hostname_cache
->
first
();
}
{
return
hostname_cache
->
first
();
}
static
inline
Host_entry
*
hostname_cache_search
(
const
char
*
ip_key
)
{
return
(
Host_entry
*
)
hostname_cache
->
search
((
uchar
*
)
ip_key
,
0
);
return
hostname_cache
->
search
((
uchar
*
)
ip_key
,
0
);
}
static
void
add_hostname_impl
(
const
char
*
ip_key
,
const
char
*
hostname
,
...
...
sql/sql_acl.cc
View file @
16d8367a
...
...
@@ -727,7 +727,7 @@ static bool initialized=0;
static
bool
allow_all_hosts
=
1
;
static
HASH
acl_check_hosts
,
column_priv_hash
,
proc_priv_hash
,
func_priv_hash
;
static
DYNAMIC_ARRAY
acl_wild_hosts
;
static
hash_filo
*
acl_cache
;
static
Hash_filo
<
acl_entry
>
*
acl_cache
;
static
uint
grant_version
=
0
;
/* Version of priv tables. incremented by acl_load */
static
ulong
get_access
(
TABLE
*
form
,
uint
fieldnr
,
uint
*
next_field
=
0
);
static
bool
check_is_role
(
TABLE
*
form
);
...
...
@@ -924,7 +924,7 @@ my_bool acl_init(bool dont_read_acl_tables)
my_bool
return_val
;
DBUG_ENTER
(
"acl_init"
);
acl_cache
=
new
hash_filo
(
ACL_CACHE_SIZE
,
0
,
0
,
acl_cache
=
new
Hash_filo
<
acl_entry
>
(
ACL_CACHE_SIZE
,
0
,
0
,
(
my_hash_get_key
)
acl_entry_get_key
,
(
my_hash_free_key
)
free
,
&
my_charset_utf8_bin
);
...
...
@@ -2182,8 +2182,7 @@ ulong acl_get(const char *host, const char *ip,
key_length
=
(
size_t
)
(
end
-
key
);
mysql_mutex_lock
(
&
acl_cache
->
lock
);
if
(
!
db_is_pattern
&&
(
entry
=
(
acl_entry
*
)
acl_cache
->
search
((
uchar
*
)
key
,
key_length
)))
if
(
!
db_is_pattern
&&
(
entry
=
acl_cache
->
search
((
uchar
*
)
key
,
key_length
)))
{
db_access
=
entry
->
access
;
mysql_mutex_unlock
(
&
acl_cache
->
lock
);
...
...
sql/sql_servers.cc
View file @
16d8367a
...
...
@@ -38,7 +38,6 @@
#include "unireg.h"
#include "sql_base.h" // close_mysql_tables
#include "records.h" // init_read_record, end_read_record
#include "hash_filo.h"
#include <m_ctype.h>
#include <stdarg.h>
#include "sp_head.h"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment