diff options
author | unknown <marko@hundin.mysql.fi> | 2004-03-11 23:12:02 +0200 |
---|---|---|
committer | unknown <marko@hundin.mysql.fi> | 2004-03-11 23:12:02 +0200 |
commit | edc17c009ab4d61495fd506cea58f1cf77bb06e9 (patch) | |
tree | 148175ce29b93ab6acaa2a1ca244b9b09575a98a /innobase/ha | |
parent | cb9f304897564f0eb0c76b6cd155a337fac34b19 (diff) | |
download | mariadb-git-edc17c009ab4d61495fd506cea58f1cf77bb06e9.tar.gz |
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
Diffstat (limited to 'innobase/ha')
-rw-r--r-- | innobase/ha/hash0hash.c | 38 |
1 files changed, 6 insertions, 32 deletions
diff --git a/innobase/ha/hash0hash.c b/innobase/ha/hash0hash.c index 1f7edf9d7d2..808aa88da3d 100644 --- a/innobase/ha/hash0hash.c +++ b/innobase/ha/hash0hash.c @@ -22,6 +22,7 @@ hash_mutex_enter( hash_table_t* table, /* in: hash table */ ulint fold) /* in: fold */ { + ut_ad(table->magic_n == HASH_TABLE_MAGIC_N); mutex_enter(hash_get_mutex(table, fold)); } @@ -34,41 +35,10 @@ hash_mutex_exit( hash_table_t* table, /* in: hash table */ ulint fold) /* in: fold */ { + ut_ad(table->magic_n == HASH_TABLE_MAGIC_N); mutex_exit(hash_get_mutex(table, fold)); } -/**************************************************************** -Reserves all the mutexes of a hash table, in an ascending order. */ - -void -hash_mutex_enter_all( -/*=================*/ - hash_table_t* table) /* in: hash table */ -{ - ulint i; - - for (i = 0; i < table->n_mutexes; i++) { - - mutex_enter(table->mutexes + i); - } -} - -/**************************************************************** -Releases all the mutexes of a hash table. */ - -void -hash_mutex_exit_all( -/*================*/ - hash_table_t* table) /* in: hash table */ -{ - ulint i; - - for (i = 0; i < table->n_mutexes; i++) { - - mutex_exit(table->mutexes + i); - } -} - /***************************************************************** Creates a hash table with >= n array cells. The actual number of cells is chosen to be a prime number slightly bigger than n. */ @@ -97,7 +67,9 @@ hash_create( table->mutexes = NULL; table->heaps = NULL; table->heap = NULL; +#ifdef UNIV_DEBUG table->magic_n = HASH_TABLE_MAGIC_N; +#endif /* UNIV_DEBUG */ /* Initialize the cell array */ @@ -118,6 +90,7 @@ hash_table_free( /*============*/ hash_table_t* table) /* in, own: hash table */ { + ut_ad(table->magic_n == HASH_TABLE_MAGIC_N); ut_a(table->mutexes == NULL); ut_free(table->array); @@ -139,6 +112,7 @@ hash_create_mutexes( ulint i; ut_a(n_mutexes == ut_2_power_up(n_mutexes)); + ut_ad(table->magic_n == HASH_TABLE_MAGIC_N); table->mutexes = mem_alloc(n_mutexes * sizeof(mutex_t)); |