diff options
author | Sergei Golubchik <sergii@pisem.net> | 2011-05-10 18:19:11 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2011-05-10 18:19:11 +0200 |
commit | e343a2c1347a0e99b363dbced913276d2355237f (patch) | |
tree | d50faf1c32fa8c730777db0bbb97a3bf7aee4569 /sql | |
parent | 27fb650b8bc53a9bad060230e054b303364aeb1e (diff) | |
download | mariadb-git-e343a2c1347a0e99b363dbced913276d2355237f.tar.gz |
small enhancement of the create table options feature:
no unnecessary casting from void*, more type safety.
typos fixed.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/create_options.cc | 3 | ||||
-rw-r--r-- | sql/create_options.h | 2 | ||||
-rw-r--r-- | sql/field.h | 5 | ||||
-rw-r--r-- | sql/handler.h | 11 | ||||
-rw-r--r-- | sql/sql_table.cc | 10 | ||||
-rw-r--r-- | sql/structs.h | 3 | ||||
-rw-r--r-- | sql/table.h | 2 |
7 files changed, 22 insertions, 14 deletions
diff --git a/sql/create_options.cc b/sql/create_options.cc index a7124310279..42c69436897 100644 --- a/sql/create_options.cc +++ b/sql/create_options.cc @@ -258,7 +258,7 @@ static const size_t ha_option_type_sizeof[]= @retval FALSE OK */ -my_bool parse_option_list(THD* thd, void **option_struct, +my_bool parse_option_list(THD* thd, void *option_struct_arg, engine_option_value *option_list, ha_create_table_option *rules, my_bool suppress_warning, @@ -267,6 +267,7 @@ my_bool parse_option_list(THD* thd, void **option_struct, ha_create_table_option *opt; size_t option_struct_size= 0; engine_option_value *val= option_list; + void **option_struct= (void**)option_struct_arg; DBUG_ENTER("parse_option_list"); DBUG_PRINT("enter", ("struct: 0x%lx list: 0x%lx rules: 0x%lx suppres %u root 0x%lx", diff --git a/sql/create_options.h b/sql/create_options.h index b66bbf43570..174abb1a59a 100644 --- a/sql/create_options.h +++ b/sql/create_options.h @@ -70,7 +70,7 @@ class Create_field; my_bool parse_engine_table_options(THD *thd, handlerton *ht, TABLE_SHARE *share); -my_bool parse_option_list(THD* thd, void **option_struct, +my_bool parse_option_list(THD* thd, void *option_struct, engine_option_value *option_list, ha_create_table_option *rules, my_bool suppress_warning, diff --git a/sql/field.h b/sql/field.h index 5302b3de821..928f8ff2529 100644 --- a/sql/field.h +++ b/sql/field.h @@ -32,6 +32,7 @@ class Send_field; class Protocol; class Create_field; class Relay_log_info; +struct ha_field_option_struct; struct st_cache_field; int field_conv(Field *to,Field *from); @@ -137,7 +138,7 @@ public: const char *field_name; /** reference to the list of options or NULL */ engine_option_value *option_list; - void *option_struct; /* structure with parsed options */ + ha_field_option_struct *option_struct; /* structure with parsed options */ LEX_STRING comment; /* Field is part of the following keys */ key_map key_start, part_of_key, part_of_key_not_clustered; @@ -2155,7 +2156,7 @@ public: Field *field; // For alter table engine_option_value *option_list; /** structure with parsed options (for comparing fields in ALTER TABLE) */ - void *option_struct; + ha_field_option_struct *option_struct; uint8 row,col,sc_length,interval_id; // For rea_create_table uint offset,pack_flag; diff --git a/sql/handler.h b/sql/handler.h index 32112fdcd13..3dadf37dcdf 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -593,6 +593,11 @@ struct handler_log_file_data { See ha_example.cc for an example. */ + +struct ha_table_option_struct; +struct ha_field_option_struct; +struct ha_index_option_struct; + enum ha_option_type { HA_OPTION_TYPE_ULL, /* unsigned long long */ HA_OPTION_TYPE_STRING, /* char * */ HA_OPTION_TYPE_ENUM, /* uint */ @@ -1060,9 +1065,9 @@ typedef struct st_ha_create_information enum ha_choice page_checksum; ///< If we have page_checksums engine_option_value *option_list; ///< list of table create options /* the following three are only for ALTER TABLE, check_if_incompatible_data() */ - void *option_struct; ///< structure with parsed table options - void **fileds_option_struct; ///< array of field option structures - void **indexes_option_struct; ///< array of index option structures + ha_table_option_struct *option_struct; ///< structure with parsed table options + ha_field_option_struct **fields_option_struct; ///< array of field option structures + ha_index_option_struct **indexes_option_struct; ///< array of index option structures } HA_CREATE_INFO; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 98de5e95da9..2697155df86 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -5855,10 +5855,10 @@ compare_tables(TABLE *table, DBUG_RETURN(0); } - if ((create_info->fileds_option_struct= - (void**)thd->calloc(sizeof(void*) * table->s->fields)) == NULL || - (create_info->indexes_option_struct= - (void**)thd->calloc(sizeof(void*) * table->s->keys)) == NULL) + if ((create_info->fields_option_struct= (ha_field_option_struct**) + thd->calloc(sizeof(void*) * table->s->fields)) == NULL || + (create_info->indexes_option_struct= (ha_index_option_struct**) + thd->calloc(sizeof(void*) * table->s->keys)) == NULL) DBUG_RETURN(1); /* @@ -5879,7 +5879,7 @@ compare_tables(TABLE *table, tmp_new_field= tmp_new_field_it++) { DBUG_ASSERT(i < table->s->fields); - create_info->fileds_option_struct[i]= tmp_new_field->option_struct; + create_info->fields_option_struct[i]= tmp_new_field->option_struct; /* Make sure we have at least the default charset in use. */ if (!new_field->charset) diff --git a/sql/structs.h b/sql/structs.h index 64e69fca0d0..e2fd2140763 100644 --- a/sql/structs.h +++ b/sql/structs.h @@ -69,6 +69,7 @@ typedef struct st_key_part_info { /* Info about a key part */ } KEY_PART_INFO ; class engine_option_value; +struct ha_index_option_struct; typedef struct st_key { uint key_length; /* Tot length of key */ @@ -104,7 +105,7 @@ typedef struct st_key { struct st_table *table; /** reference to the list of options or NULL */ engine_option_value *option_list; - void *option_struct; /* structure with parsed options */ + ha_index_option_struct *option_struct; /* structure with parsed options */ } KEY; diff --git a/sql/table.h b/sql/table.h index afe1f64dae1..1b7713022ce 100644 --- a/sql/table.h +++ b/sql/table.h @@ -343,7 +343,7 @@ typedef struct st_table_share struct st_table *open_tables; /* link to open tables */ #endif engine_option_value *option_list; /* text options for table */ - void *option_struct; /* structure with parsed options */ + ha_table_option_struct *option_struct; /* structure with parsed options */ /* The following is copied to each TABLE on OPEN */ Field **field; |