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
This commit is contained in:
Sergei Petrunia 2016-10-16 11:00:07 +00:00
parent f456532c62
commit 274e5be194
2 changed files with 9 additions and 0 deletions

View file

@ -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_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,

View file

@ -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
isn't changed