Commit e0009cd4 authored by marko's avatar marko

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.
parent f68d3656
......@@ -8187,7 +8187,7 @@ innobase_create_key_def(
/*====================*/
/* out: key definitions or NULL */
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
definitions are allocated */
KEY* key_info, /* in: Indexes to be created */
......@@ -8214,7 +8214,7 @@ innobase_create_key_def(
key_info->name, "PRIMARY");
if (new_primary) {
dict_index_t* index;
const dict_index_t* index;
/* Create the PRIMARY key index definition */
innobase_create_index_def(key_info, TRUE, indexdef++, heap);
......
......@@ -496,6 +496,7 @@ dict_index_name_print(
FILE* file, /* in: output stream */
trx_t* trx, /* in: transaction */
const dict_index_t* index); /* in: index to print */
#ifdef UNIV_DEBUG
/************************************************************************
Gets the first index on the table (the clustered index). */
UNIV_INLINE
......@@ -503,7 +504,7 @@ dict_index_t*
dict_table_get_first_index(
/*=======================*/
/* 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. */
UNIV_INLINE
......@@ -511,7 +512,11 @@ dict_index_t*
dict_table_get_next_index(
/*======================*/
/* 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. */
UNIV_INLINE
......
......@@ -139,6 +139,7 @@ dict_col_get_clust_pos(
return(ULINT_UNDEFINED);
}
#ifdef UNIV_DEBUG
/************************************************************************
Gets the first index on the table (the clustered index). */
UNIV_INLINE
......@@ -146,12 +147,12 @@ dict_index_t*
dict_table_get_first_index(
/*=======================*/
/* 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->magic_n == DICT_TABLE_MAGIC_N);
return(UT_LIST_GET_FIRST(table->indexes));
return(UT_LIST_GET_FIRST(((dict_table_t*) table)->indexes));
}
/************************************************************************
......@@ -161,13 +162,14 @@ dict_index_t*
dict_table_get_next_index(
/*======================*/
/* 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->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. */
......
......@@ -255,7 +255,7 @@ index on it (on row id). */
ibool
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
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
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. */
......
......@@ -1783,7 +1783,7 @@ index on it (on row id). */
ibool
row_table_got_default_clust_index(
/*==============================*/
dict_table_t* table)
const dict_table_t* table)
{
const dict_index_t* clust_index;
......@@ -1799,9 +1799,9 @@ to take into account if we generated a default clustered index for the table */
ulint
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;
ut_a(index);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment