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,22 +496,27 @@ 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
dict_index_t*
dict_table_get_first_index(
/*=======================*/
/* out: index, NULL if none exists */
dict_table_t* table); /* in: table */
/* out: index, NULL if none exists */
const dict_table_t* table); /* in: table */
/************************************************************************
Gets the next index on the table. */
UNIV_INLINE
dict_index_t*
dict_table_get_next_index(
/*======================*/
/* out: index, NULL if none left */
dict_index_t* index); /* in: index */
/* out: index, NULL if none left */
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,19 +139,20 @@ dict_col_get_clust_pos(
return(ULINT_UNDEFINED);
}
#ifdef UNIV_DEBUG
/************************************************************************
Gets the first index on the table (the clustered index). */
UNIV_INLINE
dict_index_t*
dict_table_get_first_index(
/*=======================*/
/* out: index, NULL if none exists */
dict_table_t* table) /* in: table */
/* out: index, NULL if none exists */
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));
}
/************************************************************************
......@@ -160,14 +161,15 @@ UNIV_INLINE
dict_index_t*
dict_table_get_next_index(
/*======================*/
/* out: index, NULL if none left */
dict_index_t* index) /* in: index */
/* out: index, NULL if none left */
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,10 +1799,10 @@ 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;
ulint i;
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