1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-10 19:44:09 +03:00

branches/zip: Add some const qualifiers to dict_index_t* and dict_table_t*.

innobase_create_key_def(), row_table_got_default_clust_index(),
row_get_mysql_key_number_for_index(): Add a const qualifier.

dict_table_get_first_index(), dict_table_get_next_index(): Define
as a const-preserving macro.  Preserve the old function for UNIV_DEBUG,
but add a const qualifier to the parameter and cast away the constness.
This commit is contained in:
marko
2007-08-13 15:57:28 +00:00
parent f68d3656dc
commit e0009cd4db
5 changed files with 25 additions and 18 deletions

View File

@@ -8187,7 +8187,7 @@ innobase_create_key_def(
/*====================*/ /*====================*/
/* out: key definitions or NULL */ /* out: key definitions or NULL */
trx_t* trx, /* in: trx */ trx_t* trx, /* in: trx */
dict_table_t* table, /* in: table definition */ const dict_table_t*table, /* in: table definition */
mem_heap_t* heap, /* in: heap where space for key mem_heap_t* heap, /* in: heap where space for key
definitions are allocated */ definitions are allocated */
KEY* key_info, /* in: Indexes to be created */ KEY* key_info, /* in: Indexes to be created */
@@ -8214,7 +8214,7 @@ innobase_create_key_def(
key_info->name, "PRIMARY"); key_info->name, "PRIMARY");
if (new_primary) { if (new_primary) {
dict_index_t* index; const dict_index_t* index;
/* Create the PRIMARY key index definition */ /* Create the PRIMARY key index definition */
innobase_create_index_def(key_info, TRUE, indexdef++, heap); innobase_create_index_def(key_info, TRUE, indexdef++, heap);

View File

@@ -496,22 +496,27 @@ dict_index_name_print(
FILE* file, /* in: output stream */ FILE* file, /* in: output stream */
trx_t* trx, /* in: transaction */ trx_t* trx, /* in: transaction */
const dict_index_t* index); /* in: index to print */ const dict_index_t* index); /* in: index to print */
#ifdef UNIV_DEBUG
/************************************************************************ /************************************************************************
Gets the first index on the table (the clustered index). */ Gets the first index on the table (the clustered index). */
UNIV_INLINE UNIV_INLINE
dict_index_t* dict_index_t*
dict_table_get_first_index( dict_table_get_first_index(
/*=======================*/ /*=======================*/
/* out: index, NULL if none exists */ /* out: index, NULL if none exists */
dict_table_t* table); /* in: table */ const dict_table_t* table); /* in: table */
/************************************************************************ /************************************************************************
Gets the next index on the table. */ Gets the next index on the table. */
UNIV_INLINE UNIV_INLINE
dict_index_t* dict_index_t*
dict_table_get_next_index( dict_table_get_next_index(
/*======================*/ /*======================*/
/* out: index, NULL if none left */ /* out: index, NULL if none left */
dict_index_t* index); /* in: index */ const dict_index_t* index); /* in: index */
#else /* UNIV_DEBUG */
# define dict_table_get_first_index(table) UT_LIST_GET_FIRST((table)->indexes)
# define dict_table_get_next_index(index) UT_LIST_GET_NEXT(indexes, index)
#endif /* UNIV_DEBUG */
/************************************************************************ /************************************************************************
Check whether the index is the clustered index. */ Check whether the index is the clustered index. */
UNIV_INLINE UNIV_INLINE

View File

@@ -139,19 +139,20 @@ dict_col_get_clust_pos(
return(ULINT_UNDEFINED); return(ULINT_UNDEFINED);
} }
#ifdef UNIV_DEBUG
/************************************************************************ /************************************************************************
Gets the first index on the table (the clustered index). */ Gets the first index on the table (the clustered index). */
UNIV_INLINE UNIV_INLINE
dict_index_t* dict_index_t*
dict_table_get_first_index( dict_table_get_first_index(
/*=======================*/ /*=======================*/
/* out: index, NULL if none exists */ /* out: index, NULL if none exists */
dict_table_t* table) /* in: table */ const dict_table_t* table) /* in: table */
{ {
ut_ad(table); ut_ad(table);
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
return(UT_LIST_GET_FIRST(table->indexes)); return(UT_LIST_GET_FIRST(((dict_table_t*) table)->indexes));
} }
/************************************************************************ /************************************************************************
@@ -160,14 +161,15 @@ UNIV_INLINE
dict_index_t* dict_index_t*
dict_table_get_next_index( dict_table_get_next_index(
/*======================*/ /*======================*/
/* out: index, NULL if none left */ /* out: index, NULL if none left */
dict_index_t* index) /* in: index */ const dict_index_t* index) /* in: index */
{ {
ut_ad(index); ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
return(UT_LIST_GET_NEXT(indexes, index)); return(UT_LIST_GET_NEXT(indexes, (dict_index_t*) index));
} }
#endif /* UNIV_DEBUG */
/************************************************************************ /************************************************************************
Check whether the index is the clustered index. */ Check whether the index is the clustered index. */

View File

@@ -255,7 +255,7 @@ index on it (on row id). */
ibool ibool
row_table_got_default_clust_index( row_table_got_default_clust_index(
/*==============================*/ /*==============================*/
dict_table_t* table); const dict_table_t* table);
/************************************************************************* /*************************************************************************
Calculates the key number used inside MySQL for an Innobase index. We have Calculates the key number used inside MySQL for an Innobase index. We have
to take into account if we generated a default clustered index for the table */ to take into account if we generated a default clustered index for the table */
@@ -263,7 +263,7 @@ to take into account if we generated a default clustered index for the table */
ulint ulint
row_get_mysql_key_number_for_index( row_get_mysql_key_number_for_index(
/*===============================*/ /*===============================*/
dict_index_t* index); const dict_index_t* index);
/************************************************************************* /*************************************************************************
Does an update or delete of a row for MySQL. */ Does an update or delete of a row for MySQL. */

View File

@@ -1783,7 +1783,7 @@ index on it (on row id). */
ibool ibool
row_table_got_default_clust_index( row_table_got_default_clust_index(
/*==============================*/ /*==============================*/
dict_table_t* table) const dict_table_t* table)
{ {
const dict_index_t* clust_index; const dict_index_t* clust_index;
@@ -1799,10 +1799,10 @@ to take into account if we generated a default clustered index for the table */
ulint ulint
row_get_mysql_key_number_for_index( row_get_mysql_key_number_for_index(
/*===============================*/ /*===============================*/
dict_index_t* index) const dict_index_t* index)
{ {
dict_index_t* ind; const dict_index_t* ind;
ulint i; ulint i;
ut_a(index); ut_a(index);