mirror of
https://github.com/MariaDB/server.git
synced 2026-05-15 19:37:16 +02:00
More consistent handling of magic numbers
innobase/include/data0data.h: dtuple_struct:magic_n: Enclose in #ifdef UNIV_DEBUG innobase/dict/dict0dict.c: Use magic_n only #ifdef UNIV_DEBUG innobase/dict/dict0mem.c: Use magic_n only #ifdef UNIV_DEBUG innobase/ha/hash0hash.c: Remove unused functions hash_mutex_enter_all and hash_mutex_exit_all Use magic_n only #ifdef UNIV_DEBUG Add ut_ad(table->magic_n == HASH_TABLE_MAGIC_N) innobase/include/dict0mem.h: Use magic_n only #ifdef UNIV_DEBUG innobase/include/hash0hash.h: Remove unused functions hash_mutex_enter_all and hash_mutex_exit_all Use magic_n only #ifdef UNIV_DEBUG innobase/include/hash0hash.ic: Add ut_ad(table->magic_n == HASH_TABLE_MAGIC_N) innobase/include/mtr0mtr.h: Use state, magic_n only #ifdef UNIV_DEBUG innobase/include/row0ins.h: Use magic_n only #ifdef UNIV_DEBUG innobase/include/row0upd.h: Use magic_n only #ifdef UNIV_DEBUG innobase/row/row0ins.c: Use magic_n only #ifdef UNIV_DEBUG Add ut_ad(node->magic_n == INS_NODE_MAGIC_N) innobase/row/row0upd.c: Use magic_n only #ifdef UNIV_DEBUG Add ut_ad(node->magic_n == UPD_NODE_MAGIC_N) innobase/thr/thr0loc.c: Use magic_n only #ifdef UNIV_DEBUG
This commit is contained in:
parent
cb9f304897
commit
edc17c009a
13 changed files with 68 additions and 81 deletions
|
|
@ -18,6 +18,7 @@ hash_get_nth_cell(
|
|||
hash_table_t* table, /* in: hash table */
|
||||
ulint n) /* in: cell index */
|
||||
{
|
||||
ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
|
||||
ut_ad(n < table->n_cells);
|
||||
|
||||
return(table->array + n);
|
||||
|
|
@ -32,6 +33,7 @@ hash_get_n_cells(
|
|||
/* out: number of cells */
|
||||
hash_table_t* table) /* in: table */
|
||||
{
|
||||
ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
|
||||
return(table->n_cells);
|
||||
}
|
||||
|
||||
|
|
@ -45,6 +47,7 @@ hash_calc_hash(
|
|||
ulint fold, /* in: folded value */
|
||||
hash_table_t* table) /* in: hash table */
|
||||
{
|
||||
ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
|
||||
return(ut_hash_ulint(fold, table->n_cells));
|
||||
}
|
||||
|
||||
|
|
@ -58,6 +61,7 @@ hash_get_mutex_no(
|
|||
hash_table_t* table, /* in: hash table */
|
||||
ulint fold) /* in: fold */
|
||||
{
|
||||
ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
|
||||
return(ut_2pow_remainder(fold, table->n_mutexes));
|
||||
}
|
||||
|
||||
|
|
@ -71,6 +75,7 @@ hash_get_nth_heap(
|
|||
hash_table_t* table, /* in: hash table */
|
||||
ulint i) /* in: index of the heap */
|
||||
{
|
||||
ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
|
||||
ut_ad(i < table->n_mutexes);
|
||||
|
||||
return(table->heaps[i]);
|
||||
|
|
@ -88,6 +93,8 @@ hash_get_heap(
|
|||
{
|
||||
ulint i;
|
||||
|
||||
ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
|
||||
|
||||
if (table->heap) {
|
||||
return(table->heap);
|
||||
}
|
||||
|
|
@ -107,6 +114,7 @@ hash_get_nth_mutex(
|
|||
hash_table_t* table, /* in: hash table */
|
||||
ulint i) /* in: index of the mutex */
|
||||
{
|
||||
ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
|
||||
ut_ad(i < table->n_mutexes);
|
||||
|
||||
return(table->mutexes + i);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue