Skip to content
Permalink
Browse files

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
  • Loading branch information...
spetrunia committed Oct 16, 2016
1 parent f456532 commit 274e5be1942aa0b6533d78b43454a7ed940b6628
Showing with 9 additions and 0 deletions.
  1. +1 −0 include/hash.h
  2. +8 −0 mysys/hash.c
@@ -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,
@@ -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

0 comments on commit 274e5be

Please sign in to comment.
You can’t perform that action at this time.