summaryrefslogtreecommitdiff
path: root/innobase/dict
diff options
context:
space:
mode:
authorunknown <marko@hundin.mysql.fi>2004-05-17 14:40:31 +0300
committerunknown <marko@hundin.mysql.fi>2004-05-17 14:40:31 +0300
commit6b237533f1baae131e192ccbafcfcfaef13f4fc0 (patch)
tree17e1fcb0d47194292389b6b6d5d0b78c2695e328 /innobase/dict
parent1915bfebcb9005102c72028221bb89aa5f0204e4 (diff)
downloadmariadb-git-6b237533f1baae131e192ccbafcfcfaef13f4fc0.tar.gz
InnoDB cleanup: Add const qualifiers to many char* arguments
innobase/dict/dict0dict.c: Replace char* arguments with const char* innobase/dict/dict0load.c: Replace char* arguments with const char* innobase/dict/dict0mem.c: Replace char* arguments with const char* innobase/fil/fil0fil.c: Replace char* arguments with const char* innobase/include/data0data.h: dfield_set_data(): add const qualifier innobase/include/data0data.ic: dfield_set_data(): add const qualifier (temporarily shut up compiler warnings) innobase/include/dict0dict.h: Replace char* arguments with const char* innobase/include/dict0dict.ic: Replace char* arguments with const char* innobase/include/dict0load.h: Replace char* arguments with const char* innobase/include/dict0mem.h: Replace char* arguments with const char* innobase/include/fil0fil.h: Replace char* arguments with const char* innobase/include/os0file.h: Replace char* arguments with const char* innobase/include/os0sync.h: Replace char* arguments with const char* innobase/include/pars0pars.h: Replace char* arguments with const char* innobase/include/pars0sym.h: Replace char* arguments with const char* innobase/include/row0mysql.h: Replace char* arguments with const char* innobase/include/row0sel.h: Replace char* arguments with const char* innobase/include/trx0roll.h: Replace char* arguments with const char* innobase/include/trx0sys.h: Replace char* arguments with const char* innobase/include/trx0trx.h: Replace char* arguments with const char* innobase/include/ut0rnd.h: Replace char* arguments with const char* innobase/include/ut0rnd.ic: Replace char* arguments with const char* innobase/include/ut0ut.h: Remove unused function ut_printf() innobase/os/os0file.c: Replace char* arguments with const char* innobase/os/os0sync.c: Replace char* arguments with const char* innobase/pars/pars0pars.c: Replace char* arguments with const char* innobase/pars/pars0sym.c: Use mem_heap_strdupl() instead of mem_heap_alloc() and memcpy() innobase/row/row0mysql.c: Replace char* arguments with const char* innobase/row/row0sel.c: Replace char* arguments with const char* innobase/trx/trx0roll.c: Replace char* arguments with const char* innobase/trx/trx0sys.c: Replace char* arguments with const char*
Diffstat (limited to 'innobase/dict')
-rw-r--r--innobase/dict/dict0dict.c64
-rw-r--r--innobase/dict/dict0load.c28
-rw-r--r--innobase/dict/dict0mem.c42
3 files changed, 70 insertions, 64 deletions
diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c
index c9e3ac5ec66..6a6ac2492f8 100644
--- a/innobase/dict/dict0dict.c
+++ b/innobase/dict/dict0dict.c
@@ -70,7 +70,7 @@ dict_col_reposition_in_cache(
/*=========================*/
dict_table_t* table, /* in: table */
dict_col_t* col, /* in: column */
- char* new_name); /* in: new table name */
+ const char* new_name); /* in: new table name */
/**************************************************************************
Removes a column from the data dictionary hash table. */
static
@@ -309,7 +309,7 @@ dict_table_get_index_noninline(
/*===========================*/
/* out: index, NULL if does not exist */
dict_table_t* table, /* in: table */
- char* name) /* in: index name */
+ const char* name) /* in: index name */
{
return(dict_table_get_index(table, name));
}
@@ -693,9 +693,10 @@ directory dict_table_get_low is usually the appropriate function. */
dict_table_t*
dict_table_get(
/*===========*/
- /* out: table, NULL if does not exist */
- char* table_name, /* in: table name */
- trx_t* trx) /* in: transaction handle or NULL */
+ /* out: table, NULL if
+ does not exist */
+ const char* table_name, /* in: table name */
+ trx_t* trx) /* in: transaction handle or NULL */
{
dict_table_t* table;
@@ -722,9 +723,10 @@ Returns a table object and increments MySQL open handle count on the table. */
dict_table_t*
dict_table_get_and_increment_handle_count(
/*======================================*/
- /* out: table, NULL if does not exist */
- char* table_name, /* in: table name */
- trx_t* trx) /* in: transaction handle or NULL */
+ /* out: table, NULL if
+ does not exist */
+ const char* table_name, /* in: table name */
+ trx_t* trx) /* in: transaction handle or NULL */
{
dict_table_t* table;
@@ -886,7 +888,7 @@ dict_table_rename_in_cache(
/*=======================*/
/* out: TRUE if success */
dict_table_t* table, /* in: table */
- char* new_name, /* in: new name */
+ const char* new_name, /* in: new name */
ibool rename_also_foreigns)/* in: in ALTER TABLE we want
to preserve the original table name
in constraints which reference it */
@@ -1294,7 +1296,7 @@ dict_col_reposition_in_cache(
/*=========================*/
dict_table_t* table, /* in: table */
dict_col_t* col, /* in: column */
- char* new_name) /* in: new table name */
+ const char* new_name) /* in: new table name */
{
ulint fold;
@@ -2019,7 +2021,7 @@ dict_foreign_find_index(
column types must match */
{
dict_index_t* index;
- char* col_name;
+ const char* col_name;
ulint i;
index = dict_table_get_first_index(table);
@@ -2564,14 +2566,14 @@ static
char*
dict_strip_comments(
/*================*/
- /* out, own: SQL string stripped from
- comments; the caller must free this
- with mem_free()! */
- char* sql_string) /* in: SQL string */
+ /* out, own: SQL string stripped from
+ comments; the caller must free this
+ with mem_free()! */
+ const char* sql_string) /* in: SQL string */
{
- char* str;
- char* sptr;
- char* ptr;
+ char* str;
+ const char* sptr;
+ char* ptr;
str = mem_alloc(strlen(sql_string) + 1);
@@ -2970,7 +2972,8 @@ col_loop1:
}
foreign->foreign_table = table;
- foreign->foreign_table_name = table->name;
+ foreign->foreign_table_name = mem_heap_strdup(foreign->heap,
+ table->name);
foreign->foreign_index = index;
foreign->n_fields = i;
foreign->foreign_col_names = mem_heap_alloc(foreign->heap,
@@ -3244,16 +3247,19 @@ allowed to contain more fields than mentioned in the constraint. */
ulint
dict_create_foreign_constraints(
/*============================*/
- /* out: error code or DB_SUCCESS */
- trx_t* trx, /* in: transaction */
- char* sql_string, /* in: table create or ALTER TABLE
- statement where foreign keys are declared like:
- FOREIGN KEY (a, b) REFERENCES table2(c, d),
- table2 can be written also with the database
- name before it: test.table2; the default
- database is the database of parameter name */
- char* name) /* in: table full name in the normalized form
- database_name/table_name */
+ /* out: error code or DB_SUCCESS */
+ trx_t* trx, /* in: transaction */
+ const char* sql_string, /* in: table create statement where
+ foreign keys are declared like:
+ FOREIGN KEY (a, b) REFERENCES
+ table2(c, d), table2 can be written
+ also with the database
+ name before it: test.table2; the
+ default database id the database of
+ parameter name */
+ const char* name) /* in: table full name in the
+ normalized form
+ database_name/table_name */
{
char* str;
ulint err;
diff --git a/innobase/dict/dict0load.c b/innobase/dict/dict0load.c
index bf8b4582f63..071a3b4c684 100644
--- a/innobase/dict/dict0load.c
+++ b/innobase/dict/dict0load.c
@@ -27,9 +27,10 @@ Finds the first table name in the given database. */
char*
dict_get_first_table_name_in_db(
/*============================*/
- /* out, own: table name, NULL if does not exist;
- the caller must free the memory in the string! */
- char* name) /* in: database name which ends to '/' */
+ /* out, own: table name, NULL if
+ does not exist; the caller must
+ free the memory in the string! */
+ const char* name) /* in: database name which ends to '/' */
{
dict_table_t* sys_tables;
btr_pcur_t pcur;
@@ -389,8 +390,8 @@ Report that an index field or index for a table has been delete marked. */
static
void
dict_load_report_deleted_index(
- char* name, /* in: table name */
- ulint field) /* in: index field, or ULINT_UNDEFINED */
+ const char* name, /* in: table name */
+ ulint field) /* in: index field, or ULINT_UNDEFINED */
{
fputs("InnoDB: Error: data dictionary entry"
" for table ", stderr);
@@ -688,12 +689,13 @@ dictionary cache. */
dict_table_t*
dict_load_table(
/*============*/
- /* out: table, NULL if does not exist; if the table is
- stored in an .ibd file, but the file does not exist,
- then we set the ibd_file_missing flag TRUE in the table
- object we return */
- char* name) /* in: table name in the databasename/tablename
- format */
+ /* out: table, NULL if does not exist;
+ if the table is stored in an .ibd file,
+ but the file does not exist,
+ then we set the ibd_file_missing flag TRUE
+ in the table object we return */
+ const char* name) /* in: table name in the
+ databasename/tablename format */
{
ibool ibd_file_missing = FALSE;
dict_table_t* table;
@@ -1185,8 +1187,8 @@ already in the dictionary cache. */
ulint
dict_load_foreigns(
/*===============*/
- /* out: DB_SUCCESS or error code */
- char* table_name) /* in: table name */
+ /* out: DB_SUCCESS or error code */
+ const char* table_name) /* in: table name */
{
btr_pcur_t pcur;
mem_heap_t* heap;
diff --git a/innobase/dict/dict0mem.c b/innobase/dict/dict0mem.c
index a4f83ddd657..936b06b1905 100644
--- a/innobase/dict/dict0mem.c
+++ b/innobase/dict/dict0mem.c
@@ -30,15 +30,14 @@ dict_table_t*
dict_mem_table_create(
/*==================*/
/* out, own: table object */
- char* name, /* in: table name */
- ulint space, /* in: space where the clustered index of
+ const char* name, /* in: table name */
+ ulint space, /* in: space where the clustered index of
the table is placed; this parameter is
ignored if the table is made a member of
a cluster */
- ulint n_cols) /* in: number of columns */
+ ulint n_cols) /* in: number of columns */
{
dict_table_t* table;
- char* str;
mem_heap_t* heap;
ut_ad(name);
@@ -48,11 +47,9 @@ dict_mem_table_create(
table = mem_heap_alloc(heap, sizeof(dict_table_t));
table->heap = heap;
-
- str = mem_heap_strdup(heap, name);
table->type = DICT_TABLE_ORDINARY;
- table->name = str;
+ table->name = mem_heap_strdup(heap, name);
table->space = space;
table->ibd_file_missing = FALSE;
table->tablespace_discarded = FALSE;
@@ -103,11 +100,11 @@ dict_table_t*
dict_mem_cluster_create(
/*====================*/
/* out, own: cluster object */
- char* name, /* in: cluster name */
- ulint space, /* in: space where the clustered indexes
+ const char* name, /* in: cluster name */
+ ulint space, /* in: space where the clustered indexes
of the member tables are placed */
- ulint n_cols, /* in: number of columns */
- ulint mix_len) /* in: length of the common key prefix in the
+ ulint n_cols, /* in: number of columns */
+ ulint mix_len)/* in: length of the common key prefix in the
cluster */
{
dict_table_t* cluster;
@@ -127,7 +124,7 @@ void
dict_mem_table_make_cluster_member(
/*===============================*/
dict_table_t* table, /* in: non-published table */
- char* cluster_name) /* in: cluster name */
+ const char* cluster_name) /* in: cluster name */
{
table->type = DICT_TABLE_CLUSTER_MEMBER;
table->cluster_name = cluster_name;
@@ -140,7 +137,7 @@ void
dict_mem_table_add_col(
/*===================*/
dict_table_t* table, /* in: table */
- char* name, /* in: column name */
+ const char* name, /* in: column name */
ulint mtype, /* in: main datatype */
ulint prtype, /* in: precise type */
ulint len, /* in: length */
@@ -174,14 +171,15 @@ Creates an index memory object. */
dict_index_t*
dict_mem_index_create(
/*==================*/
- /* out, own: index object */
- char* table_name, /* in: table name */
- char* index_name, /* in: index name */
- ulint space, /* in: space where the index tree is placed,
- ignored if the index is of the clustered
- type */
- ulint type, /* in: DICT_UNIQUE, DICT_CLUSTERED, ... ORed */
- ulint n_fields) /* in: number of fields */
+ /* out, own: index object */
+ const char* table_name, /* in: table name */
+ const char* index_name, /* in: index name */
+ ulint space, /* in: space where the index tree is
+ placed, ignored if the index is of
+ the clustered type */
+ ulint type, /* in: DICT_UNIQUE,
+ DICT_CLUSTERED, ... ORed */
+ ulint n_fields) /* in: number of fields */
{
dict_index_t* index;
mem_heap_t* heap;
@@ -259,7 +257,7 @@ void
dict_mem_index_add_field(
/*=====================*/
dict_index_t* index, /* in: index */
- char* name, /* in: column name */
+ const char* name, /* in: column name */
ulint order, /* in: order criterion; 0 means an
ascending order */
ulint prefix_len) /* in: 0 or the column prefix length