Commit 274e5be1 authored by Sergei Petrunia's avatar Sergei Petrunia

MariaRocks: port my_hash_const_element


"Add new function my_hash_const_element(), the const equivalent of
my_hash_element()" - comes from facebook/mysql-5.6,
7c869d34b9fa2262b941efd6363a260b7c37948f
parent f456532c
...@@ -74,6 +74,7 @@ my_bool my_hash_init2(HASH *hash, uint growth_size, CHARSET_INFO *charset, ...@@ -74,6 +74,7 @@ my_bool my_hash_init2(HASH *hash, uint growth_size, CHARSET_INFO *charset,
void my_hash_free(HASH *tree); void my_hash_free(HASH *tree);
void my_hash_reset(HASH *hash); void my_hash_reset(HASH *hash);
uchar *my_hash_element(HASH *hash, ulong idx); 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(const HASH *info, const uchar *key, size_t length);
uchar *my_hash_search_using_hash_value(const HASH *info, uchar *my_hash_search_using_hash_value(const HASH *info,
my_hash_value_type hash_value, my_hash_value_type hash_value,
......
...@@ -721,6 +721,14 @@ uchar *my_hash_element(HASH *hash, ulong idx) ...@@ -721,6 +721,14 @@ 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 Replace old row with new row. This should only be used when key
isn't changed isn't changed
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment