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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
76a262cd
Commit
76a262cd
authored
Mar 10, 2017
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove my_hash_const_element(), use Hash_set in C++ code
parent
63798a6e
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
52 deletions
+36
-52
include/hash.h
include/hash.h
+0
-1
mysys/hash.c
mysys/hash.c
+0
-8
sql/sql_hset.h
sql/sql_hset.h
+12
-2
storage/rocksdb/ha_rocksdb.cc
storage/rocksdb/ha_rocksdb.cc
+24
-41
No files found.
include/hash.h
View file @
76a262cd
...
...
@@ -74,7 +74,6 @@ my_bool my_hash_init2(HASH *hash, uint growth_size, CHARSET_INFO *charset,
void
my_hash_free
(
HASH
*
tree
);
void
my_hash_reset
(
HASH
*
hash
);
uchar
*
my_hash_element
(
HASH
*
hash
,
ulong
idx
);
const
uchar
*
my_hash_const_element
(
const
HASH
*
hash
,
ulong
idx
);
uchar
*
my_hash_search
(
const
HASH
*
info
,
const
uchar
*
key
,
size_t
length
);
uchar
*
my_hash_search_using_hash_value
(
const
HASH
*
info
,
my_hash_value_type
hash_value
,
...
...
mysys/hash.c
View file @
76a262cd
...
...
@@ -756,14 +756,6 @@ uchar *my_hash_element(HASH *hash, ulong idx)
}
const
uchar
*
my_hash_const_element
(
const
HASH
*
hash
,
ulong
idx
)
{
if
(
idx
<
hash
->
records
)
return
dynamic_element
(
&
hash
->
array
,
idx
,
const
HASH_LINK
*
)
->
data
;
return
0
;
}
/*
Replace old row with new row. This should only be used when key
isn't changed
...
...
sql/sql_hset.h
View file @
76a262cd
...
...
@@ -32,10 +32,12 @@ class Hash_set
Constructs an empty hash. Does not allocate memory, it is done upon
the first insert. Thus does not cause or return errors.
*/
Hash_set
(
uchar
*
(
*
K
)(
const
T
*
,
size_t
*
,
my_bool
))
Hash_set
(
uchar
*
(
*
K
)(
const
T
*
,
size_t
*
,
my_bool
),
CHARSET_INFO
*
cs
=
&
my_charset_bin
)
{
my_hash_clear
(
&
m_hash
);
m_hash
.
get_key
=
(
my_hash_get_key
)
K
;
m_hash
.
charset
=
cs
;
}
/**
Destroy the hash by freeing the buckets table. Does
...
...
@@ -56,7 +58,7 @@ class Hash_set
*/
bool
insert
(
T
*
value
)
{
my_hash_init_opt
(
&
m_hash
,
&
my_charset_bin
,
START_SIZE
,
0
,
0
,
my_hash_init_opt
(
&
m_hash
,
m_hash
.
charset
,
START_SIZE
,
0
,
0
,
m_hash
.
get_key
,
0
,
MYF
(
0
));
size_t
key_len
;
uchar
*
v
=
reinterpret_cast
<
uchar
*>
(
value
);
...
...
@@ -65,6 +67,10 @@ class Hash_set
return
my_hash_insert
(
&
m_hash
,
v
);
return
FALSE
;
}
bool
remove
(
T
*
value
)
{
return
my_hash_delete
(
&
m_hash
,
reinterpret_cast
<
uchar
*>
(
value
));
}
T
*
find
(
const
void
*
key
,
size_t
klen
)
const
{
return
(
T
*
)
my_hash_search
(
&
m_hash
,
reinterpret_cast
<
const
uchar
*>
(
key
),
klen
);
...
...
@@ -73,6 +79,10 @@ class Hash_set
bool
is_empty
()
const
{
return
m_hash
.
records
==
0
;
}
/** Returns the number of unique elements. */
size_t
size
()
const
{
return
static_cast
<
size_t
>
(
m_hash
.
records
);
}
const
T
*
at
(
size_t
i
)
const
{
return
reinterpret_cast
<
T
*>
(
my_hash_element
(
const_cast
<
HASH
*>
(
&
m_hash
),
i
));
}
/** An iterator over hash elements. Is not insert-stable. */
class
Iterator
{
...
...
storage/rocksdb/ha_rocksdb.cc
View file @
76a262cd
This diff is collapsed.
Click to expand it.
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